blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
458421773508bcbef9aff48a41eb521115ef26bf
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava4/Foo878.java
2a91aeb99f1e8cbb438d45577c320db8effbd77c
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package applicationModulepackageJava4; public class Foo878 { public void foo0() { new applicationModulepackageJava4.Foo877().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
88be9e7b7141eba088cdaf139f593c777d6c57cb
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_a22d3b89805269684ab89013bb73f695d86face7/Uploader/24_a22d3b89805269684ab89013bb73f695d86face7_Uploader_s.java
828b6f7ec20f50c5f303bca132a0710cfe6d0c29
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
43,278
java
/* * Copyright 2010 Manuel Carrasco Moñino. (manolo at apache/org) * http://code.google.com/p/gwtupload * * 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 gwtupload.client; import static gwtupload.shared.UConsts.LEGACY_TAG_MSG_START; import static gwtupload.shared.UConsts.PARAM_BLOBKEY; import static gwtupload.shared.UConsts.PARAM_BLOBSTORE; import static gwtupload.shared.UConsts.PARAM_CANCEL; import static gwtupload.shared.UConsts.PARAM_REMOVE; import static gwtupload.shared.UConsts.PARAM_SESSION; import static gwtupload.shared.UConsts.PARAM_SHOW; import static gwtupload.shared.UConsts.TAG_BLOBSTORE; import static gwtupload.shared.UConsts.TAG_BLOBSTORE_PATH; import static gwtupload.shared.UConsts.TAG_CANCELED; import static gwtupload.shared.UConsts.TAG_CTYPE; import static gwtupload.shared.UConsts.TAG_CURRENT_BYTES; import static gwtupload.shared.UConsts.TAG_FIELD; import static gwtupload.shared.UConsts.TAG_FINISHED; import static gwtupload.shared.UConsts.TAG_KEY; import static gwtupload.shared.UConsts.TAG_MESSAGE; import static gwtupload.shared.UConsts.TAG_MSG_END; import static gwtupload.shared.UConsts.TAG_MSG_GT; import static gwtupload.shared.UConsts.TAG_MSG_LT; import static gwtupload.shared.UConsts.TAG_MSG_START; import static gwtupload.shared.UConsts.TAG_NAME; import static gwtupload.shared.UConsts.TAG_PERCENT; import static gwtupload.shared.UConsts.TAG_SIZE; import static gwtupload.shared.UConsts.TAG_TOTAL_BYTES; import static gwtupload.shared.UConsts.TAG_WAIT; import gwtupload.client.IFileInput.FileInputType; import gwtupload.client.IUploadStatus.Status; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.http.client.Request; import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.RequestTimeoutException; import com.google.gwt.http.client.Response; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FormPanel; import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent; import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler; import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; import com.google.gwt.user.client.ui.FormPanel.SubmitHandler; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Hidden; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.xml.client.Document; import com.google.gwt.xml.client.XMLParser; import com.google.gwt.xml.client.impl.DOMParseException; /** * <p> * Uploader panel. * </p> * * @author Manolo Carrasco Moñino * * <h3>Features</h3> * <ul> * <li>Renders a form with an input file for sending the file, and a hidden iframe where is received the server response</li> * <li>The user can add more elements to the form</li> * <li>It asks the server for the upload progress continuously until the submit process has finished.</li> * <li>It expects xml responses instead of gwt-rpc, so the server part can be implemented in any language</li> * <li>It uses a progress interface so it is easy to use customized progress bars</li> * <li>By default it renders a basic progress bar</li> * <li>It can be configured to automatic submit after the user has selected the file</li> * <li>It uses a queue that avoid submit more than a file at the same time</li> * </ul> * * <h3>CSS Style Rules</h3> * <ul> * <li>.GWTUpld { Uploader container }</li> * <li>.GWTUpld .upld-input { style for the FileInput element }</li> * <li>.GWTUpld .upld-status { style for the IUploadStatus element }</li> * <li>.GWTUpld .upld-button { style for submit button if present }</li> * </ul> */ public class Uploader extends Composite implements IsUpdateable, IUploader, HasJsData { public Widget getWidget(){ return this; } /** * FormPanel add method only can be called once. * This class override the add method to allow multiple additions * to a flowPanel. */ public class FormFlowPanel extends FormPanel { FlowPanel formElements = new FlowPanel(); public FormFlowPanel() { super.add(formElements); formElements.setStyleName("upld-form-elements"); } public void add(Widget w) { if (w instanceof Hidden) { formElements.insert(w, 0); } else { formElements.add(w); } } public void add(Widget w, int index) { formElements.insert(w, Math.max(0, Math.min(index, formElements.getWidgetCount()))); } public void clear() { formElements.clear(); add(fileInput.getWidget()); } } public static final int DEFAULT_FILEINPUT_SIZE = 40; public static final UploaderConstants I18N_CONSTANTS = GWT.create(UploaderConstants.class); protected static final String STYLE_BUTTON = "upld-button"; protected static final String STYLE_INPUT = "upld-input"; protected static final String STYLE_MAIN = "GWTUpld"; protected static final String STYLE_STATUS = "upld-status"; static HTML mlog; static Logger logger; private static final int DEFAULT_AJAX_TIMEOUT = 10000; private static final int DEFAULT_AUTOUPLOAD_DELAY = 600; private static final int DEFAULT_TIME_MAX_WITHOUT_RESPONSE = 60000; private static final int DEFAULT_UPDATE_INTERVAL = 500; private static HashSet<String> fileDone = new HashSet<String>(); private static List<String> fileQueue = new ArrayList<String>(); private static int statusInterval = DEFAULT_UPDATE_INTERVAL; private static int uploadTimeout = DEFAULT_TIME_MAX_WITHOUT_RESPONSE; public static void log(String msg, Throwable e) { if (mlog == null) { if (Window.Location.getParameter("log") != null) { mlog = new HTML(); RootPanel.get().add(mlog); log(msg, e); } else { if (logger == null) { logger = Logger.getLogger("Gwt client Uploader"); } logger.info(msg); GWT.log(msg, e); } } else { String html = (msg + "\n" + (e != null ? e.getMessage() :"")).replaceAll("\n", "<br/>"); mlog.setHTML(mlog.getHTML() + html); } } /** * Configure the frequency to send status requests to the server. */ public static void setStatusInterval(int statusInterval) { Uploader.statusInterval = statusInterval; } /** * Configure the maximal time without a valid response from the server. * When this period is reached, the upload process is canceled. */ public static void setUploadTimeout(int uploadTimeout) { Uploader.uploadTimeout = uploadTimeout; } private static long now() { return (new Date()).getTime(); } protected Panel uploaderPanel; private final Timer automaticUploadTimer = new Timer() { private boolean firstTime = true; public void run() { if (isTheFirstInQueue()) { this.cancel(); firstTime = true; statusWidget.setStatus(IUploadStatus.Status.SUBMITING); statusWidget.setVisible(true); // See issue #134 try { uploadForm.submit(); } catch (Exception e) { cancel(); cancelUpload(i18nStrs.uploaderInvalidPathError()); } } else if (firstTime) { addToQueue(); firstTime = false; } } }; protected boolean autoSubmit = false; private boolean avoidRepeatedFiles = false; private boolean avoidEmptyFile = true; private String basename = ""; private boolean blobstore = false; private IUploadStatus.UploadCancelHandler cancelHandler = new IUploadStatus.UploadCancelHandler() { public void onCancel() { cancel(); } }; private boolean canceled = false; private boolean enabled = true; private IFileInput fileInput; protected String fileInputPrefix = "GWTU"; private FileInputType fileInputType; private boolean finished = false; private boolean hasSession = false; private long lastData = now(); private final RequestCallback onBlobstoreReceivedCallback = new RequestCallback() { public void onError(Request request, Throwable exception) { String message = removeHtmlTags(exception.getMessage()); cancelUpload(i18nStrs.uploaderServerUnavailable() + " (1) " + getServletPath() + "\n\n" + message); } public void onResponseReceived(Request request, Response response) { String text = response.getText(); String url = null; try { url = Utils.getXmlNodeValue(XMLParser.parse(text), TAG_BLOBSTORE_PATH); } catch (DOMParseException e) { String bpath = "<" + TAG_BLOBSTORE_PATH + ">"; String sbpath = "</" + TAG_BLOBSTORE_PATH + ">"; if (text.contains(bpath)) { url = text.replaceAll("[\r\n]+","").replaceAll("^.*" + bpath + "\\s*", "").replaceAll("\\s*" + sbpath + ".*$", ""); } } catch (Exception e) { cancelUpload(i18nStrs.uploaderBlobstoreError() + "\n>>>\n" + e.getMessage() + "\n>>>>\n" + e); return; } if (url != null && url.length() > 0 && !"null".equalsIgnoreCase(url)) { uploadForm.setAction(url); } receivedBlobPath = true; uploadForm.submit(); } }; private final RequestCallback onCancelReceivedCallback = new RequestCallback() { public void onError(Request request, Throwable exception) { log("onCancelReceivedCallback onError: " , exception); statusWidget.setStatus(IUploadStatus.Status.CANCELED); } public void onResponseReceived(Request request, Response response) { if (getStatus() == Status.CANCELING) { updateStatusTimer.scheduleRepeating(3000); } } }; private List<IUploader.OnChangeUploaderHandler> onChangeHandlers = new ArrayList<IUploader.OnChangeUploaderHandler>(); private final RequestCallback onDeleteFileCallback = new RequestCallback() { public void onError(Request request, Throwable exception) { statusWidget.setStatus(Status.DELETED); log("onCancelReceivedCallback onError: ", exception); } public void onResponseReceived(Request request, Response response) { statusWidget.setStatus(Status.DELETED); fileDone.remove(getFileName()); } }; private final ChangeHandler onFileInputChanged = new ChangeHandler() { public void onChange(ChangeEvent event) { basename = Utils.basename(getFileName()); statusWidget.setFileName(basename); if (avoidRepeatedFiles && fileDone.contains(getFileName())) { statusWidget.setStatus(Status.REPEATED); return; } if (autoSubmit && !validateExtension(basename)) { return; } if (autoSubmit && basename.length() > 0) { automaticUploadTimer.scheduleRepeating(DEFAULT_AUTOUPLOAD_DELAY); } onChangeInput(); } }; private List<IUploader.OnFinishUploaderHandler> onFinishHandlers = new ArrayList<IUploader.OnFinishUploaderHandler>(); private final RequestCallback onSessionReceivedCallback = new RequestCallback() { public void onError(Request request, Throwable exception) { String message = removeHtmlTags(exception.getMessage()); cancelUpload(i18nStrs.uploaderServerUnavailable() + " (2) " + getServletPath() + "\n\n" + message); } public void onResponseReceived(Request request, Response response) { hasSession = true; try { String s = Utils.getXmlNodeValue(XMLParser.parse(response.getText()), TAG_BLOBSTORE); blobstore = "true".equalsIgnoreCase(s); // with blobstore status does not make sense if (blobstore) { updateStatusTimer.setInterval(5000); } uploadForm.submit(); } catch (Exception e) { String message = e.getMessage().contains("error:") ? i18nStrs.uploaderServerUnavailable() + " (3) " + getServletPath() + "\n\n" + i18nStrs.uploaderServerError() + "\nAction: " + getServletPath() + "\nException: " + e.getMessage() + response.getText() : i18nStrs.submitError(); cancelUpload( message); } } }; private List<IUploader.OnStartUploaderHandler> onStartHandlers = new ArrayList<IUploader.OnStartUploaderHandler>(); private List<IUploader.OnStatusChangedHandler> onStatusChangeHandlers = new ArrayList<IUploader.OnStatusChangedHandler>(); /** * Handler called when the status request response comes back. * * In case of success it parses the xml document received and updates the progress widget * In case of a non timeout error, it stops the status repeater and notifies the user with the exception. */ private final RequestCallback onStatusReceivedCallback = new RequestCallback() { public void onError(Request request, Throwable exception) { waitingForResponse = false; if (exception instanceof RequestTimeoutException) { log("GWTUpload: onStatusReceivedCallback timeout error, asking the server again.", null); } else { log("GWTUpload: onStatusReceivedCallback error: " + exception.getMessage(), exception); updateStatusTimer.cancel(); String message = removeHtmlTags(exception.getMessage()); message += "\n" + exception.getClass().getName(); message += "\n" + exception.toString(); statusWidget.setError(i18nStrs.uploaderServerUnavailable() + " (4) " + getServletPath() + "\n\n" + message); } } public void onResponseReceived(Request request, Response response) { waitingForResponse = false; if (finished == true && !uploading) { updateStatusTimer.cancel(); return; } parseAjaxResponse(response.getText()); } }; private boolean onSubmitComplete; private SubmitCompleteHandler onSubmitCompleteHandler = new SubmitCompleteHandler() { @SuppressWarnings("deprecation") public void onSubmitComplete(SubmitCompleteEvent event) { updateStatusTimer.cancel(); onSubmitComplete = true; serverResponse = event.getResults(); if (serverResponse != null) { serverResponse = serverResponse.replaceFirst(".*(" + TAG_MSG_START + "|" + LEGACY_TAG_MSG_START + ")([\\s\\S]*?)" + TAG_MSG_END + ".*", "$2"); serverResponse = serverResponse.replace(TAG_MSG_LT, "<").replace(TAG_MSG_GT, ">").replace("&lt;", "<").replaceAll("&gt;", ">"); } log("onSubmitComplete: " + serverResponse, null); try { // Parse the xml and extract serverInfo Document doc = XMLParser.parse(serverResponse); serverInfo.name = Utils.getXmlNodeValue(doc, TAG_NAME); serverInfo.ctype = Utils.getXmlNodeValue(doc, TAG_CTYPE); String size = Utils.getXmlNodeValue(doc, TAG_SIZE); if (size != null) { serverInfo.size = Integer.parseInt(size); } serverInfo.field = Utils.getXmlNodeValue(doc, TAG_FIELD); serverInfo.message = Utils.getXmlNodeValue(doc, TAG_MESSAGE); serverInfo.key = Utils.getXmlNodeValue(doc, TAG_KEY); // If the server response is a valid xml parseAjaxResponse(serverResponse); } catch (Exception e) { log("onSubmitComplete exception parsing response: ", e); // Otherwise force an ajax request so as we have not to wait to the timer schedule updateStatusTimer.run(); } } }; /** * Handler called when the file form is submitted * * If any validation fails, the upload process is canceled. * * If the client hasn't got the session, it asks for a new one * and the submit process is delayed until the client has got it */ private SubmitHandler onSubmitFormHandler = new SubmitHandler() { public void onSubmit(SubmitEvent event) { if (!finished && uploading) { uploading = false; statusWidget.setStatus(IUploadStatus.Status.CANCELED); return; } if (!autoSubmit && fileQueue.size() > 0) { statusWidget.setError(i18nStrs.uploaderActiveUpload()); event.cancel(); return; } if (avoidRepeatedFiles && fileDone.contains(getFileName())) { statusWidget.setStatus(IUploadStatus.Status.REPEATED); successful = true; event.cancel(); uploadFinished(); return; } if (!validateExtension(basename)) { event.cancel(); return; } if (!hasSession) { event.cancel(); try { sendAjaxRequestToValidateSession(); } catch (Exception e) { log("Exception in validateSession", null); } return; } if (blobstore && !receivedBlobPath) { event.cancel(); try { sendAjaxRequestToGetBlobstorePath(); } catch (Exception e) { log("Exception in getblobstorePath", null); } return; } receivedBlobPath = false; addToQueue(); uploading = true; finished = false; serverResponse = null; serverInfo = new UploadedInfo(); statusWidget.setVisible(true); updateStatusTimer.squeduleStart(); statusWidget.setStatus(IUploadStatus.Status.INPROGRESS); lastData = now(); } }; private boolean receivedBlobPath = false; private int requestsCounter = 0; private String serverResponse = null; private UploadedInfo serverInfo = new UploadedInfo(); private String servletPath = "servlet.gupld"; private IUploadStatus.UploadStatusChangedHandler statusChangedHandler = new IUploadStatus.UploadStatusChangedHandler() { public void onStatusChanged(IUploadStatus statusWiget) { for (IUploader.OnStatusChangedHandler handler : onStatusChangeHandlers) { handler.onStatusChanged(thisInstance); } } }; private IUploadStatus statusWidget = new BaseUploadStatus(); protected UploaderConstants i18nStrs = I18N_CONSTANTS; private boolean successful = false; private Uploader thisInstance; private final UpdateTimer updateStatusTimer = new UpdateTimer(this, statusInterval); private FormPanel uploadForm; private boolean uploading = false; private String[] validExtensions = null; private String validExtensionsMsg = ""; private boolean waitingForResponse = false; /** * Default constructor. * Initialize widget components and layout elements using the * standard file input. */ public Uploader() { this(FileInputType.BROWSER_INPUT); } /** * Initialize widget components and layout elements using the * standard file input. * * @param automaticUpload * when true the upload starts as soon as the user selects a file */ public Uploader(boolean automaticUpload) { this(FileInputType.BROWSER_INPUT, automaticUpload); } /** * Initialize widget components and layout elements. * * @param type * file input to use */ public Uploader(FileInputType type) { this(type, null); } /** * Initialize widget components and layout elements. * * @param type * file input to use * @param automaticUpload * when true the upload starts as soon as the user selects a file */ public Uploader(FileInputType type, boolean automaticUpload) { this(type); setAutoSubmit(automaticUpload); } /** * Initialize widget components and layout elements. * * @param type * file input to use * @param form * An existing form panel to use */ public Uploader(FileInputType type, FormPanel form) { thisInstance = this; this.fileInputType = type; if (form == null) { form = new FormFlowPanel(); } uploadForm = form; uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); uploadForm.setAction(servletPath); uploadForm.addSubmitHandler(onSubmitFormHandler); uploadForm.addSubmitCompleteHandler(onSubmitCompleteHandler); uploaderPanel = getUploaderPanel(); uploaderPanel.add(uploadForm); uploaderPanel.setStyleName(STYLE_MAIN); setFileInput(fileInputType.getInstance()); setStatusWidget(statusWidget); super.initWidget(uploaderPanel); } protected Panel getUploaderPanel() { return new HorizontalPanel(); } /** * Adds a widget to formPanel. */ public void add(Widget w) { uploadForm.add(w); } /** * Adds a widget to formPanel in a specified position. */ public void add(Widget w, int index) { if (uploadForm instanceof FormFlowPanel) { ((FormFlowPanel)uploadForm).add(w, index); } else { add(w); } } /* (non-Javadoc) * @see gwtupload.client.IUploader#addOnCancelUploadHandler(gwtupload.client.IUploader.OnCancelUploaderHandler) */ public HandlerRegistration addOnCancelUploadHandler(final OnCancelUploaderHandler handler) { assert handler != null; return statusWidget.addCancelHandler(new IUploadStatus.UploadCancelHandler() { public void onCancel() { handler.onCancel(thisInstance); } }); } /* (non-Javadoc) * @see gwtupload.client.IUploader#addOnChangeUploadHandler(gwtupload.client.IUploader.OnChangeUploaderHandler) */ public HandlerRegistration addOnChangeUploadHandler(final IUploader.OnChangeUploaderHandler handler) { assert handler != null; onChangeHandlers.add(handler); return new HandlerRegistration() { public void removeHandler() { onChangeHandlers.remove(handler); } }; } /* (non-Javadoc) * @see gwtupload.client.IUploader#addOnFinishUploadHandler(gwtupload.client.IUploader.OnFinishUploaderHandler) */ public HandlerRegistration addOnFinishUploadHandler(final IUploader.OnFinishUploaderHandler handler) { assert handler != null; onFinishHandlers.add(handler); return new HandlerRegistration() { public void removeHandler() { onFinishHandlers.remove(handler); } }; } /* (non-Javadoc) * @see gwtupload.client.IUploader#addOnStartUploadHandler(gwtupload.client.IUploader.OnStartUploaderHandler) */ public HandlerRegistration addOnStartUploadHandler(final IUploader.OnStartUploaderHandler handler) { assert handler != null; onStartHandlers.add(handler); return new HandlerRegistration() { public void removeHandler() { onStartHandlers.remove(handler); } }; } /* (non-Javadoc) * @see gwtupload.client.IUploader#addOnStatusChangedHandler(gwtupload.client.IUploader.OnStatusChangedHandler) */ public HandlerRegistration addOnStatusChangedHandler(final OnStatusChangedHandler handler) { assert handler != null; onStatusChangeHandlers.add(handler); return new HandlerRegistration() { public void removeHandler() { onStatusChangeHandlers.remove(handler); } }; } /** * Don't send files that have already been uploaded. */ public void avoidRepeatFiles(boolean avoidRepeat) { this.avoidRepeatedFiles = avoidRepeat; } /** * Don't submit the form if the user has not selected any file. * * It is useful in forms where the developer whats the user to submit * information but the attachment is optional. * * By default avoidEmptyFile is true. */ public void avoidEmptyFiles(boolean b) { this.avoidEmptyFile = b; } /** * Cancel the current upload process. */ public void cancel() { if (getStatus() == Status.UNINITIALIZED) { return; } if (finished && !uploading) { if (successful) { try { sendAjaxRequestToDeleteUploadedFile(); } catch (Exception e) { } } else { statusWidget.setStatus(Status.DELETED); } return; } if (canceled || getStatus() == Status.CANCELING) { return; } canceled = true; automaticUploadTimer.cancel(); log("cancelling " + uploading, null); if (uploading) { updateStatusTimer.cancel(); try { sendAjaxRequestToCancelCurrentUpload(); } catch (Exception e) { log("Exception cancelling request " + e.getMessage(), e); } statusWidget.setStatus(IUploadStatus.Status.CANCELING); } else { uploadFinished(); } } /** * Remove all widget from the form. */ public void clear() { uploadForm.clear(); } /** * Returns the link for getting the uploaded file from the server * It's useful to display uploaded images or generate links to uploaded files. */ public String fileUrl() { String ret = composeURL(PARAM_SHOW + "=" + getInputName()); if (serverInfo.key != null) { ret += "&" + PARAM_BLOBKEY + "=" + serverInfo.key; } return ret; } /* (non-Javadoc) * @see gwtupload.client.IUploader#getBasename() */ public String getBasename() { return Utils.basename(getFileName()); } /** * Returns a JavaScriptObject properties with the url of the uploaded file. * It's useful in the exported version of the library. * Because native javascript needs it */ public JavaScriptObject getData() { return getDataImpl(fileUrl(), getInputName(), getFileName(), getBasename(), getServerResponse(), getServerInfo().message, getStatus().toString(), getServerInfo().size); } public IFileInput getFileInput() { return fileInput; } /* (non-Javadoc) * @see gwtupload.client.IUploader#getFileName() */ public String getFileName() { return fileInput.getFilename(); } public FormPanel getForm() { return uploadForm; } public UploaderConstants getI18NConstants(){ return i18nStrs; } /* (non-Javadoc) * @see gwtupload.client.IUploader#getInputName() */ public String getInputName() { return fileInput.getName(); } /* (non-Javadoc) * @see gwtupload.client.IUploader#getServerResponse() */ public String getServerResponse() { return serverResponse; } /* (non-Javadoc) * @see gwtupload.client.IUploader#getServerInfo() */ public UploadedInfo getServerInfo() { return serverInfo; } /** * return the configured server service in the form-panel. */ public String getServletPath() { return servletPath; } /* (non-Javadoc) * @see gwtupload.client.IUploader#getStatus() */ public Status getStatus() { return statusWidget.getStatus(); } /** * Get the status progress used. */ public IUploadStatus getStatusWidget() { return statusWidget; } /* (non-Javadoc) * @see gwtupload.client.IUploader#isEnabled() */ public boolean isEnabled() { return enabled; } public boolean isFinished() { return finished; } /** * Returns a iterator of the widgets contained in the form panel. */ public Iterator<Widget> iterator() { return uploadForm.iterator(); } /** * remove a widget from the form panel. */ public boolean remove(Widget w) { return uploadForm.remove(w); } /* (non-Javadoc) * @see gwtupload.client.IUploader#reset() */ public void reset() { reuse(); fileDone = new HashSet<String>(); } /** * Prepare the uploader for a new upload. */ public void reuse() { this.uploadForm.reset(); updateStatusTimer.cancel(); onSubmitComplete = uploading = canceled = finished = successful = false; } /* (non-Javadoc) * @see gwtupload.client.IUploader#setAutoSubmit(boolean) */ public void setAutoSubmit(boolean b) { autoSubmit = b; } /* (non-Javadoc) * @see gwtupload.client.IUploader#setEnabled(boolean) */ public void setEnabled(boolean b) { enabled = b; if (fileInput != null) { fileInput.setEnabled(b); } } public void setFileInput(IFileInput input) { if (fileInput != null) { fileInput.getWidget().removeFromParent(); } fileInput = input; fileInput.addChangeHandler(onFileInputChanged); fileInput.setText(i18nStrs.uploaderBrowse()); fileInput.setEnabled(enabled); setFileInputSize(DEFAULT_FILEINPUT_SIZE); assignNewNameToFileInput(); uploadForm.add(fileInput.getWidget()); } /* (non-Javadoc) * @see gwtupload.client.IUploader#setFileInputPrefix(java.lang.String) */ public void setFileInputPrefix(String prefix) { fileInputPrefix = prefix; assignNewNameToFileInput(); } /* (non-Javadoc) * @see gwtupload.client.IUploader#setFileInputSize(int) */ public void setFileInputSize(int length) { fileInput.setLength(length); } /* (non-Javadoc) * @see gwtupload.client.IUploader#setI18Constants(gwtupload.client.I18nUploadConstants) */ public void setI18Constants(UploaderConstants strs) { this.i18nStrs = strs; fileInput.setText(strs.uploaderBrowse()); statusWidget.setI18Constants(strs); } /** * set the url of the server service that receives the files and informs * about the progress. */ public void setServletPath(String path) { if (path != null) { servletPath = path; uploadForm.setAction(path); } } /** * set the status widget used to display the upload progress. */ public void setStatusWidget(IUploadStatus stat) { if (stat == null) { return; } uploaderPanel.remove(statusWidget.getWidget()); statusWidget = stat; if (!stat.getWidget().isAttached()) { uploaderPanel.add(statusWidget.getWidget()); } statusWidget.getWidget().addStyleName(STYLE_STATUS); statusWidget.setVisible(false); statusWidget.addCancelHandler(cancelHandler); statusWidget.setStatusChangedHandler(statusChangedHandler); } /* (non-Javadoc) * @see gwtupload.client.IUploader#setValidExtensions(java.lang.String[]) */ public void setValidExtensions(String... validExtensions) { if (validExtensions == null) { this.validExtensions = new String[0]; return; } this.validExtensions = new String[validExtensions.length]; validExtensionsMsg = ""; for (int i = 0, j = 0; i < validExtensions.length; i++) { String ext = validExtensions[i]; if (ext == null) { continue; } if (ext.charAt(0) != '.') { ext = "." + ext; } if (i > 0) { validExtensionsMsg += ", "; } validExtensionsMsg += ext; ext = ext.replaceAll("\\.", "\\\\."); ext = ".+" + ext; this.validExtensions[j++] = ext.toLowerCase(); } } public void setValidExtensions(String ext) { setValidExtensions(ext.split("[, ]+")); } /* (non-Javadoc) * @see gwtupload.client.IUploader#submit() */ public void submit() { this.uploadForm.submit(); } /* (non-Javadoc) * @see gwtupload.client.IUploader#setUploaded() */ public void setUploaded(UploadedInfo info) { serverInfo = info; successful = true; statusWidget.setFileName(info.name); fileInput.setName(info.field); uploadFinished(); } /* (non-Javadoc) * @see gwtupload.client.IUpdateable#update() */ public void update() { try { if (waitingForResponse) { return; } waitingForResponse = true; // Using a reusable builder makes IE fail because it caches the response // So it's better to change the request path sending an additional random parameter RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL("filename=" + fileInput.getName() , "c=" + requestsCounter++)); reqBuilder.setTimeoutMillis(DEFAULT_AJAX_TIMEOUT); reqBuilder.sendRequest("get_status", onStatusReceivedCallback); } catch (RequestException e) { e.printStackTrace(); } } /** * Method called when the file input has changed. This happens when the * user selects a file. * * Override this method if you want to add a customized behavior, * but remember to call this in your function */ protected void onChangeInput() { statusWidget.setStatus(Status.CHANGED); for (IUploader.OnChangeUploaderHandler handler : onChangeHandlers) { handler.onChange(this); } } /** * Method called when the file upload process has finished, * or the file has been canceled or removed from the queue. * Override this method if you want to add a customized behavior, * but remember to call this in your function. */ protected void onFinishUpload() { for (IUploader.OnFinishUploaderHandler handler : onFinishHandlers) { handler.onFinish(this); } } /** * Method called when the file is added to the upload queue. * Override this if you want to add a customized behavior, * but remember to call this from your method. */ protected void onStartUpload() { for (IUploader.OnStartUploaderHandler handler : onStartHandlers) { handler.onStart(this); } } /** * Adds a file to the upload queue. */ private void addToQueue() { statusWidget.setStatus(IUploadStatus.Status.QUEUED); statusWidget.setProgress(0, 0); if (!fileQueue.contains(fileInput.getName())) { onStartUpload(); fileQueue.add(fileInput.getName()); } } /** * Change the fileInput name, because the server uses it as an uniq identifier. */ protected void assignNewNameToFileInput() { String fileInputName = (fileInputPrefix + "-" + Math.random()).replaceAll("\\.", ""); fileInput.setName(fileInputName); } /** * Cancel upload process and show an error message to the user. */ private void cancelUpload(String msg) { successful = false; uploadFinished(); statusWidget.setStatus(IUploadStatus.Status.ERROR); statusWidget.setError(msg); } private String composeURL(String... params) { String ret = getServletPath(); ret = ret.replaceAll("[\\?&]+$", ""); String sep = ret.contains("?") ? "&" : "?"; for (String par : params) { ret += sep + par; sep = "&"; } for (Entry<String, List<String>> e : Window.Location.getParameterMap().entrySet()) { ret += sep + e.getKey() + "=" + e.getValue().get(0); } ret += sep + "random=" + Math.random(); return ret; } private native JavaScriptObject getDataImpl(String url, String inputName, String fileName, String baseName, String serverResponse, String serverMessage, String status, int size) /*-{ return { url: url, name: inputName, filename: fileName, basename: baseName, response: serverResponse, message: serverMessage, status: status, size: size }; }-*/; private boolean isTheFirstInQueue() { return fileQueue.size() > 0 && fileQueue.get(0).equals(fileInput.getName()); } private void parseAjaxResponse(String responseTxt) { if (responseTxt == null) { return; } String error = null; Document doc = null; try { doc = XMLParser.parse(responseTxt); error = Utils.getXmlNodeValue(doc, "error"); } catch (Exception e) { if (responseTxt.toLowerCase().matches("error")) { error = i18nStrs.uploaderServerError() + "\nAction: " + getServletPath() + "\nException: " + e.getMessage() + responseTxt; } } if (error != null) { successful = false; cancelUpload(error); return; } else if (Utils.getXmlNodeValue(doc, TAG_WAIT) != null) { if (serverResponse != null) { log("server response received, cancelling the upload " + getFileName() + " " + serverResponse, null); successful = true; uploadFinished(); } } else if (Utils.getXmlNodeValue(doc, TAG_CANCELED) != null) { log("server response is: canceled " + getFileName(), null); successful = false; canceled = true; uploadFinished(); return; } else if (Utils.getXmlNodeValue(doc, TAG_FINISHED) != null) { log("server response is: finished " + getFileName(), null); successful = true; if (onSubmitComplete) { log("POST response from server has been received", null); uploadFinished(); } return; } else if (Utils.getXmlNodeValue(doc, TAG_PERCENT) != null) { lastData = now(); long transferredKB = Long.valueOf(Utils.getXmlNodeValue(doc, TAG_CURRENT_BYTES)) / 1024; long totalKB = Long.valueOf(Utils.getXmlNodeValue(doc, TAG_TOTAL_BYTES)) / 1024; statusWidget.setProgress(transferredKB, totalKB); log("server response transferred " + transferredKB + "/" + totalKB + " " + getFileName(), null); if (onSubmitComplete) { successful = false; String msg = i18nStrs.uploaderBadServerResponse() + "\n" + serverResponse; if (blobstore) { msg += "\n" + i18nStrs.uploaderBlobstoreBilling(); } log(msg, null); statusWidget.setError(msg); uploadFinished(); } return; } else { log("incorrect response: " + getFileName() + " " + responseTxt, null); } if (uploadTimeout > 0 && now() - lastData > uploadTimeout) { successful = false; cancelUpload(i18nStrs.uploaderTimeout()); try { sendAjaxRequestToCancelCurrentUpload(); } catch (Exception e) { } } } /** * remove a file from the upload queue. */ private void removeFromQueue() { fileQueue.remove(fileInput.getName()); } private String removeHtmlTags(String message) { return message.replaceAll("<[^>]+>", ""); } private void sendAjaxRequestToCancelCurrentUpload() throws RequestException { RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL(PARAM_CANCEL + "=true")); reqBuilder.sendRequest("cancel_upload", onCancelReceivedCallback); } private void sendAjaxRequestToDeleteUploadedFile() throws RequestException { RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL(PARAM_REMOVE + "=" + getInputName())); reqBuilder.sendRequest("remove_file", onDeleteFileCallback); } /** * Sends a request to the server in order to get the blobstore path. * When the response with the session comes, it submits the form. */ private void sendAjaxRequestToGetBlobstorePath() throws RequestException { RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL(PARAM_BLOBSTORE + "=true")); reqBuilder.setTimeoutMillis(DEFAULT_AJAX_TIMEOUT); reqBuilder.sendRequest("blobstore", onBlobstoreReceivedCallback); } /** * Sends a request to the server in order to get the session cookie, * when the response with the session comes, it submits the form. * * This is needed because this client application usually is part of * static files, and the server doesn't set the session until dynamic pages * are requested. * * If we submit the form without a session, the server creates a new * one and send a cookie in the response, but the response with the * cookie comes to the client at the end of the request, and in the * meanwhile the client needs to know the session in order to ask * the server for the upload status. */ private void sendAjaxRequestToValidateSession() throws RequestException { // Using a reusable builder makes IE fail RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL(PARAM_SESSION + "=true")); reqBuilder.setTimeoutMillis(DEFAULT_AJAX_TIMEOUT); reqBuilder.sendRequest("create_session", onSessionReceivedCallback); } /** * Called when the uploader detects that the upload process has finished: * - in the case of submit complete. * - in the case of error talking with the server. */ private void uploadFinished() { removeFromQueue(); finished = true; uploading = false; updateStatusTimer.cancel(); statusWidget.setVisible(false); if (successful) { if (avoidRepeatedFiles) { if (!fileDone.contains(getFileName())) { fileDone.add(getFileName()); } statusWidget.setStatus(IUploadStatus.Status.SUCCESS); } else { statusWidget.setStatus(IUploadStatus.Status.SUCCESS); } } else if (canceled) { statusWidget.setStatus(IUploadStatus.Status.CANCELED); } else { statusWidget.setStatus(IUploadStatus.Status.ERROR); } onFinishUpload(); } private boolean validateExtension(String filename) { if (filename == null || filename.length() == 0) { return !avoidEmptyFile; } boolean valid = Utils.validateExtension(validExtensions, filename); if (!valid) { finished = true; statusWidget.setStatus(Status.INVALID); statusWidget.setError(i18nStrs.uploaderInvalidExtension() + validExtensionsMsg); } return valid; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
08675b6f6007f2678829e057fcc38c08f096b0c9
e252ec1303b06d7d495928dce85fbe44037c7ed3
/src/main/java/com/cloudstong/platform/third/bpm/service/BpmFormRunService.java
589d54e88ffba2374384e0c8a424f062b9fcbf8b
[]
no_license
liaosheng2018/yunplatform
f8a0d8ba75ab28cdb6d602b4fb3f4f374bec1b15
2ef9fde99ab8969914422183891c66a52b0ef5d2
refs/heads/master
2022-03-29T20:19:48.008963
2020-01-12T06:16:27
2020-01-12T06:16:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,858
java
package com.cloudstong.platform.third.bpm.service; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.cloudstong.platform.core.util.UniqueIdUtil; import com.cloudstong.platform.third.bpm.dao.BpmDefinitionDao; import com.cloudstong.platform.third.bpm.dao.BpmFormRunDao; import com.cloudstong.platform.third.bpm.dao.BpmNodeSetDao; import com.cloudstong.platform.third.bpm.model.BpmDefinition; import com.cloudstong.platform.third.bpm.model.BpmFormRun; import com.cloudstong.platform.third.bpm.model.BpmNodeSet; import com.cloudstong.platform.third.bpm.model.FlowNode; import com.cloudstong.platform.third.bpm.model.NodeCache; @Service public class BpmFormRunService { @Resource private BpmFormRunDao dao; @Resource private BpmNodeSetDao bpmNodeSetDao; @Resource private ProcessRunService processRunService; @Resource private BpmDefinitionDao bpmDefinitionDao; public void addFormRun(String actDefId, Long runId, String actInstanceId) { List<BpmNodeSet> list = bpmNodeSetDao.getOnlineFormByActDefId(actDefId); for (BpmNodeSet bpmNodeSet : list) { BpmFormRun bpmFormRun = getByBpmNodeSet(runId, actInstanceId, bpmNodeSet); dao.save(bpmFormRun); } } private BpmNodeSet getDefalutStartForm(List<BpmNodeSet> list, Short setType) { BpmNodeSet bpmNodeSet = null; for (BpmNodeSet node : list) { if (node.getSetType().equals(setType)) { bpmNodeSet = node; break; } } return bpmNodeSet; } private BpmNodeSet getStartForm(List<BpmNodeSet> list) { BpmNodeSet bpmNodeSet = getDefalutStartForm(list, BpmNodeSet.SetType_StartForm); return bpmNodeSet; } private BpmNodeSet getGlobalForm(List<BpmNodeSet> list) { BpmNodeSet bpmNodeSet = getDefalutStartForm(list, BpmNodeSet.SetType_GloabalForm); return bpmNodeSet; } public Map<String, BpmNodeSet> getTaskForm(List<BpmNodeSet> list) { Map map = new HashMap(); for (BpmNodeSet node : list) { if (node.getSetType().equals(BpmNodeSet.SetType_TaskNode)) { map.put(node.getNodeId(), node); } } return map; } private BpmFormRun getByBpmNodeSet(Long runId, String actInstanceId, BpmNodeSet bpmNodeSet) { BpmFormRun bpmFormRun = new BpmFormRun(); bpmFormRun.setId(Long.valueOf(UniqueIdUtil.genId())); bpmFormRun.setRunId(runId); bpmFormRun.setActInstanceId(actInstanceId); bpmFormRun.setActDefId(bpmNodeSet.getActDefId()); bpmFormRun.setActNodeId(bpmNodeSet.getNodeId()); bpmFormRun.setFormdefId(bpmNodeSet.getFormDefId()); bpmFormRun.setFormdefKey(bpmNodeSet.getFormKey()); bpmFormRun.setFormType(bpmNodeSet.getFormType()); bpmFormRun.setFormUrl(bpmNodeSet.getFormUrl()); bpmFormRun.setSetType(bpmNodeSet.getSetType()); return bpmFormRun; } public BpmNodeSet getStartBpmNodeSet(String actDefId, Short toFirstNode) { String firstTaskName = processRunService.getFirstNodetByDefId(actDefId); List list = bpmNodeSetDao.getByActDefId(actDefId); BpmNodeSet bpmNodeSetStart = getStartForm(list); BpmNodeSet bpmNodeSetGlobal = getGlobalForm(list); Map taskMap = getTaskForm(list); BpmNodeSet firstBpmNodeSet = (BpmNodeSet) taskMap.get(firstTaskName); if (bpmNodeSetStart == null) { if (toFirstNode.shortValue() == 1) { if ((firstBpmNodeSet != null) && (firstBpmNodeSet.getFormType() != null) && (firstBpmNodeSet.getFormType().shortValue() != -1)) { return firstBpmNodeSet; } if ((bpmNodeSetGlobal != null) && (bpmNodeSetGlobal.getFormType() != null) && (bpmNodeSetGlobal.getFormType().shortValue() != -1)) { return bpmNodeSetGlobal; } } else if ((bpmNodeSetGlobal != null) && (bpmNodeSetGlobal.getFormType() != null) && (bpmNodeSetGlobal.getFormType().shortValue() != -1)) { return bpmNodeSetGlobal; } } else { return bpmNodeSetStart; } return null; } public boolean getCanDirectStart(Long defId) { BpmDefinition bpmDefinition = (BpmDefinition)this.bpmDefinitionDao.getById(defId); Integer directStart = bpmDefinition.getDirectstart(); if (directStart == null) { return true; } return directStart.intValue() == 1; } private boolean hasForm(BpmNodeSet nodeSet) { if ((nodeSet == null) || (nodeSet.getFormType().shortValue() == -1)) return false; return true; } public BpmFormRun getByInstanceAndNode(String actInstanceId, String actNodeId) { BpmFormRun bpmFormRun = dao.getByInstanceAndNode(actInstanceId, actNodeId); if ((bpmFormRun != null) && (bpmFormRun.getFormType() != null) && (bpmFormRun.getFormType().shortValue() != -1)) { return bpmFormRun; } bpmFormRun = dao.getGlobalForm(actInstanceId); if ((bpmFormRun != null) && (bpmFormRun.getFormType() != null) && (bpmFormRun.getFormType().shortValue() != -1)) { return bpmFormRun; } return null; } public BpmFormRun getByInstanceAndNodeId(String actInstanceId, String actNodeId) { BpmFormRun bpmFormRun = dao.getByInstanceAndNode(actInstanceId, actNodeId); return bpmFormRun; } public List<BpmFormRun> getByInstanceId(String actInstanceId) { return dao.getByInstanceId(actInstanceId); } public BpmNodeSet getStartBpmNodeSet(Long defId, String actDefId) throws Exception { FlowNode flowNode = NodeCache.getFirstNodeId(actDefId); String nodeId = ""; if (flowNode != null) { nodeId = flowNode.getNodeId(); } BpmNodeSet firstNodeSet = this.bpmNodeSetDao.getByActDefIdNodeId(actDefId, nodeId); if ((firstNodeSet != null) && (-1 != firstNodeSet.getFormKey())) { return firstNodeSet; } BpmNodeSet globalNodeSet = this.bpmNodeSetDao.getByStartGlobal(defId); return globalNodeSet; } }
[ "wangzhiyun999@163.com" ]
wangzhiyun999@163.com
9c2e754da681fb7095e8a1e3c85f958d5ac05b4e
b3277a59330ac8462efc7cf20ea80153b65ff81d
/src/template/CaffeineBeverageWithHook.java
d6280c552f907ee94d9de1e7c0ce744d6e65436a
[]
no_license
tudorion/Design-Patterns
57309b3c9323e5abbc195a2594a441c5e7a2062d
5bd570cc139ce1c323aa736d352103e7ae08bcc6
refs/heads/master
2021-01-02T09:08:33.594000
2014-10-06T12:13:56
2014-10-06T12:13:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package template; import java.util.Scanner; /** * Created by Tudor on 06-10-14. */ public abstract class CaffeineBeverageWithHook { final void prepareRecipe() { boilWater(); brew(); pourInCup(); if (customerWantsCondiments()) addCondiments(); } abstract void brew(); abstract void addCondiments(); public void boilWater() { System.out.println("Boiling water"); } public void pourInCup(){ System.out.println("Pouring in cup"); } boolean customerWantsCondiments(){ return true; } public String getUserInput() { String answer; Scanner sc = new Scanner(System.in); answer = sc.nextLine(); if (answer==null) { return "no"; } return answer; } }
[ "tudor.m.ion@gmail.com" ]
tudor.m.ion@gmail.com
42c5667c377c6e6ec2aefd0274b3763ba1844554
e3869fc775e17403ef7b666a7facaf37be86852e
/src/main/java/com/arpnetworking/metrics/common/sources/ActorSource.java
fe88ced122484d85f1357bedb3c4c9161bdc2128
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
ArpNetworking/metrics-aggregator-daemon
5ce06f33a5e326c64dda4e66b2b8d04e6502f8ba
87aa326d87c4b9d8da477bf0fb85ff0f873c7571
refs/heads/master
2023-09-05T13:42:50.142394
2023-08-28T18:25:16
2023-08-28T18:25:16
50,552,081
7
13
Apache-2.0
2023-09-04T14:16:42
2016-01-28T03:30:11
Java
UTF-8
Java
false
false
6,006
java
/* * Copyright 2016 Smartsheet * * 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.arpnetworking.metrics.common.sources; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.actor.PoisonPill; import akka.actor.Props; import akka.pattern.Patterns; import akka.routing.RoundRobinPool; import com.arpnetworking.steno.Logger; import com.arpnetworking.steno.LoggerFactory; import com.fasterxml.jackson.annotation.JacksonInject; import net.sf.oval.constraint.Min; import net.sf.oval.constraint.NotEmpty; import net.sf.oval.constraint.NotNull; import java.time.Duration; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.Function; /** * Serves as a base class for actor-based sources. * * @author Brandon Arp (brandon dot arp at smartsheet dot com) */ public abstract class ActorSource extends BaseSource { @Override public void start() { if (_actor == null) { _actor = _actorSystem.actorOf(new RoundRobinPool(_poolSize).props(createProps()), _actorName); } } @Override public void stop() { if (_actor != null) { try { Patterns.gracefulStop( _actor, SHUTDOWN_TIMEOUT, PoisonPill.getInstance()).toCompletableFuture().get( SHUTDOWN_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); } catch (final InterruptedException e) { LOGGER.warn() .setMessage("Interrupted stopping actor source") .addData("name", getName()) .addData("actor", _actor) .addData("actorName", _actorName) .log(); } catch (final TimeoutException | ExecutionException e) { LOGGER.error() .setMessage("Actor source stop timed out or failed") .addData("name", getName()) .addData("actor", _actor) .addData("actorName", _actorName) .addData("timeout", SHUTDOWN_TIMEOUT) .setThrowable(e) .log(); } _actor = null; } } /** * Return the {@link ActorSystem} used by this source. * * @return The {@link ActorSystem} used by this source. */ protected ActorSystem getActorSystem() { return _actorSystem; } /** * Return an {@link ActorRef} to this source's Akka actor. * * @return An {@link ActorRef} to this source's Akka actor. */ protected ActorRef getActor() { return _actor; } /** * Create a props for the actor to be created at the provided path. * * @return A props to create the actor with. */ protected abstract Props createProps(); /** * Protected constructor. * * @param builder Instance of {@link Builder}. */ protected ActorSource(final Builder<?, ? extends ActorSource> builder) { super(builder); _actorName = builder._actorName; _actorSystem = builder._actorSystem; _poolSize = builder._poolSize; } private ActorRef _actor = null; private final String _actorName; private final ActorSystem _actorSystem; private final int _poolSize; private static final Duration SHUTDOWN_TIMEOUT = Duration.ofSeconds(1); private static final Logger LOGGER = LoggerFactory.getLogger(ActorSource.class); /** * ActorSource {@link BaseSource.Builder} implementation. * * @param <B> type of the builder * @param <S> type of the object to be built * @author Brandon Arp (brandon dot arp at inscopemetrics dot io) */ public abstract static class Builder<B extends Builder<B, S>, S extends Source> extends BaseSource.Builder<B, S> { /** * Protected constructor for subclasses. * * @param targetConstructor The constructor for the concrete type to be created by this builder. */ protected Builder(final Function<B, S> targetConstructor) { super(targetConstructor); } /** * Sets the actor path. Cannot be null or empty. * * @param value The name. * @return This instance of {@link Builder} */ public final B setActorName(final String value) { _actorName = value; return self(); } /** * Sets the actor system to launch the actor in. * * @param value The actor system. * @return This instance of {@link Builder} */ public final B setActorSystem(final ActorSystem value) { _actorSystem = value; return self(); } /** * Sets the actor pool size. * @param value Number of actors in the pool * @return This instance of {@link Builder} */ public final B setPoolSize(final Integer value) { _poolSize = value; return self(); } @NotNull @NotEmpty private String _actorName; @NotNull @Min(1) private Integer _poolSize = 1; @JacksonInject private ActorSystem _actorSystem; } }
[ "noreply@github.com" ]
ArpNetworking.noreply@github.com
f36ff6390f1d3ff39af4e27f302d36628721ac8e
f88a78ba05b4fb4e853c984b07ce225249ea5089
/src/finder/cloud/AddBitmapRuleDlg.java
164a8fc16cfb48c095e81a9f23374ba02a00845b
[]
no_license
Maccoray/MatFinder
17a843ace87a538445a71dae6afa75b0be47349a
66e246fd2f6e89fe423525cd4d47525fc47efab7
refs/heads/master
2022-02-12T22:11:13.510265
2018-02-06T03:08:55
2018-02-06T03:08:55
116,383,321
4
3
null
null
null
null
UTF-8
Java
false
false
3,921
java
package finder.cloud; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import finder.util.CloudConfigCenter; public class AddBitmapRuleDlg extends Dialog { Text mRL,mDL,mWL,mHL; boolean mbGC = false; private CloudConfigCenter.AnalyzerConfig.BitmapRule mbtRule = null; protected AddBitmapRuleDlg(Shell parentShell) { super(parentShell); // TODO Auto-generated constructor stub } @Override protected Control createDialogArea(Composite parent) { // TODO Auto-generated method stub parent.getShell().setText("Add an Bitmap rule");; GridLayout rootLayout = new GridLayout(); rootLayout.numColumns = 2; parent.setLayout(rootLayout); Label ruleNameLab = new Label(parent,SWT.LEFT); ruleNameLab.setText("RuleName:"); mRL = new Text(parent, SWT.LEFT|SWT.SINGLE); Label devNameLab = new Label(parent,SWT.LEFT); devNameLab.setText("DeviceName:"); mDL = new Text(parent, SWT.LEFT|SWT.SINGLE); Label widthLab = new Label(parent,SWT.LEFT); widthLab.setText("BitmapWidth<"); mWL = new Text(parent, SWT.LEFT|SWT.SINGLE); mWL.setText("0000"); Label heightLab = new Label(parent,SWT.LEFT); heightLab.setText("BitmapHeight<"); mHL = new Text(parent, SWT.LEFT|SWT.SINGLE); mHL.setText("0000"); Label needGCPathLab = new Label(parent,SWT.LEFT); needGCPathLab.setText("needGCPath:"); Combo rGCCombo = new Combo(parent,SWT.READ_ONLY); rGCCombo.setItems(new String[] {"False","True"}); rGCCombo.setText(rGCCombo.getItem(0)); rGCCombo.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { Combo selComboItem = (Combo)event.widget; String selTextString = selComboItem.getText(); mbGC = Boolean.valueOf(selTextString); } }); Button button = new Button(parent, SWT.PUSH); button.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); button.setText("OK"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mbtRule = new CloudConfigCenter.AnalyzerConfig.BitmapRule(); mbtRule.strRuleName = mRL.getText(); mbtRule.strDevName = mDL.getText(); mbtRule.iMaxWidth = Integer.valueOf(mWL.getText()); mbtRule.iMaxHeight = Integer.valueOf(mHL.getText()); mbtRule.bShowGc = mbGC; close(); } }); return parent; } @Override protected Control createButtonBar(Composite parent) { // TODO Auto-generated method stub return null; } @Override protected Point getInitialSize() { // TODO Auto-generated method stub return new Point(180, 200); } @Override protected int getShellStyle() { // TODO Auto-generated method stub return SWT.CLOSE|SWT.APPLICATION_MODAL; } public CloudConfigCenter.AnalyzerConfig.BitmapRule getBitmapRule() { return mbtRule; } }
[ "243557307@qq.com" ]
243557307@qq.com
62df2389626bf0bab7ed6031471d120b596eb35a
3053e40ed1671e20e9c39c62692cbf3604b2039a
/StringMethodFour.java
740a39585d2ba3bb237d836609ba2c8dcfec639d
[]
no_license
Shahajahan15/Basic-Java
53be696311b177a4af350d7e848121e5157ec192
bf48e60b9624cee576c47b9456bf04a1f6bdefb4
refs/heads/master
2020-08-03T02:41:36.255694
2019-09-29T05:01:23
2019-09-29T05:01:23
211,600,252
0
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
package basicjava; public class StringMethodFour { public static void main(String[] args) { String s1 = "This is my country."; System.out.println(s1); String s2 = s1.replace("i", "j"); // replace the char System.out.println(s2); String[] s3 = s1.split(" "); // removve the spase for (String x : s3) { System.out.print(x ); } System.out.println(""); StringBuffer sb = new StringBuffer("This is "); // append sb.append("my"); sb.append(" country."); System.out.println(sb); sb.setLength(12); // Length set System.out.println("Set Length : "+sb); sb.reverse(); // reverse System.out.println(sb); StringBuilder sd = new StringBuilder("This is my country."); sd.delete(1, 7); System.out.println(sd); // delete System.out.println(""); } }
[ "mdrezaali1@gmail.com" ]
mdrezaali1@gmail.com
084cbb3f65b7121a1cddf2a1340cc9ae8f50a592
2ff780205e6f8618d2e13fb4d5952185ef0e2826
/app/src/main/java/com/coursera/symptommanagement/adapters/PainListAdapter.java
d1ed2e665d9d72510d14693f655091240ee435c1
[]
no_license
jelemay/SymptomManagementClient
7bf552c9fa09c16ee4db80334b6a9c7f0992c58b
06947000a9010f5b8fcb4678133785a2da30143b
refs/heads/master
2020-05-27T08:43:26.984979
2014-12-01T00:30:56
2014-12-01T00:30:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,586
java
package com.coursera.symptommanagement.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; import com.coursera.symptommanagement.R; import com.coursera.symptommanagement.models.Pain; import java.util.ArrayList; /** * Created by victorialemay on 11/23/14. */ public class PainListAdapter extends ArrayAdapter<Pain> { private LayoutInflater inflater; public PainListAdapter(Context context, int txtViewResourceId, ArrayList<Pain> pains) { super(context, txtViewResourceId, pains); inflater = LayoutInflater.from(context); } @Override public View getDropDownView(int position, View contentView, ViewGroup parent) { return getPainView(position, contentView, parent); } @Override public View getView(int position, View contentView, ViewGroup parent) { return getPainView(position, contentView, parent); } public View getPainView(int position, View convertView, ViewGroup parent) { Pain pain = getItem(position); View painSpinner = inflater.inflate(R.layout.item_pain, parent, false); TextView tvName = (TextView) painSpinner.findViewById(R.id.painListName); tvName.setText(pain.getDescription()); TextView tvId = (TextView) painSpinner.findViewById(R.id.painListId); tvId.setText(String.valueOf(pain.getId())); return painSpinner; } }
[ "startnowgo@gmail.com" ]
startnowgo@gmail.com
48ff71cf9bdddb76ad4eeacf1732cf72c13f9f86
f80d9d80414f8fab7eeb0299317a7b5ef8d3efcf
/Android App/LED-master/app/src/main/java/com/led_on_off/led/DeviceList.java
c1c10b7c45a91743c101e590f64e5bdfa4f0aff5
[]
no_license
miwtoo/ArduinoServo
655694a0d8a8f848ab7b9859b9efc063aad1b014
864e827764bd457c52a2ea395ad69fe7e6ec41e4
refs/heads/master
2020-04-13T20:05:32.940794
2019-01-07T14:42:54
2019-01-07T14:42:54
163,421,215
1
0
null
null
null
null
UTF-8
Java
false
false
4,266
java
package com.led_on_off.led; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Set; public class DeviceList extends ActionBarActivity { //widgets Button btnPaired; ListView devicelist; //Bluetooth private BluetoothAdapter myBluetooth = null; private Set<BluetoothDevice> pairedDevices; public static String EXTRA_ADDRESS = "device_address"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_device_list); //Calling widgets btnPaired = (Button)findViewById(R.id.button); devicelist = (ListView)findViewById(R.id.listView); //if the device has bluetooth myBluetooth = BluetoothAdapter.getDefaultAdapter(); if(myBluetooth == null) { //Show a mensag. that the device has no bluetooth adapter Toast.makeText(getApplicationContext(), "Bluetooth Device Not Available", Toast.LENGTH_LONG).show(); //finish apk finish(); } else if(!myBluetooth.isEnabled()) { //Ask to the user turn the bluetooth on Intent turnBTon = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(turnBTon,1); } btnPaired.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pairedDevicesList(); } }); } private void pairedDevicesList() { pairedDevices = myBluetooth.getBondedDevices(); ArrayList list = new ArrayList(); if (pairedDevices.size()>0) { for(BluetoothDevice bt : pairedDevices) { list.add(bt.getName() + "\n" + bt.getAddress()); //Get the device's name and the address } } else { Toast.makeText(getApplicationContext(), "No Paired Bluetooth Devices Found.", Toast.LENGTH_LONG).show(); } final ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, list); devicelist.setAdapter(adapter); devicelist.setOnItemClickListener(myListClickListener); //Method called when the device from the list is clicked } private AdapterView.OnItemClickListener myListClickListener = new AdapterView.OnItemClickListener() { public void onItemClick (AdapterView<?> av, View v, int arg2, long arg3) { // Get the device MAC address, the last 17 chars in the View String info = ((TextView) v).getText().toString(); String address = info.substring(info.length() - 17); // Make an intent to start next activity. Intent i = new Intent(DeviceList.this, ledControl.class); //Change the activity. i.putExtra(EXTRA_ADDRESS, address); //this will be received at ledControl (class) Activity startActivity(i); } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_device_list, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "miwyugioh@gmail.com" ]
miwyugioh@gmail.com
32272390a66a3fde0508f9f2bbe45e1509277f11
379392993a89ede4a49b38a1f0e57dacbe17ec7d
/com/google/android/gms/internal/zzdo.java
8683e81598ad469a7708825c74ea9ba3a45dd37b
[]
no_license
mdali602/DTC
d5c6463d4cf67877dbba43e7d50a112410dccda3
5a91a20a0fe92d010d5ee7084470fdf8af5dafb5
refs/heads/master
2021-05-12T02:06:40.493406
2018-01-15T18:06:00
2018-01-15T18:06:00
117,578,063
0
1
null
null
null
null
UTF-8
Java
false
false
7,957
java
package com.google.android.gms.internal; import android.content.Context; import android.os.Binder; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.google.android.gms.ads.internal.zzw; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.internal.zzf; import com.google.android.gms.common.internal.zzf.zzc; import com.google.android.gms.internal.zzdd.zzb; @zzme public class zzdo { @Nullable private Context mContext; private final Object zzrJ = new Object(); private final Runnable zzyG = new C05371(this); @Nullable private zzdr zzyH; @Nullable private zzdv zzyI; class C05371 implements Runnable { final /* synthetic */ zzdo zzyJ; C05371(zzdo com_google_android_gms_internal_zzdo) { this.zzyJ = com_google_android_gms_internal_zzdo; } public void run() { this.zzyJ.disconnect(); } } class C10242 implements zzb { final /* synthetic */ zzdo zzyJ; C10242(zzdo com_google_android_gms_internal_zzdo) { this.zzyJ = com_google_android_gms_internal_zzdo; } public void zzk(boolean z) { if (z) { this.zzyJ.connect(); } else { this.zzyJ.disconnect(); } } } class C10253 implements zzf.zzb { final /* synthetic */ zzdo zzyJ; C10253(zzdo com_google_android_gms_internal_zzdo) { this.zzyJ = com_google_android_gms_internal_zzdo; } public void onConnected(@Nullable Bundle bundle) { synchronized (this.zzyJ.zzrJ) { try { this.zzyJ.zzyI = this.zzyJ.zzyH.zzeB(); } catch (Throwable e) { zzqf.zzb("Unable to obtain a cache service instance.", e); this.zzyJ.disconnect(); } this.zzyJ.zzrJ.notifyAll(); } } public void onConnectionSuspended(int i) { synchronized (this.zzyJ.zzrJ) { this.zzyJ.zzyI = null; this.zzyJ.zzrJ.notifyAll(); } } } class C10264 implements zzc { final /* synthetic */ zzdo zzyJ; C10264(zzdo com_google_android_gms_internal_zzdo) { this.zzyJ = com_google_android_gms_internal_zzdo; } public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { synchronized (this.zzyJ.zzrJ) { this.zzyJ.zzyI = null; if (this.zzyJ.zzyH != null) { this.zzyJ.zzyH = null; zzw.zzdc().zzlc(); } this.zzyJ.zzrJ.notifyAll(); } } } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void connect() { /* r3 = this; r1 = r3.zzrJ; monitor-enter(r1); r0 = r3.mContext; Catch:{ all -> 0x0024 } if (r0 == 0) goto L_0x000b; L_0x0007: r0 = r3.zzyH; Catch:{ all -> 0x0024 } if (r0 == 0) goto L_0x000d; L_0x000b: monitor-exit(r1); Catch:{ all -> 0x0024 } L_0x000c: return; L_0x000d: r0 = new com.google.android.gms.internal.zzdo$3; Catch:{ all -> 0x0024 } r0.<init>(r3); Catch:{ all -> 0x0024 } r2 = new com.google.android.gms.internal.zzdo$4; Catch:{ all -> 0x0024 } r2.<init>(r3); Catch:{ all -> 0x0024 } r0 = r3.zza(r0, r2); Catch:{ all -> 0x0024 } r3.zzyH = r0; Catch:{ all -> 0x0024 } r0 = r3.zzyH; Catch:{ all -> 0x0024 } r0.zzxz(); Catch:{ all -> 0x0024 } monitor-exit(r1); Catch:{ all -> 0x0024 } goto L_0x000c; L_0x0024: r0 = move-exception; monitor-exit(r1); Catch:{ all -> 0x0024 } throw r0; */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzdo.connect():void"); } private void disconnect() { synchronized (this.zzrJ) { if (this.zzyH == null) { return; } if (this.zzyH.isConnected() || this.zzyH.isConnecting()) { this.zzyH.disconnect(); } this.zzyH = null; this.zzyI = null; Binder.flushPendingCommands(); zzw.zzdc().zzlc(); } } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void initialize(android.content.Context r3) { /* r2 = this; if (r3 != 0) goto L_0x0003; L_0x0002: return; L_0x0003: r1 = r2.zzrJ; monitor-enter(r1); r0 = r2.mContext; Catch:{ all -> 0x000c } if (r0 == 0) goto L_0x000f; L_0x000a: monitor-exit(r1); Catch:{ all -> 0x000c } goto L_0x0002; L_0x000c: r0 = move-exception; monitor-exit(r1); Catch:{ all -> 0x000c } throw r0; L_0x000f: r0 = r3.getApplicationContext(); Catch:{ all -> 0x000c } r2.mContext = r0; Catch:{ all -> 0x000c } r0 = com.google.android.gms.internal.zzgd.zzFf; Catch:{ all -> 0x000c } r0 = r0.get(); Catch:{ all -> 0x000c } r0 = (java.lang.Boolean) r0; Catch:{ all -> 0x000c } r0 = r0.booleanValue(); Catch:{ all -> 0x000c } if (r0 == 0) goto L_0x0028; L_0x0023: r2.connect(); Catch:{ all -> 0x000c } L_0x0026: monitor-exit(r1); Catch:{ all -> 0x000c } goto L_0x0002; L_0x0028: r0 = com.google.android.gms.internal.zzgd.zzFe; Catch:{ all -> 0x000c } r0 = r0.get(); Catch:{ all -> 0x000c } r0 = (java.lang.Boolean) r0; Catch:{ all -> 0x000c } r0 = r0.booleanValue(); Catch:{ all -> 0x000c } if (r0 == 0) goto L_0x0026; L_0x0036: r0 = new com.google.android.gms.internal.zzdo$2; Catch:{ all -> 0x000c } r0.<init>(r2); Catch:{ all -> 0x000c } r2.zza(r0); Catch:{ all -> 0x000c } goto L_0x0026; */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzdo.initialize(android.content.Context):void"); } public zzdp zza(zzds com_google_android_gms_internal_zzds) { zzdp com_google_android_gms_internal_zzdp; synchronized (this.zzrJ) { if (this.zzyI == null) { com_google_android_gms_internal_zzdp = new zzdp(); } else { try { com_google_android_gms_internal_zzdp = this.zzyI.zza(com_google_android_gms_internal_zzds); } catch (Throwable e) { zzqf.zzb("Unable to call into cache service.", e); com_google_android_gms_internal_zzdp = new zzdp(); } } } return com_google_android_gms_internal_zzdp; } protected zzdr zza(zzf.zzb com_google_android_gms_common_internal_zzf_zzb, zzc com_google_android_gms_common_internal_zzf_zzc) { return new zzdr(this.mContext, zzw.zzdc().zzlb(), com_google_android_gms_common_internal_zzf_zzb, com_google_android_gms_common_internal_zzf_zzc); } protected void zza(zzb com_google_android_gms_internal_zzdd_zzb) { zzw.zzcP().zza(com_google_android_gms_internal_zzdd_zzb); } public void zzev() { if (((Boolean) zzgd.zzFg.get()).booleanValue()) { synchronized (this.zzrJ) { connect(); zzw.zzcM(); zzpo.zzXC.removeCallbacks(this.zzyG); zzw.zzcM(); zzpo.zzXC.postDelayed(this.zzyG, ((Long) zzgd.zzFh.get()).longValue()); } } } }
[ "mohd.ali@xotiv.com" ]
mohd.ali@xotiv.com
7d1350e1faef90cfaa8190456796c88980318236
79e56b0398c665208426e229f78c183217c70931
/app/src/androidTest/java/ctas/demo_business/ApplicationTest.java
70bc0229e5127d541704d854fcd994cca8a37677
[]
no_license
CTAS00/Demo_business3
87cd4f568c93706b3399724f8209a26aa5b50bb1
8ac01218f020e18737fee99f8984198e6120bdb1
refs/heads/master
2021-01-15T23:59:38.724901
2017-08-13T14:32:38
2017-08-13T14:32:38
99,947,535
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package ctas.demo_business; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "CT@qq.com" ]
CT@qq.com
71f4774ce45927257454b5f049b89bd96545f895
5a193af3a5b37d6b08908a03c76e11d59ecd3d51
/definitive-guide-ch07-hibernatePagedProcessing/src/main/java/com/apress/springbatch/hibernate/paged/cursor/HibernatePagedProcessingApplication.java
3e40c3009ba1876157fb846e9b39c1465ba255ee
[]
no_license
DouglasGo8/definitive-guide-spring-batch-
72f33adb4c387a275f3631f0bb59a7e2b3a36383
5294e5ca4ada9960220a20c6067ca6517c253413
refs/heads/master
2023-06-11T05:29:27.690611
2023-05-27T02:52:24
2023-05-27T02:52:24
201,140,370
1
1
null
2020-10-13T20:42:04
2019-08-07T23:07:00
TSQL
UTF-8
Java
false
false
2,835
java
package com.apress.springbatch.hibernate.paged.cursor; import com.apress.springbatch.hibernate.paged.cursor.domain.Customer; import org.hibernate.SessionFactory; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.database.HibernatePagingItemReader; import org.springframework.batch.item.database.builder.HibernatePagingItemReaderBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import javax.persistence.EntityManagerFactory; import java.util.Collections; import static java.lang.System.out; /** * @author dbatista */ @EnableBatchProcessing @SpringBootApplication public class HibernatePagedProcessingApplication { @Autowired private JobBuilderFactory jobBuilderFactory; @Autowired private StepBuilderFactory stepBuilderFactory; @Bean @StepScope public HibernatePagingItemReader<Customer> hibernatePagedItemReader(EntityManagerFactory entityManagerFactory, @Value("#{jobParameters['city']}") String city) { return new HibernatePagingItemReaderBuilder<Customer>() .name("customerItemReader") .sessionFactory(entityManagerFactory.unwrap(SessionFactory.class)) .queryString("from Customer where city = :city") .parameterValues(Collections.singletonMap("city", city)) .pageSize(10) .build(); } @Bean public ItemWriter<Customer> itemWriter() { return (items) -> items.parallelStream().forEach(out::println); } @Bean public Step copyFileStep() { return this.stepBuilderFactory.get("copyFileStep") .<Customer, Customer>chunk(10) .reader(this.hibernatePagedItemReader(null, null)) .writer(this.itemWriter()) .build(); } @Bean public Job job() { return this.jobBuilderFactory.get("job") .start(this.copyFileStep()) .build(); } public static void main(String[] args) { SpringApplication.run(HibernatePagedProcessingApplication.class, args); } }
[ "abraham.dias.douglas@gmail.com" ]
abraham.dias.douglas@gmail.com
a3ef49d130f435ffebf3c0bce5aa0403f3e9658c
151ccc7097ab042116f4e6bea37b77925e893781
/src/main/java/codeforces/c810/APerfectPermutation.java
1f82c998448321863a1ccb95846d5f243ab22244
[ "MIT" ]
permissive
humwawe/online-judge
9ff944041288da836857a9e3ce59067b7af63705
e6091b82031ad1ffa2abe6ceea09b7bdc435d73f
refs/heads/master
2023-08-31T05:17:30.968516
2023-08-27T09:01:16
2023-08-27T09:01:16
207,341,970
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package codeforces.c810; import fast.io.InputReader; import fast.io.OutputWriter; public class APerfectPermutation { public void solve(int testNumber, InputReader in, OutputWriter out) { int n = in.nextInt(); for (int i = 1; i <= n - 1; i++) { out.print(i + 1, ""); } out.println(1); } }
[ "hum@abc" ]
hum@abc
2f3b763b7ca62a554f4d5a0c5186f96a16781ab2
f2f318474a0cc57c63a146f0e3f68145c9c45904
/Study_2021/Study_Old/GUIStudy/src/main/java/top/lan_mao/listener/TestWindowListener.java
f5d6a0e85ecf89aacd6fdbe8b1963b2da569f7dd
[ "MulanPSL-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-mulanpsl-2.0-en" ]
permissive
lan-mao/ComputerWorld
dcde76d1b6dbff4484d20bb48c7931bda37d6837
1898e249914958b036274205fd1960be1c7f63e5
refs/heads/master
2023-04-26T17:06:31.496753
2023-04-17T11:14:22
2023-04-17T11:14:22
231,084,646
2
0
NOASSERTION
2023-03-05T19:11:11
2019-12-31T12:22:21
Java
UTF-8
Java
false
false
2,570
java
package top.lanmao.listener; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; /** * Create Date 2020/12/07 15:53:34 <br> * Created by lan-mao.top <br> * 使用窗口监听 <br> */ public class TestWindowListener extends Frame { public TestWindowListener() { setSize(500, 500); setResizable(false); setVisible(true); } public static void main(String[] args) { TestWindowListener testWindowListener = new TestWindowListener(); testWindowListener.addWindowListener(new MyWindowListener()); testWindowListener.addWindowFocusListener(new MyWindowListener()); testWindowListener.addWindowStateListener(new MyWindowListener()); } } class MyWindowListener extends WindowAdapter { @Override public void windowOpened(WindowEvent e) { //窗口打开 System.out.println("windowOpened"); } @Override public void windowClosing(WindowEvent e) { //窗口关闭 System.out.println("windowClosing"); //如果将窗口调用dispose()方法,会关闭窗口,但是不会关闭进程 e.getWindow().dispose(); //如果调用exit()方法,由于退出了虚拟机,windowClosed不会被调用 //System.exit(0); } @Override public void windowClosed(WindowEvent e) { //窗口关闭状态下调用 //可以在windowClosing()方法中使用dispose(),会自动调用windowClosed() System.out.println("windowClosed"); } @Override public void windowIconified(WindowEvent e) { //窗口最小化 System.out.println("windowIconified"); } @Override public void windowDeiconified(WindowEvent e) { //窗口不活动 System.out.println("windowDeiconified"); } @Override public void windowActivated(WindowEvent e) { //窗口活动 System.out.println("windowActivated"); } @Override public void windowDeactivated(WindowEvent e) { //窗口停用 System.out.println("windowDeactivated"); } @Override public void windowStateChanged(WindowEvent e) { //窗口状态改变 System.out.println("windowStateChanged"); } @Override public void windowGainedFocus(WindowEvent e) { //窗口获得焦点 System.out.println("windowGainedFocus"); } @Override public void windowLostFocus(WindowEvent e) { //窗口失去焦点 System.out.println("windowLostFocus"); } }
[ "maxin9842@163.com" ]
maxin9842@163.com
6ed6cd8e92963122e18cb99e45f9f3d43cbae86d
aa88b6dca1b53f2cb846f7bdee8aee17041216cd
/src/main/java/sx/payload/DSMatrix.java
a922a78981538a0bc3507956f33ed186920640c5
[]
no_license
ykrkn/spring-boot-vertx
780bdf8f9bb788d95a0b3178bd6e8f117f9b3d64
965d95b242d14a082680139cd2b063701245e267
refs/heads/master
2021-05-30T15:04:37.800221
2015-11-10T23:14:49
2015-11-10T23:14:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
85
java
package sx.payload; /** * Created by sx on 07.11.15. */ public class DSMatrix { }
[ "yury.krikun@gmail.com" ]
yury.krikun@gmail.com
0e2fcf470811ed6b118c2f17234fbe443d30af3f
f55a641e40435076d34467390cd0f38c29f9a355
/observer/src/CurrentConditionsDisplay.java
8f063c26a9e3c650aacdfd7dca0019f82024f109
[]
no_license
ccKris/design-pattern-learn
5f2f271df8bd61fa95456642a4ad4c585d861961
de46361cd3fcd7ac980d6abc4df675d5fd4f13eb
refs/heads/master
2021-01-01T03:48:10.414639
2016-05-14T02:31:32
2016-05-14T02:31:32
58,511,856
0
0
null
2016-05-14T02:31:32
2016-05-11T03:36:10
Java
UTF-8
Java
false
false
863
java
/** * Created by Administrator on 2016/5/11. */ // 当前气象信息布告板,属于一个观察者 public class CurrentConditionsDisplay implements Observer, DisplayElement { private float temperature; private float humidity; private float pressure; private Subject weatherData; public CurrentConditionsDisplay(Subject weatherData) { this.weatherData = weatherData; weatherData.registerObserver(this); } public void update(float temperature, float humidity, float pressure) { this.temperature = temperature; this.humidity = humidity; this.pressure = pressure; display(); } public void display() { System.out.println("Current conditions: " + temperature + "F degrees and " + humidity + "% humidity and " + pressure + " pressure"); } }
[ "cqdx02@126.com" ]
cqdx02@126.com
bf2702212d29bab79046ba87c46bfcb27c71e2c7
d1332f88af10be3346e00c0dd51e4919f02ddb70
/app/src/main/java/com/example/maoyy/sunshine/DetailActivityFragment.java
1fe292db17b913c408e9ff7797be2339ee143dc6
[]
no_license
yuanyuan5430776/sunshine
5e547a478b6ade863b48122e4ce964f9233bcb3f
dcfc1903d1679e55cc7ec17ae9d7b4b0c8fe681a
refs/heads/master
2020-07-20T15:17:19.487734
2015-07-17T05:11:33
2015-07-17T05:11:33
38,363,357
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package com.example.maoyy.sunshine; import android.content.Intent; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * A placeholder fragment containing a simple view. */ public class DetailActivityFragment extends Fragment { public DetailActivityFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String forecast = (String) getActivity().getIntent().getExtras().get(Intent.EXTRA_TEXT); View view = inflater.inflate(R.layout.fragment_detail, container, false); TextView textView = (TextView) view.findViewById(R.id.fragment_text_view); textView.setText(forecast); return view; } }
[ "maoyy@MAO-PC.cn.oracle.com" ]
maoyy@MAO-PC.cn.oracle.com
c2b3d0b0b39704856608fd42bbe20226910785da
9d0fd959aa594894c659b77afde8aa15e3aac779
/src/main/java/io/github/getvagabond/jhsample/domain/AbstractAuditingEntity.java
174a939271cd57254991ab9e12357b065ace776e
[ "Apache-2.0" ]
permissive
getvagabond/jhipster-sample
8fee5b05d43ff4a9475cff1d33d9dffe95dd4d5c
c9e1e28ef7e6e1d9f0611229388c05eea036a2e9
refs/heads/master
2016-09-13T05:18:16.636150
2016-04-12T23:11:17
2016-04-12T23:11:17
56,102,384
0
0
null
null
null
null
UTF-8
Java
false
false
2,326
java
package io.github.getvagabond.jhsample.domain; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.envers.Audited; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.ZonedDateTime; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import javax.validation.constraints.NotNull; /** * Base abstract class for entities which will hold definitions for created, last modified by and created, * last modified by date. */ @MappedSuperclass @Audited @EntityListeners(AuditingEntityListener.class) public abstract class AbstractAuditingEntity implements Serializable { private static final long serialVersionUID = 1L; @CreatedBy @Column(name = "created_by", nullable = false, length = 50, updatable = false) @JsonIgnore private String createdBy; @CreatedDate @Column(name = "created_date", nullable = false) @JsonIgnore private ZonedDateTime createdDate = ZonedDateTime.now(); @LastModifiedBy @Column(name = "last_modified_by", length = 50) @JsonIgnore private String lastModifiedBy; @LastModifiedDate @Column(name = "last_modified_date") @JsonIgnore private ZonedDateTime lastModifiedDate = ZonedDateTime.now(); public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public ZonedDateTime getCreatedDate() { return createdDate; } public void setCreatedDate(ZonedDateTime createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public ZonedDateTime getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(ZonedDateTime lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } }
[ "hakandilek@gmail.com" ]
hakandilek@gmail.com
6cafce207f188f2290f19497aacbb00c294cbc56
087f83a77f4d4cd5da4e965faddda0b6095f6a71
/boot-demo/src/main/java/com/example/demo/controller/UserController.java
9643d5f0818822b3668241f0b802e91e10f0320d
[]
no_license
java-liu/alibabaStudy
955b55c144979d915c6ab6ad8da696129ac0310f
477409a71cd53f4e2c5af2853a45a96e3591460d
refs/heads/master
2022-12-14T11:54:03.375797
2021-06-17T09:59:53
2021-06-17T09:59:53
189,184,800
1
0
null
2022-12-10T05:38:48
2019-05-29T08:36:57
Java
UTF-8
Java
false
false
1,212
java
package com.example.demo.controller; import com.example.demo.entity.User; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Map; /** * @ClassName UserController * @Description * @Author Lenovo * @Date 2019/7/24 16:21 * @Verson 1.0 **/ @Controller @RequestMapping("/user") public class UserController { @RequestMapping("/ajaxDemo") public String index(Map<String,Object> result){ result.put("name","Liuys"); return "ajax_demo"; } @RequestMapping("/getAjax") public String getAjax(){ return "/ajax_user"; } @RequestMapping("/getAjaxPost") public String getAjaxPost(){ return "/ajax_user"; } /*** * ajax json demo * @return */ @RequestMapping("/getUser") @ResponseBody public User getUser(){ User user = new User(); user.setId(1); user.setName("Liuys"); return user; } @RequestMapping("/md5Test") public String md5Test(Map<String,Object> result){ result.put("name","Liuys"); return "Md5Test"; } }
[ "shan_svip@163.com" ]
shan_svip@163.com
0c553994639f5b71f2eda66efdbf1ee90e4fac8b
312642cbe0deb4cd44fb8fce86035936c9c562f5
/src/test/java/GeneratorMain.java
34c723297702a82cb1180f92a374cf077ad6b77b
[]
no_license
MIMIEYES/configDock
f486f78a795031ec04f78708c962586c8cbe74c3
a6bef770ab98c17c65f463772472d758f31f8c8f
refs/heads/master
2021-06-02T01:31:31.806651
2019-07-28T10:07:33
2019-07-28T10:07:33
110,703,242
0
0
null
2021-04-26T17:38:46
2017-11-14T14:49:39
Java
UTF-8
Java
false
false
702
java
/** * Project Name : Tools * File Name : MyBatisGeneratorTest.java * Package Name : net.yuanmomo.tools.db.orm.mybatis * Created on : 2013-12-24下午5:13:58 * Author : Hongbin.Yuan * Blog : yuanmomo.net * Company : 成都逗溜网科技有限公司 */ import net.yuanmomo.generator.MyBatisGeneratorTool; /** * ClassName : MyBatisGeneratorTest Function : TODO ADD FUNCTION. Reason : TODO * ADD REASON. Date : 2013-12-24 下午5:13:58 * * @author : Hongbin.Yuan * @version * @since JDK 1.6 * @see */ public class GeneratorMain { public static void main(String args[]) { MyBatisGeneratorTool.generate("src/test/resources/mybatis/generatorConfig.xml"); } }
[ "haolllllllll@qq.com" ]
haolllllllll@qq.com
35c05afa5a71061187d994214dc744705c427115
3c67b99fbff09e77e901de349b2d9d5076e523f1
/load/src/main/java/bomber/config/FullUris.java
ba45684b41ad7abb28509b4769596863b545faa3
[]
no_license
shurupov/bomber
0de75989f8572298aa69e13a5ce5fec473381977
07156200e0e4a4ca56c8f94ac74f9e5e5418be78
refs/heads/master
2021-01-21T13:14:26.592062
2013-08-12T11:06:58
2013-08-12T11:06:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package bomber.config; import java.util.ArrayList; import java.util.List; /** * User: Eugene Shurupov * Date: 30.07.13 * Time: 15:15 */ public class FullUris { public List<FullUri> fullUris = new ArrayList<>(); /*public void add(FullUri path) { fullUris.add(path); } public List getContent() { return fullUris; }*/ }
[ "shurupov@wesee.com" ]
shurupov@wesee.com
c48dcc2c64e4cd603fece69b0c5c17339acbf42f
0a109908c8ff7d69e0a800108637226c2e61560a
/src/main/java/by/matusevichChercasova/movieRating/config/MvcConfig.java
0fef6d9b9901bf1245788d6b4741784d4bc0808e
[]
no_license
olya7viit/movie_rating
c3ebd8179ff07127bf6247c36a411e9aef77c3a7
b6be49938d012cd31cd37ce04c8eea8acbedadf5
refs/heads/master
2022-07-04T13:29:31.800639
2020-03-19T14:56:01
2020-03-19T14:56:01
248,530,381
0
1
null
2022-06-21T03:01:30
2020-03-19T14:54:47
Java
UTF-8
Java
false
false
926
java
package by.matusevichChercasova.movieRating.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class MvcConfig implements WebMvcConfigurer {//не нужно создавать свой контроллер, здесь раздаются странички, которые описаны(шаблоны), на них нет никакой логики public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login");// "/login" - это и есть системная логика //страничка нас не устраевает, поэтому мы пишем свою } }
[ "olya.matusevich.99@mail.ru" ]
olya.matusevich.99@mail.ru
41cc995ecf548f3b4d11035f5bac965294ebaebb
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_3/src/b/d/h/b/Calc_1_3_13716.java
01ca3bc477b8f950edae0f9976ec67e47ba59515
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package b.d.h.b; public class Calc_1_3_13716 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
[ "christian.halstrick@sap.com" ]
christian.halstrick@sap.com
a1b8544fb886729df78359ca0a55e23cacc89077
8a6453cd49949798c11f57462d3f64a1fa2fc441
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/CreateNetworkInterfacePermissionResult.java
13b3bdb8df0601325e99c8656a5d0125b92629a1
[ "Apache-2.0" ]
permissive
tedyu/aws-sdk-java
138837a2be45ecb73c14c0d1b5b021e7470520e1
c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8
refs/heads/master
2020-04-14T14:17:28.985045
2019-01-02T21:46:53
2019-01-02T21:46:53
163,892,339
0
0
Apache-2.0
2019-01-02T21:38:39
2019-01-02T21:38:39
null
UTF-8
Java
false
false
4,309
java
/* * Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceResult; /** * <p> * Contains the output of CreateNetworkInterfacePermission. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateNetworkInterfacePermissionResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * Information about the permission for the network interface. * </p> */ private NetworkInterfacePermission interfacePermission; /** * <p> * Information about the permission for the network interface. * </p> * * @param interfacePermission * Information about the permission for the network interface. */ public void setInterfacePermission(NetworkInterfacePermission interfacePermission) { this.interfacePermission = interfacePermission; } /** * <p> * Information about the permission for the network interface. * </p> * * @return Information about the permission for the network interface. */ public NetworkInterfacePermission getInterfacePermission() { return this.interfacePermission; } /** * <p> * Information about the permission for the network interface. * </p> * * @param interfacePermission * Information about the permission for the network interface. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateNetworkInterfacePermissionResult withInterfacePermission(NetworkInterfacePermission interfacePermission) { setInterfacePermission(interfacePermission); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getInterfacePermission() != null) sb.append("InterfacePermission: ").append(getInterfacePermission()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateNetworkInterfacePermissionResult == false) return false; CreateNetworkInterfacePermissionResult other = (CreateNetworkInterfacePermissionResult) obj; if (other.getInterfacePermission() == null ^ this.getInterfacePermission() == null) return false; if (other.getInterfacePermission() != null && other.getInterfacePermission().equals(this.getInterfacePermission()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInterfacePermission() == null) ? 0 : getInterfacePermission().hashCode()); return hashCode; } @Override public CreateNetworkInterfacePermissionResult clone() { try { return (CreateNetworkInterfacePermissionResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
255aa8af16fd3ad01c19f6aa781c569593f9c976
450acf47fd85ffbae8e50e732f3de1e002352dcb
/Project/Version01/Uniclubz/app/src/main/java/com/fahemaSultana/uniclubz/fragment/profile/adapter/PhoneNumberAdapter.java
c8028b94530db126b844ebc5a257f78aa3f905a4
[]
no_license
NSU-SU21-CSE486-1/1711593_SU21_CSE486_1
74cf9474fea9c6696c075ad90fd28aa1521269c6
32bf36ad6f7f17c60b78756f9cbd30b60c39aadc
refs/heads/main
2023-07-29T14:45:40.703879
2021-09-18T13:42:04
2021-09-18T13:42:04
377,801,684
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package com.fahemaSultana.uniclubz.fragment.profile.adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.fahemaSultana.uniclubz.R; import com.fahemaSultana.uniclubz.dataModel.PhoneNumbers; import java.util.List; public class PhoneNumberAdapter extends RecyclerView.Adapter<PhoneNumberAdapter.PhoneNumberViewHolder> { private List<PhoneNumbers> mPhoneNumbersList; public PhoneNumberAdapter(List<PhoneNumbers> PhoneNumbersList) { mPhoneNumbersList = PhoneNumbersList; } @Override public PhoneNumberViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View PhoneView = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_phone_number, parent, false); PhoneNumberViewHolder newPhoneView = new PhoneNumberViewHolder(PhoneView); return newPhoneView; } @Override public void onBindViewHolder(@NonNull PhoneNumberViewHolder holder, int position) { PhoneNumbers CurrentPhoneNumbers = mPhoneNumbersList.get(position); holder.Tag.setText(CurrentPhoneNumbers.getTag()); holder.PhoneNumbers.setText(CurrentPhoneNumbers.getPhonenumber()); } @Override public int getItemCount() { return mPhoneNumbersList.size(); } public static class PhoneNumberViewHolder extends RecyclerView.ViewHolder { public TextView Tag; public TextView PhoneNumbers; public PhoneNumberViewHolder(@NonNull View itemView) { super(itemView); Tag = itemView.findViewById(R.id.show_phone_tag); PhoneNumbers = itemView.findViewById(R.id.show_phone_number); } } }
[ "56092087+fahemasultana@users.noreply.github.com" ]
56092087+fahemasultana@users.noreply.github.com
91ba997c27b3c40d15379c4b414de452d72c8e82
f497a2d1ea8f9622e035828a5e39d989e58b5d91
/ping-service/src/dmitrygusev/ping/components/TopBar.java
d6fdd259aa57cb482f33d7cefa3ccfa90ac5f2fc
[]
no_license
GunioRobot/ping-service
454c424283e526eb8d68401c3658b8c68be056c9
77160b80d0464a7af5432b89dc5238df0ce51770
refs/heads/master
2021-01-18T09:36:39.241202
2011-06-20T07:28:09
2011-06-20T07:28:09
2,677,774
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package dmitrygusev.ping.components; import java.security.Principal; import org.apache.tapestry5.ioc.annotations.Inject; import dmitrygusev.ping.services.GAEHelper; public class TopBar { @Inject private GAEHelper gaeHelper; public Principal getPrincipal() { return gaeHelper.getUserPrincipal(); } public String getLogoutURL() { return gaeHelper.createLogoutURL("/"); } }
[ "dmitry.gusev@gmail.com" ]
dmitry.gusev@gmail.com
ec8252d43e7b3b26bb3e00d79de15b03388b5ef4
b8621c2ac5a2fa44960f67c69d38c8fd97dfb206
/eagle-oj-web/src/main/java/com/eagleoj/web/service/impl/ContestProblemServiceImpl.java
c074329a7f95ef1f9e4340fd62c6f620bb8605a6
[]
no_license
Eagle-OJ/eagle-oj-api
5f888aa5c414cffcb3785a3c88a2b1f2cd1685c3
a7b507c6d33d5529f060eb2333f62bd87ce73afb
refs/heads/master
2022-06-06T01:12:23.315725
2022-05-22T14:21:08
2022-05-22T14:21:08
107,384,763
26
8
null
2018-03-26T01:56:04
2017-10-18T09:10:53
Java
UTF-8
Java
false
false
4,300
java
package com.eagleoj.web.service.impl; import com.eagleoj.web.controller.exception.WebErrorException; import com.eagleoj.web.dao.ContestProblemMapper; import com.eagleoj.web.entity.ContestProblemEntity; import com.eagleoj.web.entity.ProblemEntity; import com.eagleoj.web.service.ContestProblemService; import com.eagleoj.web.service.ProblemService; import com.eagleoj.web.util.WebUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * @author Smith **/ @Service public class ContestProblemServiceImpl implements ContestProblemService { @Autowired private ContestProblemMapper contestProblemMapper; @Autowired private ProblemService problemService; @Override public ContestProblemEntity getContestProblem(int cid, int pid) { ContestProblemEntity contestProblemEntity = contestProblemMapper.getByCidPid(cid, pid); WebUtil.assertNotNull(contestProblemEntity, "本次比赛中不存在此题目"); return contestProblemEntity; } @Override public int countContestProblems(int pid) { return contestProblemMapper.countByPid(pid); } @Override public List<Map<String, Object>> listContestProblems(int cid) { return contestProblemMapper.listByCid(cid); } @Override public List<Map<String, Object>> listContestProblems (int cid, int uid) { return contestProblemMapper.listByCidUidWithStatus(cid, uid); } @Override public void saveContestProblem(int cid, int pid, int displayId, int score) { try { ProblemEntity problemEntity = problemService.getProblem(pid); } catch (Exception e) { throw new WebErrorException("不存在此题目"); } boolean flag = displayIdIsDuplicate(cid, displayId); if (flag) { throw new WebErrorException("显示题号重复"); } ContestProblemEntity contestProblemEntity = contestProblemMapper.getByCidPid(cid, pid); WebUtil.assertNull(contestProblemEntity, "此题已经添加过了"); ContestProblemEntity newEntity = new ContestProblemEntity(); newEntity.setCid(cid); newEntity.setPid(pid); newEntity.setDisplayId(displayId); newEntity.setScore(score); boolean res = contestProblemMapper.save(newEntity) == 1; WebUtil.assertIsSuccess(res, "题目添加失败"); // 更新题目被调用记录 ProblemEntity newProblemEntity = new ProblemEntity(); newProblemEntity.setUsedTimes(1); problemService.updateProblem(pid, newProblemEntity); } @Override public void updateContestProblem(int cid, int pid, int displayId, int score) { ContestProblemEntity contestProblemEntity = getContestProblem(cid, pid); if (displayId != contestProblemEntity.getDisplayId()) { if (displayIdIsDuplicate(cid, displayId)) { throw new WebErrorException("显示题号重复"); } } ContestProblemEntity data = new ContestProblemEntity(); data.setDisplayId(displayId); data.setScore(score); boolean flag = contestProblemMapper.updateByCidPid(cid, pid, data) == 1; WebUtil.assertIsSuccess(flag, "题目更新失败"); } @Override public void updateContestProblemTimes(int cid, int pid, ContestProblemEntity entity) { entity.setCid(cid); entity.setPid(pid); boolean flag = contestProblemMapper.updateByCidPid(cid, pid, entity) == 1; WebUtil.assertIsSuccess(flag, "更新比赛题目次数失败"); } @Override public void deleteContestProblem(int cid, int pid) { boolean flag = contestProblemMapper.deleteByCidPid(cid, pid) == 1; WebUtil.assertIsSuccess(flag, "删除比赛题目失败"); } public void deleteContestProblems(int cid) { boolean flag = contestProblemMapper.deleteByCid(cid) > 0; WebUtil.assertIsSuccess(flag, "删除比赛题目失败"); } private boolean displayIdIsDuplicate(int cid, int displayId) { ContestProblemEntity result = contestProblemMapper.getByCidDisplayId(cid, displayId); return result != null; } }
[ "chendingchao1@126.com" ]
chendingchao1@126.com
f9bd1a26c8e0e4debc11e3e8cd0e34a541e5c5b7
18ecc2d52951996db2a9ceb3c1fa35ecaefa8192
/src/DepthFirstSearch.java
221493e5a1947e03261acb6ac4e01e59051fcc9e
[]
no_license
vladniculescu1/Tree-Search-Algorithms-Comparison
66633b5799fa433263dab5cc8fe6c2b4d8fedffd
ced9774b28516306da62bb151e7db35ae61e763a
refs/heads/master
2021-02-10T17:53:00.475921
2020-03-02T15:29:45
2020-03-02T15:29:45
244,405,596
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
import java.util.Random; public class DepthFirstSearch { Fringe f = new Fringe(); Random r = new Random(); int nodeNumber = 1; public int findSolution() { Fringe.Node n = f.root; int pos = 0; int child = 0; int i = 0; while(n.s.isFinal() != true) { f.expandNode(n); for(Fringe.Node nodes : n.children) { nodeNumber++; } //we pick a random child child = r.nextInt((f.Tree.size() - pos - 2) + 1) + pos + 1; //we remove from the tree all children that were not picked for search i = pos + 1; while(i < child) { f.Tree.remove(i); child --; } i = child + 1; while(i <= (f.Tree.size() - 1)) { f.Tree.remove(i); } //the child becomes the next parent n = f.Tree.get(child); pos = child; } f.Tree.get(f.Tree.size()-1).s.display(); System.out.println("DFS: node " + nodeNumber + " at depth " + f.Tree.get(f.Tree.size()-1).depth); return nodeNumber; } }
[ "danvladadrian@yahoo.com" ]
danvladadrian@yahoo.com
74ac9adf6738b6b39199d2a55407f5ab7366c2e6
91522364308690bcd52c99e98e4c3dde24207958
/src/main/java/cs698/giraph/kmode/Constants.java
da52d4ef5d8996f130df633bf52bcbc9543c9aee
[ "Apache-2.0" ]
permissive
stt12581/giraph_project
930bb6ef1d40cbc2beffb1a4511afbac5ec12816
be5ee65697f1b74948996a394bda8c9180abcf3a
refs/heads/master
2021-01-21T13:14:56.195535
2016-04-18T11:10:03
2016-04-18T11:10:03
55,324,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Change the implementation from k-means to k-mode algorithm based on https://github.com/paulmw/giraph-examples */ package cs698.giraph.kmode; public class Constants { public static final String K = "custom.k"; public static final String MIN = "custom.min"; public static final String MAX = "custom.max"; public static final String POINT_PREFIX = "custom.p."; public static final String AVG = "custom.foo"; public static final String UPDATES = "custom.updates"; }
[ "stt12581@gmail.com" ]
stt12581@gmail.com
209d9dd704e16419647e231016af6f1ffe2ebecb
601574b1f13eecc135e18400c2dfef696f80b001
/app/src/main/java/com/example/gary/buildingcardfinalversion/KnightsWindow.java
2d4c6c2bf6c83374b89880e5300234a61317e08a
[]
no_license
Team-Duke/BuildingCardFinalVersion-1
2c15ebeb747ff42f4b1d741f069262734a706468
482e403f08ee57bae4236aec165bab5f9eb622a1
refs/heads/master
2021-01-17T17:53:54.577642
2015-04-13T11:16:30
2015-04-13T11:16:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,165
java
package com.example.gary.buildingcardfinalversion; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class KnightsWindow extends BuildingMainActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_knights_window); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_knights_window, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "gplane@hotmail.co.uk" ]
gplane@hotmail.co.uk
ac616e4481b291a3dc32dff14950c7aae74b196e
2219a1cafeded237833980ec2c2a6d7ec87662b9
/net/src/test/java/net/demo/netty/http/websockets/WebSocketClientHandler.java
b340d6b42c59d10e3e92c0f0d174a3da84ed5bac
[ "MIT" ]
permissive
liufeiit/tulip
cac93dc7e30626ed6a9710e41d8f9e2b35126838
8934a3297f104fe4cf80fa8fa532d9b4d813ccb6
refs/heads/master
2021-01-17T10:21:50.882512
2015-10-28T12:13:58
2015-10-28T12:13:58
23,213,945
0
1
null
2016-03-09T14:00:49
2014-08-22T05:25:18
Java
UTF-8
Java
false
false
2,735
java
package net.demo.netty.http.websockets; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; import io.netty.handler.codec.http.websocketx.PongWebSocketFrame; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.util.CharsetUtil; public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> { private final WebSocketClientHandshaker handshaker; private ChannelPromise handshakeFuture; public WebSocketClientHandler(WebSocketClientHandshaker handshaker) { this.handshaker = handshaker; } public ChannelFuture handshakeFuture() { return handshakeFuture; } @Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { handshakeFuture = ctx.newPromise(); } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { handshaker.handshake(ctx.channel()); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { System.out.println("WebSocket Client disconnected!"); } @Override public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { Channel ch = ctx.channel(); if (!handshaker.isHandshakeComplete()) { handshaker.finishHandshake(ch, (FullHttpResponse) msg); System.out.println("WebSocket Client connected!"); handshakeFuture.setSuccess(); return; } if (msg instanceof FullHttpResponse) { FullHttpResponse response = (FullHttpResponse) msg; throw new Exception("Unexpected FullHttpResponse (getStatus=" + response.getStatus() + ", content=" + response.content().toString(CharsetUtil.UTF_8) + ')'); } WebSocketFrame frame = (WebSocketFrame) msg; if (frame instanceof TextWebSocketFrame) { TextWebSocketFrame textFrame = (TextWebSocketFrame) frame; System.out.println("WebSocket Client received message: " + textFrame.text()); } else if (frame instanceof PongWebSocketFrame) { System.out.println("WebSocket Client received pong"); } else if (frame instanceof CloseWebSocketFrame) { System.out.println("WebSocket Client received closing"); ch.close(); } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { cause.printStackTrace(); if (!handshakeFuture.isDone()) { handshakeFuture.setFailure(cause); } ctx.close(); } }
[ "liufei_it@126.com" ]
liufei_it@126.com
581ee15ddbd2675e1c996b45487604e6b5d4b91c
52c36ce3a9d25073bdbe002757f08a267abb91c6
/src/main/java/com/alipay/api/response/KoubeiServindustryExerciseRecordSyncResponse.java
775fd162126dc202131ba6ef6b7ea47f4377bc81
[ "Apache-2.0" ]
permissive
itc7/alipay-sdk-java-all
d2f2f2403f3c9c7122baa9e438ebd2932935afec
c220e02cbcdda5180b76d9da129147e5b38dcf17
refs/heads/master
2022-08-28T08:03:08.497774
2020-05-27T10:16:10
2020-05-27T10:16:10
267,271,062
0
0
Apache-2.0
2020-05-27T09:02:04
2020-05-27T09:02:04
null
UTF-8
Java
false
false
391
java
package com.alipay.api.response; import com.alipay.api.AlipayResponse; /** * ALIPAY API: koubei.servindustry.exercise.record.sync response. * * @author auto create * @since 1.0, 2019-01-24 20:45:00 */ public class KoubeiServindustryExerciseRecordSyncResponse extends AlipayResponse { private static final long serialVersionUID = 2285319748929812192L; }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
63ae9a35aeaf61a4f4d3de70a94f48f64df0e00b
6cdb22a7e67d1bf6f7ff143c7daf5b928975eab7
/src/object/change/C.java
2e210941227f9188d3e27443c378a5a75ebd8343
[]
no_license
KoToXir/-java-HPE-
460ed3892a4e52af03331721958d445360d58308
8573c63c9ccd628429acbc42b762240a5a14bd11
refs/heads/master
2020-04-15T11:33:40.496433
2019-02-25T01:46:11
2019-02-25T01:46:11
164,636,056
0
0
null
null
null
null
UTF-8
Java
false
false
59
java
package object.change; public class C extends B { }
[ "mygbo@DESKTOP-HNBB94V" ]
mygbo@DESKTOP-HNBB94V
c32ab3965372f3db4e6c643d00a472697afbdcd6
9b01ffa3db998c4bca312fd28aa977f370c212e4
/app/src/streamC/java/com/loki/singlemoduleapp/stub/SampleClass4265.java
bba688defc3abbfd13e9eb6a4a67ec9c3d063abd
[]
no_license
SergiiGrechukha/SingleModuleApp
932488a197cb0936785caf0e73f592ceaa842f46
b7fefea9f83fd55dbbb96b506c931cc530a4818a
refs/heads/master
2022-05-13T17:15:21.445747
2017-07-30T09:55:36
2017-07-30T09:56:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.loki.singlemoduleapp.stub; public class SampleClass4265 { private SampleClass4266 sampleClass; public SampleClass4265(){ sampleClass = new SampleClass4266(); } public String getClassName() { return sampleClass.getClassName(); } }
[ "sergey.grechukha@gmail.com" ]
sergey.grechukha@gmail.com
ca9ec941fc09ddf0dd5b644a7c64909e0c297764
9d95e8087cf4aa9eda9c822f3a0f29d6c30a4256
/808/src/ch2_Working_With_Java_Data_Types/ex3.java
199d9b6714baf1bee12246122ea66cead582de0e
[]
no_license
CJ-1995/EEIT-29
403b2845437a4cb146484c02d9719a02beaae932
ed214e9df012a2a2acfda4a12abeb9b108924f2e
refs/heads/master
2023-06-08T15:46:32.587465
2021-06-27T16:24:59
2021-06-27T16:24:59
366,985,043
0
0
null
2021-06-27T16:25:00
2021-05-13T08:33:00
Java
UTF-8
Java
false
false
851
java
package ch2_Working_With_Java_Data_Types; public class ex3 { public static void main(String[] args) { // TODO Auto-generated method stub } } /* Given: public class ComputeSum { public int x; public int y; public int sum; public ComputeSum(int nx, int ny) { x = nx; y = ny; updateSum(); } public void setX(int nx) { x = nx; updateSum(); } public void setY(int ny) { x = ny; updateSum(); } void updateSum() { sum = x + y; } } This class needs to protect an invariant on the sum field. Which three members must have the private access modifier to ensure that this invariant is maintained? A. The x field B. The y field C. The sum field D. The ComputerSum ( ) constructor E. The setX ( ) method F. The setY ( ) method */
[ "Highchen918@gmail.com" ]
Highchen918@gmail.com
8eaea1dfb5e6d6332305d9c3aa0de50ae1a114e3
5661671609985ecebbe819d2c93c474f026e52f2
/app/src/main/java/edu/osu/cse/nearjoin/MemoryCache.java
d9499e8632ff2fcdeb2fcf341e08d730afc13094
[]
no_license
rfeeney9923/NearJoin
16352d09294ba7ba67bee62a4cb0a20bbe8ad1be
0dd7d9a68fd3f34edce1d65e5b217e679bbf2f51
refs/heads/master
2020-05-23T16:49:43.773024
2014-12-05T00:57:48
2014-12-05T00:57:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
681
java
package edu.osu.cse.nearjoin; import android.graphics.Bitmap; import java.lang.ref.SoftReference; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class MemoryCache { private Map<String, SoftReference<Bitmap>> cache= Collections.synchronizedMap(new HashMap<String, SoftReference<Bitmap>>()); public Bitmap get(String id){ if(!cache.containsKey(id)) return null; SoftReference<Bitmap> ref=cache.get(id); return ref.get(); } public void put(String id, Bitmap bitmap){ cache.put(id, new SoftReference<Bitmap>(bitmap)); } public void clear() { cache.clear(); } }
[ "powerfish.1@gmail.com" ]
powerfish.1@gmail.com
a93a2490c69d088d30cb00c6c2af1c3df23c9cb6
57d7801f31d911cde6570e3e513e43fb33f2baa3
/src/main/java/nl/strohalm/cyclos/entities/accounts/external/ExternalTransferAction.java
6d74f5bcb5d8a4a98c5eef9acfe44bb68ca7e41b
[]
no_license
kryzoo/cyclos
61f7f772db45b697fe010f11c5e6b2b2e34a8042
ead4176b832707d4568840e38d9795d7588943c8
refs/heads/master
2020-04-29T14:50:20.470400
2011-12-09T11:51:05
2011-12-09T11:51:05
54,712,705
0
1
null
2016-03-25T10:41:41
2016-03-25T10:41:41
null
UTF-8
Java
false
false
956
java
/* This file is part of Cyclos. Cyclos is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Cyclos is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Cyclos; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package nl.strohalm.cyclos.entities.accounts.external; /** * A possible action for an external transfer * @author Jefferson Magno */ public enum ExternalTransferAction { MARK_AS_CHECKED, MARK_AS_UNCHECKED, DELETE; }
[ "mpr@touk.pl" ]
mpr@touk.pl
9900f243d31d9461be9ff7db51a8202120fec7f4
eac6a7eb6509a0c5f2e1b8380033c4fd9284a1b0
/src/main/java/org/quetzaco/experts/app/dao/UdsetmajorMapper.java
2b1ca35401e3c5144b9f3b3f192f76aa2da08527
[]
no_license
wangying95599/bidding
d420d6f398ec0f0df21f319705c02cff69e50332
fa4bb8c3b39efdef1cc26d128ac2e82c74bd220c
refs/heads/master
2020-03-07T13:31:45.751569
2018-04-24T01:32:36
2018-04-24T01:32:36
127,503,364
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package org.quetzaco.experts.app.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import org.quetzaco.experts.model.Udsetmajor; import org.quetzaco.experts.model.UdsetmajorExample; public interface UdsetmajorMapper { long countByExample(UdsetmajorExample example); int deleteByExample(UdsetmajorExample example); int deleteByPrimaryKey(Integer projectId); int insert(Udsetmajor record); int insertSelective(Udsetmajor record); List<Udsetmajor> selectByExample(UdsetmajorExample example); Udsetmajor selectByPrimaryKey(Integer projectId); int updateByExampleSelective(@Param("record") Udsetmajor record, @Param("example") UdsetmajorExample example); int updateByExample(@Param("record") Udsetmajor record, @Param("example") UdsetmajorExample example); int updateByPrimaryKeySelective(Udsetmajor record); int updateByPrimaryKey(Udsetmajor record); List<Udsetmajor> selectById(@Param("projectId") Integer projectId); }
[ "528142048@qq.com" ]
528142048@qq.com
51e81f97d227661d179ab7ef04d80dbc83c70992
4bcc334d04b76d46a4edbc2eec1406cf01b8a352
/JSPMVCLastProject2/src/com/sist/model/MainModel.java
979c58cea6af1fdd47c58cecee4c0e0ff94eda8b
[]
no_license
chaijewon/2021-09-01-MvcStudy
e0facd073cca6cdbdec1654aa9cfc33b57ae3932
c09d87b5beaf0c4888fe9f1bc3f7dd5d57b1b393
refs/heads/master
2023-09-04T17:55:21.605078
2021-09-17T08:40:19
2021-09-17T08:40:19
401,916,433
0
1
null
null
null
null
UTF-8
Java
false
false
816
java
package com.sist.model; import javax.servlet.http.HttpServletRequest; import com.sist.controller.*; //POJO => 일반 클래스 => 클래스명 자유롭다 (메소드도 마음되로 사용이 가능) // 프로젝트 => 클래스명을 전한다 , 메소드명을 정한다 (X) => public class MainModel { @RequestMapping("main/main.do") public String main_page(HttpServletRequest request) { return "../main/main.jsp"; } @RequestMapping("main/ko.do") public String main_ko(HttpServletRequest request) { return "../main/ko.jsp"; } @RequestMapping("main/ch.do") public String main_ch(HttpServletRequest request) { return "../main/ch.jsp"; } @RequestMapping("main/ja.do") public String main_ja(HttpServletRequest request) { return "../main/ja.jsp"; } }
[ "vcandjava@nate.com" ]
vcandjava@nate.com
c6fc6f5a9e5d0ca185f9331d0137d5c2f8aac47e
880e26443c9531c2883535706cebddc8409c49a4
/src/main/java/com/seungmoo/demospringdi/DemoSpringDiApplication.java
1a15362b57c9c43cd7a0454ac17434add9be3f12
[]
no_license
dltmdan92/demo-spring-di
577bf9c59fbb261516d001d84f5c9d929fa8b9f9
7ecbfdbf8f1c77a616f12eafbe547d818f763bf0
refs/heads/master
2023-03-01T14:31:30.588166
2021-01-31T11:19:10
2021-01-31T11:19:10
334,636,983
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.seungmoo.demospringdi; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoSpringDiApplication { public static void main(String[] args) { SpringApplication.run(DemoSpringDiApplication.class, args); } }
[ "seungmoo.lee@lotte.net" ]
seungmoo.lee@lotte.net
31bd70f59fba06c4d311e5c4b8ee03286cd48f08
3c59c21350a9d87519a7707d02d4b59decfa2e09
/org.geocraft.core.session/src/org/geocraft/core/session/SavesetDescriptor.java
4cc7399b1930e767680f481469cecdcc012b4592
[]
no_license
duncanchild/geocraft
e7455751b4d3dcf0b17979fa8f0cabdacb2cc109
b301c0c96ebfeaf36b8a0ec141f342cfc91c0ecb
refs/heads/master
2021-01-15T08:05:36.041473
2015-05-15T17:17:30
2015-05-15T17:17:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
25,598
java
/* * Copyright (C) ConocoPhillips 2010 All Rights Reserved. */ package org.geocraft.core.session; import java.util.ArrayList; import java.util.HashMap; import org.geocraft.core.session.SavesetDescriptor.Viewer.Renderer; import org.geocraft.core.session.SavesetDescriptor.Viewer.ViewerLayer; /** * Descriptor for a saveset, i.e, container for all saveset data * @author hansegj */ public class SavesetDescriptor { /** Pathname of the saveset */ String _savesetPath = ""; /** List of unique workbench window IDs */ ArrayList<String> _windowIds; /** Ordered list of entities (var names) */ ArrayList<DataEntity> _entities; /** Ordered list of algorithm */ ArrayList<Algorithm> _algorithms; /** Ordered list of preference pages */ ArrayList<PreferencePage> _preferencePages; //** Ordered list of perspectives */ ArrayList<Perspective> _perspectives; /** Map of viewer parts. key is viewer part's unique ID. */ HashMap<String, ViewerPart> _viewerParts; /** ID of the detached workbench window containing plots */ String _plotWindowID; // GeoCraft window attributes String _width, _height, _x, _y; // Version of GeoCraft String _version; public SavesetDescriptor() { _entities = new ArrayList<DataEntity>(); _algorithms = new ArrayList<Algorithm>(); _preferencePages = new ArrayList<PreferencePage>(); _perspectives = new ArrayList<Perspective>(); _viewerParts = new HashMap<String, ViewerPart>(); _windowIds = new ArrayList<String>(); _plotWindowID = ""; } // GETTERS /** Get the path of the saveset */ public String getSavesetPath() { return _savesetPath; } /** Get the ordered list of entities (var names) */ public ArrayList<DataEntity> getEntities() { return _entities; } /** Get the ordered list of algorithms */ public ArrayList<Algorithm> getAlgorithms() { return _algorithms; } /** Get the ordered list of preference pages */ public ArrayList<PreferencePage> getPreferencePages() { return _preferencePages; } /** * Get the algorithms associated with a window ID * @param winID Workbench window ID * @return List of associated algorithms */ public ArrayList<Algorithm> getAlgorithms(String winID) { ArrayList<Algorithm> algorithms = new ArrayList<Algorithm>(); for (Algorithm algorithm : _algorithms) { if (algorithm.getAlgorithmWindowID().equals(winID)) { algorithms.add(algorithm); } } return algorithms; } /** Get the ordered list of perspectives */ public ArrayList<Perspective> getPerspectives() { return _perspectives; } /** * Get the perspectives associated with a window ID * @param winID Workbench window ID * @return List of associated perspectives */ public ArrayList<Perspective> getPerspectives(String winID) { ArrayList<Perspective> perspectives = new ArrayList<Perspective>(); for (Perspective perspective : _perspectives) { if (perspective.getPerspectiveWindowID().equals(winID)) { perspectives.add(perspective); } } return perspectives; } /** Get the ordered list of the viewer parts for all perspectives */ public HashMap<String, ViewerPart> getViewerParts() { return _viewerParts; } /** * Get the viewer parts associated with a window ID * @param winID Workbench window ID * @return List of associated viewer parts */ public ArrayList<ViewerPart> getViewerParts(String winID) { ArrayList<ViewerPart> parts = new ArrayList<ViewerPart>(); for (ViewerPart part : _viewerParts.values()) { if (part.getViewerPartWindowID().equals(winID)) { parts.add(part); } } return parts; } /** Get the list of workbench window IDs */ public ArrayList<String> getWorkbenchWindows() { return _windowIds; } public String getPlotWindowID() { return _plotWindowID; } // SETTERS public void setWindowAttributes(final String version, final String width, final String height, final String x, final String y) { _version = version; _width = width; _height = height; _x = x; _y = y; } public void addEntity(final DataEntity entity) { _entities.add(entity); } public void addAlgorithm(final Algorithm algorithm) { _algorithms.add(algorithm); } public void addPerspective(final Perspective perspective) { _perspectives.add(perspective); } public void addPreferencePage(final PreferencePage prefPage) { _preferencePages.add(prefPage); } public void addViewerPart(final String uniqueId, final ViewerPart viewerPart) { _viewerParts.put(uniqueId, viewerPart); } public void addWindowID(final String winID) { boolean inList = false; for (String id : _windowIds) { if (winID.equals(id)) { inList = true; break; } } if (!inList) { _windowIds.add(winID); } } public void setPlotWindowID(String winID) { _plotWindowID = winID; } /** Output saveset descriptor */ public void dumpDescriptor() { System.out.println("Saveset descriptor for saveset: " + _savesetPath); String indent = " "; System.out.println(indent + "# of entities = " + _entities.size()); for (DataEntity entity : _entities) { System.out.println(indent + "Entity: " + entity.getVarName() + ", uniqueID = " + entity.getEntityUniqueId()); System.out.println(indent + "Total # of properties = " + entity.getNumEntityProperties()); ArrayList<EntityModelProperty> properties = entity.getEntityProperties(); for (EntityModelProperty property : properties) { System.out.println(indent + indent + "Property: key = " + property.getKey() + ", value = " + property.getValue()); } } indent = " "; System.out.println(indent + "# of algorithms = " + _algorithms.size()); for (Algorithm algorithm : _algorithms) { System.out.println(indent + "Algorithm: " + algorithm.getAlgorithmName() + ", windowID=" + algorithm.getAlgorithmWindowID() + ", action=" + algorithm.getAlgorithmAction()); System.out.println(indent + "Total # of parameters = " + algorithm.getNumAlgorithmProperties()); ArrayList<AlgorithmParameter> parameters = algorithm.getAlgorithmProperties(); for (AlgorithmParameter param : parameters) { System.out.println(indent + indent + "Parameter: key = " + param.getKey() + ", value = " + param.getValue()); } } indent = " "; System.out.println(indent + "# of preference pages = " + _preferencePages.size()); for (PreferencePage prefPage : _preferencePages) { System.out.println(indent + "Preference Page: " + prefPage.getPreferencePageName()); System.out.println(indent + "Total # of preferences = " + prefPage.getNumPreferences()); ArrayList<Preference> preferences = prefPage.getPreferences(); for (Preference pref : preferences) { System.out.println(indent + indent + "Preference: key = " + pref.getKey() + ", value = " + pref.getValue()); } } indent = " "; System.out.println(indent + "# of perspectives = " + _perspectives.size()); for (Perspective perspective : _perspectives) { System.out.println(indent + "Perspective: " + perspective.getPerspectiveName() + ", id=" + perspective.getPerspectiveID() + ", class=" + perspective.getPerspectiveClass() + "windowID=" + perspective.getPerspectiveWindowID()); } indent = " "; System.out.println(indent + "plot window ID =" + _plotWindowID); indent = " "; System.out.println(indent + "# of viewer parts = " + _viewerParts.size()); for (String uniqueID : _viewerParts.keySet()) { ViewerPart viewerPart = _viewerParts.get(uniqueID); System.out.println(indent + "Viewer part: " + viewerPart.getViewerPartId() + ", class =" + viewerPart.getViewerPartClassName() + ", windowID=" + viewerPart.getViewerPartWindowID() + ", perspectiveID=" + viewerPart.getViewerPerspectiveID() + ", uniqueID =" + viewerPart.getViewerPartUniqueID()); for (Viewer viewer : viewerPart.getViewers()) { System.out.println(indent + indent + "Viewer: " + viewer.getViewerTitle() + ", class =" + viewer.getViewerClassName()); ArrayList<ViewerLayer> viewerLayers = viewer.getViewerLayers(); for (ViewerLayer viewerLayer : viewerLayers) { System.out.println(indent + indent + indent + "Viewer layer: name = " + viewerLayer.getLayerName() + ", checked = " + viewerLayer.isChecked()); } ArrayList<ViewerProperty> properties = viewer.getViewerProperties(); for (ViewerProperty prop : properties) { System.out.println(indent + indent + indent + "Property: key = " + prop.getKey() + ", value = " + prop.getValue()); } for (String uniqueId : viewer.getViewerRenderers().keySet()) { Renderer renderer = viewer.getViewerRenderers().get(uniqueId); System.out.println(indent + indent + indent + "Renderer: " + renderer.getRendererClassName() + ", uniqueID =" + renderer.getRendererUniqueId()); System.out.println(indent + indent + indent + indent + "Rendered Entity: " + renderer.getRenderedEntity()); ArrayList<RendererProperty> rprops = renderer.getRendererProperties(); for (RendererProperty prop : rprops) { System.out.println(indent + indent + indent + indent + "Property: key = " + prop.getKey() + ", value = " + prop.getValue()); } } } } } /** * Individual data entity */ public class DataEntity { /** Data entity's var name */ String _varName = ""; /** Unique entity ID */ String _entityUniqueId = ""; /** Entity's ordered list of properties */ ArrayList<EntityModelProperty> _entityProperties; public DataEntity() { _entityProperties = new ArrayList<EntityModelProperty>(); } //GETTERS public String getVarName() { return _varName; } public String getEntityUniqueId() { return _entityUniqueId; } /** Get the entity's ordered list of properties */ public ArrayList<EntityModelProperty> getEntityProperties() { return _entityProperties; } /** Get the number of entity properties */ public int getNumEntityProperties() { return _entityProperties.size(); } //SETTERS public void setVarName(String varName) { _varName = varName; } public void setEntityUniqueId(String uniqueId) { _entityUniqueId = uniqueId; } public void addEntityProperty(final String key, final String value) { _entityProperties.add(new EntityModelProperty(key, value, _entityUniqueId)); } } /** * Individual algorithm */ public class Algorithm { /** Name of the algorithm */ String _algorithmName = ""; /** Unique algorithm ID */ String _algorithmUniqueId = ""; /** Algorithm class name */ String _algorithmClassName = ""; /** ID of workbench window containing algorithm */ String _windowID = ""; /** Algorithm action */ String _algorithmAction = ""; /** Algorithm's ordered list properties */ ArrayList<AlgorithmParameter> _algorithmProperties; public Algorithm() { _algorithmProperties = new ArrayList<AlgorithmParameter>(); } //GETTERS /** Get the algorithm's name */ public String getAlgorithmName() { return _algorithmName; } /** Get the algorithms's unique IDs */ public String getAlgorithmUniqueID() { return _algorithmUniqueId; } /** Get the algorithm's class name */ public String getAlgorithmClassName() { return _algorithmClassName; } public String getAlgorithmWindowID() { return _windowID; } /** Get the algorithm's action */ public String getAlgorithmAction() { return _algorithmAction; } /** Get the algorithm's ordered list of properties */ public ArrayList<AlgorithmParameter> getAlgorithmProperties() { return _algorithmProperties; } /** Get the number of algorithm properties */ public int getNumAlgorithmProperties() { return _algorithmProperties.size(); } //SETTERS public void setAlgorithmName(final String name) { _algorithmName = name; } public void setAlgorithmUniqueId(final String uniqueId) { _algorithmUniqueId = uniqueId; } public void setAlgorithmClassName(final String className) { _algorithmClassName = className; } public void setAlgorithmWindowID(final String winID) { _windowID = winID; } public void setAlgorithmAction(final String action) { _algorithmAction = action; } public void addAlgorithmProperty(final String key, final String value) { _algorithmProperties.add(new AlgorithmParameter(key, value, _algorithmUniqueId)); } } /** * Individual preference page */ public class PreferencePage { /** Name of the preference page */ String _preferencePageName = ""; /** Preference page class name */ String _preferencePageClassName = ""; /** Preference pages's ordered list preferences */ ArrayList<Preference> _preferences; public PreferencePage() { _preferences = new ArrayList<Preference>(); } //GETTERS /** Get the preference page's name */ public String getPreferencePageName() { return _preferencePageName; } /** Get the preference page's class name */ public String getPreferencePageClassName() { return _preferencePageClassName; } /** Get the preference page's ordered list of preferences */ public ArrayList<Preference> getPreferences() { return _preferences; } /** Get the number of preferences */ public int getNumPreferences() { return _preferences.size(); } //SETTERS public void setPreferencePageName(final String name) { _preferencePageName = name; } public void setPreferencePageClassName(final String className) { _preferencePageClassName = className; } public void addPreference(final String key, final String value) { _preferences.add(new Preference(key, value)); } } /** * Individual viewer part; contains list of viewers * @author hansegj * */ public class ViewerPart { /** Viewer part's class name */ String _viewerPartClassName = ""; /** Viewer part's part ID */ String _viewerPartId = ""; String _windowID = ""; String _perspectiveID = ""; /** Viewer part' unique ID */ String _viewerPartUniqueId = ""; /** Viewer part's ordered list viewers */ ArrayList<Viewer> _viewers; public ViewerPart() { _viewers = new ArrayList<Viewer>(); } //GETTERS /** Get the viewer part's part ID */ public String getViewerPartId() { return _viewerPartId; } /** Get the viewer part's unique IDs */ public String getViewerPartUniqueID() { return _viewerPartUniqueId; } /** Get the viewer part's class name */ public String getViewerPartClassName() { return _viewerPartClassName; } public String getViewerPartWindowID() { return _windowID; } public String getViewerPerspectiveID() { return _perspectiveID; } /** Get the viewer part's ordered list of viewers */ public ArrayList<Viewer> getViewers() { return _viewers; } /** Get the number of viewer part's viewers */ public int getNumViewers() { return _viewers.size(); } //SETTERS public void setViewerPartId(final String partId) { _viewerPartId = partId; } /** * Add viewer part's unique ID * @param uniqueId Viewer part's unique ID */ public void setViewerPartUniqueId(final String uniqueId) { _viewerPartUniqueId = uniqueId; } /** * Add viewer part's fully qualified class name * @param className Viewer part's class name */ public void setViewerPartClassName(final String className) { _viewerPartClassName = className; } public void setViewerPartWindowID(final String winID) { _windowID = winID; } public void setViewerPerspectiveID(final String perspectiveID) { _perspectiveID = perspectiveID; } /** * Add a viewer associated with the viewer part * @param viewer Viewer */ public void addViewer(Viewer viewer) { _viewers.add(viewer); } } /** * Individual viewer */ public class Viewer { /** Viewer title */ String _viewerTitle = ""; /** Viewer class name */ String _viewerClassName = ""; /** Viewer's ordered list of properties */ ArrayList<ViewerProperty> _viewerProperties; /** Viewer's list of layers (root and entity) */ ArrayList<ViewerLayer> _viewerLayers; /** Map of renderers for a viewer. key is renderer's unique ID. */ HashMap<String, Renderer> _renderers; public Viewer() { _viewerProperties = new ArrayList<ViewerProperty>(); _viewerLayers = new ArrayList<ViewerLayer>(); _renderers = new HashMap<String, Renderer>(); } //GETTERS /** Get the viewer's title */ public String getViewerTitle() { return _viewerTitle; } /** Get the viewer's class name */ public String getViewerClassName() { return _viewerClassName; } /** Get the viewer's ordered list of properties */ public ArrayList<ViewerProperty> getViewerProperties() { return _viewerProperties; } /** Get the number of viewer properties */ public int getNumViewerProperties() { return _viewerProperties.size(); } /** Get the viewer's list of renderers */ public HashMap<String, Renderer> getViewerRenderers() { return _renderers; } /** Get the number of viewer renderers */ public int getNumViewerRenderers() { return _renderers.size(); } /** Get the viewer's list of layers */ public ArrayList<ViewerLayer> getViewerLayers() { return _viewerLayers; } //SETTERS public void addRenderer(final String uniqueId, final Renderer renderer) { _renderers.put(uniqueId, renderer); } public void setViewerTitle(final String title) { _viewerTitle = title; } public void setViewerClassName(final String className) { _viewerClassName = className; } public void addViewerProperty(final String key, final String value) { _viewerProperties.add(new ViewerProperty(key, value)); } public void addViewerLayer(ViewerLayer layer) { _viewerLayers.add(layer); } /** * Individual viewer layer, root or entity (in the Layers tab) */ public class ViewerLayer { String _layerName; String _layerChecked; public ViewerLayer() { _layerName = ""; _layerChecked = ""; } public ViewerLayer(String layerName, String checked) { _layerName = layerName; _layerChecked = checked; } //GETTERS public String getLayerName() { return _layerName; } public boolean isChecked() { return _layerChecked.equals("true") ? true : false; } //SETTERS public void setLayerName(String layerName) { _layerName = layerName; } public void setChecked(String checked) { _layerChecked = checked; } } /** * Individual viewer renderer */ public class Renderer { String _rendererClassName = ""; String _rendererUniqueId = ""; String _renderedEntity = ""; /** Renderer's ordered list of properties */ ArrayList<RendererProperty> _rendererProperties; public Renderer() { _rendererProperties = new ArrayList<RendererProperty>(); } //GETTERS /** Get the renderer's unique ID */ public String getRendererUniqueId() { return _rendererUniqueId; } /** Get the renderer's class name */ public String getRendererClassName() { return _rendererClassName; } /** Get the renderer's ordered list of properties */ public ArrayList<RendererProperty> getRendererProperties() { return _rendererProperties; } /** Get the number of renderer properties */ public int getNumRendererProperties() { return _rendererProperties.size(); } public String getRenderedEntity() { return _renderedEntity; } //SETTERS /** * Add renderer's unique ID * @param uniqueId Renderer's unique ID */ public void setRendererUniqueId(final String uniqueId) { _rendererUniqueId = uniqueId; } public void setRendererClassName(final String className) { _rendererClassName = className; } public void addRendererProperty(final String key, final String value) { _rendererProperties.add(new RendererProperty(key, value, _rendererUniqueId)); } public void setRenderedEntity(final String entityId) { _renderedEntity = entityId; } } } /** * Individual perspective */ class Perspective { String _perspectiveID = ""; String _perspectiveName = ""; String _perspectiveClass = ""; String _windowID = ""; boolean _isEditorAreaVisible = false; //GETTERS public String getPerspectiveID() { return _perspectiveID; } public String getPerspectiveName() { return _perspectiveName; } public String getPerspectiveClass() { return _perspectiveClass; } public String getPerspectiveWindowID() { return _windowID; } public boolean isEditorAreaVisible() { return _isEditorAreaVisible; } //SETTERS public void setPerspectiveID(String id) { _perspectiveID = id; } public void setPerspectiveName(String name) { _perspectiveName = name; } public void setPerspectiveClass(String klass) { _perspectiveClass = klass; } public void setPerspectiveWindowID(String winID) { _windowID = winID; } public void setEditorAreaVisible(boolean isVisible) { _isEditorAreaVisible = isVisible; } } /** * Individual model property of an entity */ public class EntityModelProperty { // Atributes of an entity property String key, value, varName; /** * Model property constructor * @param key Model property name. * @param value The value of the model property. * @param varName The entity's var name */ public EntityModelProperty(final String key, final String value, final String varName) { this.key = key; this.value = value; this.varName = varName; } public String getKey() { return key; } public String getValue() { return value; } public String getVarName() { return varName; } } /** * Individual parameter of an algorithm */ public class AlgorithmParameter { // Attributes of an algorithm parameter String key, value, uniqueID; /** * Algorithm parameter constructor * @param key Parameter name. * @param value The value of the parameter. * @param uniqueID The algorithm's unique ID */ public AlgorithmParameter(final String key, final String value, final String uniqueID) { this.key = key; this.value = value; this.uniqueID = uniqueID; } public String getKey() { return key; } public String getValue() { return value; } public String getUniqueID() { return uniqueID; } } /** * Individual preference of a preference page */ public class Preference { // Attributes of a preference String key, value; /** * Preference constructor * @param key Preference name. * @param value The value of the preference. */ public Preference(final String key, final String value) { this.key = key; this.value = value; } public String getKey() { return key; } public String getValue() { return value; } } /** * Individual property of a viewer */ public class ViewerProperty { // Attributes of a viewer property String key, value, uniqueID; /** * Viewer property constructor * @param key property name. * @param value The value of the property. */ public ViewerProperty(final String key, final String value) { this.key = key; this.value = value; } public String getKey() { return key; } public String getValue() { return value; } } /** * Individual property of a renderer */ public class RendererProperty { // Attributes of a renderer property String key, value, uniqueID; /** * Renderer property constructor * @param key property name. * @param value The value of the property. * @param uniqueID The renderer's unique ID */ public RendererProperty(final String key, final String value, final String uniqueID) { this.key = key; this.value = value; this.uniqueID = uniqueID; } public String getKey() { return key; } public String getValue() { return value; } public String getUniqueID() { return uniqueID; } } }
[ "eric.geordi@gmail.com" ]
eric.geordi@gmail.com
6eddaebe1b6199f895dc6106badadb749bf72dd0
ef13a1ae45a67ac716156ca980c28427f5299d43
/app/src/main/java/csg/com/torneos/index.java
d40f76375ccd95e8b6aa518a331ec8dacd3a4cc6
[]
no_license
ingleandrotorres/torneos
90321883765023fd25c19d23b65ccf7a78c8127f
c0c9d394a3e7268f1e2fb260e296f476892f17d8
refs/heads/master
2020-12-03T06:41:02.585730
2019-03-12T22:16:09
2019-03-12T22:16:09
95,717,004
0
0
null
null
null
null
UTF-8
Java
false
false
5,656
java
package csg.com.torneos; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import java.util.Calendar; import java.util.GregorianCalendar; public class index extends AppCompatActivity { DBResultados tabla_resultados; SQLiteDatabase db; String torneo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_index); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); tabla_resultados = new DBResultados(getApplicationContext(), "TORNEOS", null, 8); db = tabla_resultados.getReadableDatabase(); String[] args = new String[0]; Cursor c2 = db.rawQuery("SELECT max(torneo) FROM Partidos",args); //Nos aseguramos de que existe al menos un registro if (c2.moveToFirst()) { //Recorremos el cursor hasta que no haya más registros do { torneo = c2.getString(0); //String nombre = c.getString(1); } while(c2.moveToNext()); } Cursor c = db.rawQuery("SELECT torneo FROM Partidos GROUP BY torneo",args); //Nos aseguramos de que existe al menos un registro if (c.moveToFirst()) { //Recorremos el cursor hasta que no haya más registros do { String tagtorneo = c.getString(0); //crear boton - Editar Torneo LinearLayout layout = (LinearLayout) findViewById(R.id.activity_index); Button actualizarTorneo = new Button(this); actualizarTorneo.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); actualizarTorneo.setText("Actualizar torneo "+tagtorneo); //botonCrearTorneo.setId("id_boton_crear_torneo"); actualizarTorneo.setTag(tagtorneo); actualizarTorneo.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getApplicationContext(), resultados.class); String torneoaactualizar = (String) v.getTag(); i.putExtra("torneo",torneoaactualizar); startActivity(i); } }); //add button to the layout layout.addView(actualizarTorneo); //String nombre = c.getString(1); } while(c.moveToNext()); } //crear boton - CREAR TORNEO LinearLayout layout = (LinearLayout) findViewById(R.id.activity_index); Button botonCrearTorneo = new Button(this); botonCrearTorneo.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); botonCrearTorneo.setText("Pulse aquí para crear un torneo"); //botonCrearTorneo.setId("id_boton_crear_torneo"); botonCrearTorneo.setTag(torneo); botonCrearTorneo.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getApplicationContext(), elegir_equipos.class); String newTorneo = obtenerIdTorneoTipoFecha(); i.putExtra("torneo",newTorneo); startActivity(i); } }); //add button to the layout layout.addView(botonCrearTorneo); /* Button editarTorneo = (Button) findViewById(R.id.button); editarTorneo.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getApplicationContext(), resultados.class); i.putExtra("torneo", "2-2-2017-"); startActivity(i); } });*/ /* //String[] args = new String[]{id}, resultado = new String[5]; Cursor c = db.rawQuery("SELECT id, torneo FROM Partidos GRUP BY torneos;", null); if (c.moveToFirst()){ do { //resultado[0] = (c.getString(0)); }while(c.moveToNext()); } */ } private String obtenerIdTorneoTipoFecha(){ Calendar c = new GregorianCalendar(); String dia = Integer.toString(c.get(Calendar.DATE)); String mes = Integer.toString(c.get(Calendar.MONTH)); String annio = Integer.toString(c.get(Calendar.YEAR)); String hora = Integer.toString(c.get(Calendar.HOUR)); String minuto = Integer.toString(c.get(Calendar.MINUTE)); String segundo = Integer.toString(c.get(Calendar.SECOND)); //return dia+"-"+mes+"-"+annio+"-"+hora+"-"+minuto; return annio+"-"+mes+"-"+dia+"-"+hora+"-"+minuto+"-"+segundo; } }
[ "jaitor@jaitor.eltiempo.com.co" ]
jaitor@jaitor.eltiempo.com.co
000e7a933f6821261a5a73cbca68ff30cccf9f65
cfb8754cd667cdad0ed504a41b21c712c3eb34ed
/osbb-modules/osbb-dao-hibernate/src/main/java/org/osbb/domain/dao/impl/UserLoginDaoImpl.java
66ddd66d3cdb25b8f4f3e506fa7c990651157df4
[]
no_license
antonbakalets/training-org-osbb
5f4b13805ffe6802ed07445b599403b0e010ad40
4add4af592df787c40001bf0ec8fe6847c7ad191
refs/heads/master
2021-01-10T21:24:43.037268
2013-04-14T10:51:35
2013-04-14T10:51:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
950
java
package org.osbb.domain.dao.impl; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import org.osbb.domain.dao.api.UserLoginDao; import org.osbb.domain.model.shared.UserLogin; /** * * @author Anton Bakalets */ public class UserLoginDaoImpl extends AbstractSharedDao<Integer, UserLogin> implements UserLoginDao { public UserLoginDaoImpl() { super(UserLogin.class); } @Override public UserLogin loadUserLogin(String username) { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<UserLogin> cq = cb.createQuery(UserLogin.class); Root<UserLogin> root = cq.from(UserLogin.class); cq.select(root).where(cb.equal(cb.lower(root.<String>get("username")), username.toLowerCase())); return entityManager.createQuery(cq).getSingleResult(); } }
[ "Антон@192.168.0.100" ]
Антон@192.168.0.100
551152c9b833e1a7895f7f11009dbcfa6b727aa7
3635b3375180628170cdecdb9686517161cb6c0e
/sb-websocket/src/main/java/com/dewen/websocket/WebSocketConfig2.java
d77649202bb3bc9517073e35e7c0eb5c00340027
[]
no_license
sengeiou/springboot-study
ec737e5916e6da096a1a5c09a893bf7815769d21
320c9f147c54240fd18b40bf5c22502cc63fc0cc
refs/heads/main
2023-08-12T03:43:12.863038
2021-10-12T14:09:40
2021-10-12T14:09:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,893
java
//package com.dewen.websocket; // //import org.springframework.context.annotation.Configuration; //import org.springframework.messaging.simp.config.MessageBrokerRegistry; //import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; //import org.springframework.web.socket.config.annotation.StompEndpointRegistry; //import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; // // // ///* // * 通过@EnableWebSocketMessageBroker注解开启使用STOMP协议来传输基于代理(message broker)的消息, // * 这时控制器支持使用@MessageMapping // * 就像使用@RequestMapping一样 // */ //@Configuration //@EnableWebSocketMessageBroker //public class WebSocketConfig2 implements WebSocketMessageBrokerConfigurer { // // extends AbstractWebSocketMessageBrokerConfigurer // /** // * 将"/endpointWisely"路径注册为STOMP端点,这个路径与发送和接收消息的目的路径有所不同 // * 这是一个端点,客户端在订阅或发布消息到目的地址前,要连接该端点, // */ // // @Override // public void registerStompEndpoints(StompEndpointRegistry registry) {//注册STOMP协议的节点(endpoint),并映射的指定的URL //// registry.addEndpoint("/webServer").withSockJS(); // registry.addEndpoint("/api/websocket").setAllowedOrigins("*").withSockJS();//注册两个STOMP的endpoint,分别用于广播和点对点 // registry.addEndpoint("/logserver").withSockJS();//注册一个STOMP的endpoint,并指定使用SockJS协议 // //registry.addEndpoint("/hello").setAllowedOrigins("*").withSokJS(); // //这个和客户端创建连接时的url有关,其中setAllowedOrigins()方法表示允许连接的域名,withSockJS()方法表示支持以SockJS方式连接服务器。 // } // // // /** // * 配置了一个简单的消息代理,如果不重载,默认情况下会自动配置一个简单的内存消息代理,用来处理以"/topic"为前缀的消息。 // * 这里重载configureMessageBroker()方法, // * 消息代理将会处理前缀为"/topic"的消息。 // */ // @Override // public void configureMessageBroker(MessageBrokerRegistry registry) {//配置消息代理(Message Broker) // registry.enableSimpleBroker("/topic", "/user");//广播式应配置一个/topic消息代理topic用来广播,user用来实现p2p // } // /* PS // * registry.enableSimpleBroker("/topic", "/user");这句话表示在topic和user这两个域上可以向客户端发消息。 // * registry.setUserDestinationPrefix("/user");这句话表示给指定用户发送一对一的主题前缀是"/user"。 // * registry.setApplicationDestinationPrefixes("/app");这句话表示客户单向服务器端发送时的主题上面需要加"/app"作为前缀。 // */ // //}
[ "863572313@qq.com" ]
863572313@qq.com
4bcd280f7472d10f8b3c518764b489971fe29092
0c2db40c625bbd4c303ee31e7c50fbe7adfedce9
/LastRemaining_Solution.java
19e0a4304345f8fcef310b23e200ab2c6c64c1ae
[]
no_license
WangZhihaoCHN/PointToOffer_Programming
086a19524ed8e43a995ea4bf45ccf76c6a370957
1009f78107c0d31f12814a50d7fe05875f563a8e
refs/heads/master
2021-09-10T16:25:30.303857
2018-03-29T08:08:57
2018-03-29T08:08:57
95,619,527
0
0
null
null
null
null
UTF-8
Java
false
false
2,839
java
/* * * 题目描述: * 每年六一儿童节,牛客都会准备一些小礼物去看望孤儿院的小朋友,今年亦是如此。 * HF作为牛客的资深元老,自然也准备了一些小游戏。其中,有个游戏是这样的:首先,让 * 小朋友们围成一个大圈。然后,他随机指定一个数m,让编号为0的小朋友开始报数。每 * 次喊到m-1的那个小朋友要出列唱首歌,然后可以在礼品箱中任意的挑选礼物,并且不再 * 回到圈中,从他的下一个小朋友开始,继续0...m-1报数....这样下去....直到剩下最 * 后一个小朋友,可以不用表演,并且拿到牛客名贵的“名侦探柯南”典藏版(名额有限哦)。 * 请你试着想下,哪个小朋友会得到这份礼品呢?(注:小朋友的编号是从0到n-1) * * */ public class Test { /* * 算法思路: * 首先,我们定义一个关于n和m的方程f(n,m),表示每次在n个数字(0~n-1)中 * 删除第m个数字后,最终剩下的数字。 * 很明显,第一次删除的数字是(m-1)%n。方便起见,我们把第一个删除的数字 * 记为k,那么删除k之后的下一次计数,将会在k+1,k+2,…,n-1,0,…,k-1,即删除 * 完且计数起点变为删除数字的后一个。 * 接下来,是在剩余n-1个数中删除第m个,由于计数序列发生了改变,因此函数 * 需要记为f'(n-1,m)。显然,f(n,m)=f'(n-1,m)。 * 剩下的问题也是最关键的问题,就是k+1,k+2,…,n-1,0,…,k-1的序列如何映射 * 为0~n-2的序列,从而将问题简化为第一步的过程: * k+1 ——> 0 * k+2 ——> 1 * …… * n-1 ——> n-k-2 * 0 ——> n-k-1 * 1 ——> n-k * …… * k-1 ——> n-2 * 综上,我们定义p为数字序列k+1,k+2,…,n-1,0,…,k-1到新序列0~n-2的映射, * 则p(x)=(x-k-1)%n,其中x为映射前的数字,p(x)为x在新序列中的数字。该映射 * 的逆映射是q(y)=(y+k+1)%n。 * 因此,f(n,m)=f'(n-1,m)=q[f(n-1,m)]=[f(n-1,m)+k+1]%n,其中 * k=(m-1)%n已知,所以f'(n-1,m)=[f(n-1,m)+(m-1)%n+1]%n=[f(n-1,m)+m]%n。 * * 综上所述,最终得到了一个递归公式。要得到n个数序列中剩下的数字,只需要 * 得到n-1个数字序列中最后剩下的数字,并以此类推。当n=1是,也就是序列只有一个 * 数字(下标为0)时,就找到了最终一个数。 * */ public static int LastRemaining_Solution(int n, int m) { if(n <= 0 || m <= 0) return -1; if(n == 1) return 0; return (LastRemaining_Solution(n-1,m)+m)%n; } public static void main(String args[]){ System.out.println(LastRemaining_Solution(5,3)); } }
[ "wangzhihao.chn@gmail.com" ]
wangzhihao.chn@gmail.com
1a704e3e9079c4a34359a4752776ff1a7944f0e4
23b333449524887594530f73c0079ce60cb8eefb
/JavaModule/src/main/java/com/example/syntax/TypeErasureandBridgeMethods.java
aca859cfbbfb188cd24e0508badf43e87e0a70d4
[]
no_license
benbendaisy/CommunicationCodes
9deb371095f5d67e260030d3d8abf211c90e7642
444cc502ef26810b46115797f2e26ab305a4ebdf
refs/heads/master
2023-08-09T21:46:58.691987
2023-07-20T05:11:39
2023-07-20T05:11:39
27,856,438
0
0
null
null
null
null
UTF-8
Java
false
false
1,524
java
package com.example.syntax; import java.util.ArrayList; /** * Created by pzhong1 on 4/29/15. * * refer to https://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html */ public class TypeErasureandBridgeMethods { public class Node<T> { public T data; public Node(T data) { this.data = data; } public void setData(T data) { System.out.println("Node.setData"); this.data = data; } } public class MyNode extends Node<Integer> { public MyNode(Integer data) { super(data); } public void setData(Integer data) { System.out.println("MyNode.setData"); super.setData(data); } } //refer to http://www.programcreek.com/2011/12/java-type-erasure-mechanism-example/ //use ? instead Object public static void main(String args[]) { ArrayList<Object> al = new ArrayList<Object>(); al.add("abc"); test(al); Integer[] array = {1, 2, 3, 4, 2, 3}; System.out.println(count(array, 2)); } public static void test(ArrayList<?> al){ for(Object e: al){//no matter what type, it will be Object System.out.println(e); // in this method, because we don't know what type ? is, we can not add anything to al. } } public static <T extends Integer> int count(T[] anArray, T elem) { int cnt = 0; for (T e : anArray) if (e.equals(elem)) ++cnt; return cnt; } }
[ "pzhong@walmartlabs.com" ]
pzhong@walmartlabs.com
1abc65e9a38eea766ebd3b7a53d12577fc4053f7
384d5f2858142969e62379ca4b7aaa29935ee0ec
/godsoft.com351/src/main/java/godsoft/com/sub/service/Sub0104VO.java
40bbb672e18f2fa2086924f6a5fb8e973e126eb4
[]
no_license
LeeBaekHaeng/godsoft2016
a2a848fe93941b638a5c6e1891904239c5644af1
0591946ad8b4bbc8a07b9aa614bca8bff2727f3b
refs/heads/master
2020-07-03T19:10:41.576309
2018-12-22T21:17:44
2018-12-22T21:17:44
66,688,625
0
0
null
null
null
null
UTF-8
Java
false
false
1,121
java
package godsoft.com.sub.service; import egovframework.com.cmm.ComDefaultVO; /** * 서브0104 VO * * @author 이백행&lt;dlqorgod@naver.com&gt; * */ @SuppressWarnings("serial") public class Sub0104VO extends ComDefaultVO { /** * COMTCCMMNDETAILCODE.CODE_ID 공통상세코드.코드ID */ private String codeId; /** * COMTCCMMNDETAILCODE.USE_AT 공통상세코드.사용여부 */ private String useAt; /** * COMTCCMMNDETAILCODE.CODE_ID 공통상세코드.코드ID 값읽기 * * @return */ public String getCodeId() { return codeId; } /** * COMTCCMMNDETAILCODE.CODE_ID 공통상세코드.코드ID 값설정 * * @param codeId */ public void setCodeId(String codeId) { this.codeId = codeId; } /** * COMTCCMMNDETAILCODE.USE_AT 공통상세코드.사용여부 값읽기 * * @return */ public String getUseAt() { return useAt; } /** * COMTCCMMNDETAILCODE.USE_AT 공통상세코드.사용여부 값설정 * * @param useAt */ public void setUseAt(String useAt) { this.useAt = useAt; } }
[ "dlqorgod@naver.com" ]
dlqorgod@naver.com
36f4fbcde23440e62aff8f150820ec98a7febe0e
38a2348c76153d4bc3da367f5a4d80118a09a27e
/app/src/main/java/com/example/cherish/salehouse_kotlin/activity/customView/ViewTouchActivity.java
31b62480e7d3e7d6e0eb1c51f4cdb7a94b9c985b
[]
no_license
chuxuecentaline/AdvanceAndroid
0cbf45e62b915e51be9b60c7606d327174713ecc
0245d6b28becd9392bf57dbd7d15206047b11f5a
refs/heads/master
2020-04-11T06:23:36.453129
2019-02-25T01:32:03
2019-02-25T01:32:03
161,579,476
0
0
null
null
null
null
UTF-8
Java
false
false
6,762
java
package com.example.cherish.salehouse_kotlin.activity.customView; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.Toast; import com.example.baselibrary.base.BaseActivity; import com.example.baselibrary.toolbar.normal.NormalNavigationBar; import com.example.cherish.salehouse_kotlin.R; import com.example.cherish.salehouse_kotlin.view.ViewGroupTouch; /** * View TouchEvent 事件 源码分析 */ public class ViewTouchActivity extends BaseActivity { private View viewTouch; @Override public int getContentViewId() { return R.layout.activity_view_touch; } @Override protected void findViews() { new NormalNavigationBar.Build(this).setTitle("View TouchEvent 事件 源码分析").setRightMenu(R.menu .navigation_tab).create(); viewTouch = findViewById(R.id.viewTouch); } @Override protected void init(Bundle savedInstanceState) { final ViewGroupTouch viewGroupTouch = findViewById(R.id.viewGroupTouch); viewGroupTouch.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { System.out.println("viewGroup --->onTouch" + event.getAction()); return false; } }); /* viewGroupTouch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { System.out.println("viewGroup --->onClick"); } });*/ viewTouch.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { System.out.println("view --->onTouch" + event.getAction()); return false; } }); viewTouch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { System.out.println("view --->onClick"); } }); } /** * 分析 view 源码流程 dispatchTouchEvent()===>onTouch()--->onTouchEvent()===>performClick===>onClick() * * 1.默认情况下 :down dispatchTouchEvent()->onTouch()->onTouchEvent() * move dispatchTouchEvent()->onTouch-()>onTouchEvent() * up dispatchTouchEvent()->onTouch()->onTouchEvent()->onClick() * * 2.onTouch 返回true 已消费事件 * down dispatchTouchEvent()->onTouch() * move dispatchTouchEvent()->onTouch() * up dispatchTouchEvent()->onTouch() * * 3.onTouch false onTouchEvent true * down dispatchTouchEvent()->onTouch()->onTouchEvent() * move dispatchTouchEvent()->onTouch(()->onTouchEvent() * up dispatchTouchEvent()->onTouch(()->onTouchEvent() * 4.如果没有 onClick 事件 onTouch false onTouchEvent false 只会执行down 事件 * down dispatchTouchEvent()->onTouch()->onTouchEvent() */ /** * 分析 viewGroup 源码流程 dispatchTouchEvent()--->onInterceptTouchEvent===>onTouch() * --->onTouchEvent()===>performClick===>onClick() * 触摸view 事件 * 1.默认情况下 :子view 无onclick * view down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->view * dispatchTouchEvent()->view onTouch()->view onTouchEvent()->viewGroup onTouch()->ViewGroup onTouchEvent() * viewGroup * dispatchTouchEvent()->ViewGroup onInterceptTouchEvent() * ->ViewGroup onTouch()->ViewGroup onTouchEvent() * * * * 2 viewGroup.onInterceptTouchEvent 返回true viewGroup 拦截事件 * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent-> * ViewGroup onTouch-> ViewGroup onTouchEvent * * 3.viewGroup onTouch true * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent-> * ViewGroup onTouch * move ViewGroup dispatchTouchEvent->ViewGroup onTouch * up ViewGroup dispatchTouchEvent->ViewGroup onTouch * * 4.viewGroup onTouchEvent true 或 子view 没有消费事件 * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent-> * ViewGroup onTouch->ViewGroup onTouchEvent * move ViewGroup dispatchTouchEvent->ViewGroup onTouch->ViewGroup onTouchEvent * up ViewGroup dispatchTouchEvent->ViewGroup onTouch->ViewGroup onTouchEvent * * 5.view onTouch true 子view /or onTouchEvent true * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->view * dispatchTouchEvent()->view onTouch() or ->view onTouchEvent() * move ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->view * dispatchTouchEvent()->view onTouch()or ->view onTouchEvent() * up ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->view * dispatchTouchEvent()->view onTouch()or ->view onTouchEvent() * Group: * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->viewGroup onTouch() * ->ViewGroup onTouchEvent() * move ViewGroup dispatchTouchEvent-> ViewGroup * onTouch()->ViewGroup onTouchEvent() * up ViewGroup dispatchTouchEvent-> ViewGroup * onTouch()->ViewGroup onTouchEvent()->viewGroup onClick * * * 6.如果没有view onClick 事件 onTouch false onTouchEvent false 只会执行down 事件 * down ViewGroup dispatchTouchEvent-> ViewGroup onInterceptTouchEvent->view * dispatchTouchEvent()->view onTouch()->view onTouchEvent-> ViewGroup onTouch()->ViewGroup onTouchEvent() * move ViewGroup dispatchTouchEvent->ViewGroup onTouch()->ViewGroup onTouchEvent() * up ViewGroup dispatchTouchEvent-> ViewGroup onTouch()->ViewGroup onTouchEvent()->viewGroup onClick * * * 8.如果viewGroup 有onClick 点击事件 其他均为默认值 * down ViewGroup dispatchTouchEvent()->ViewGroup onInterceptTouchEvent() * ->ViewGroup onTouch()->ViewGroup onTouchEvent() * * */ }
[ "zxl@hanyu365.com.cn" ]
zxl@hanyu365.com.cn
da8ee31f67ac310234756454e91dacd6ef1953d0
d9b4ebb5e14dc44a9c2ff41aae709f70fe6075dd
/com/market/service/TicketService.java
3a33e0e1b6f2e1830f11e9ba5645fc82c0a53f15
[]
no_license
cn-gj/gj-supermarket
9cdbc0bd43cb2a7ad62710bfbbed75c6c1e29bc0
572964baa1efd6d7eb4c0e2c4d0a119cbc387be9
refs/heads/master
2022-08-22T00:39:19.262614
2019-07-16T16:22:27
2019-07-16T16:22:34
196,491,471
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package com.market.service; import com.market.entity.Ticket; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 服务类 * </p> * * @author superMan * @since 2019-07-12 */ public interface TicketService extends IService<Ticket> { }
[ "2378545787@qq.com" ]
2378545787@qq.com
7141d69f64f86a3f1d9f03ba5d1d48dbdebfb87d
c2d21f3530117c6bb62bde99e7f64e54010b677a
/app/src/main/java/com/example/administrator/myapplication/MainActivity.java
f373608b3664ea2960c4ee9240452437bdae93dd
[]
no_license
SValence/ASWorkspaceTest
bf1e522d2cb34e6960d62dd3c4f7794fccdbf6bb
bcd3f13682d1928d2cee550d751413c6b60b50ad
refs/heads/master
2020-03-24T17:47:26.059621
2018-08-02T01:01:44
2018-08-02T01:01:44
142,871,687
1
0
null
null
null
null
UTF-8
Java
false
false
3,726
java
package com.example.administrator.myapplication; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.example.administrator.base.BaseActivity; import static com.example.administrator.myapplication.ActivityFileSystem.getExtSDCardPath; public class MainActivity extends BaseActivity { private TextView exMem, inMem; private static final String TAG = "MainActivity"; @SuppressLint("WrongConstant") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.mContext = getApplicationContext(); exMem = findViewById(R.id.externalMem); inMem = findViewById(R.id.internalMem); boolean inBoo = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); inMem.setText((inBoo ? "存在内置内存, 路径为: " + Environment.getExternalStorageDirectory().getAbsolutePath() : "不存在内置内存")); exMem.setText((TextUtils.isEmpty(getExtSDCardPath()) ? "不存在外置内存卡" : "存在外置内存卡, 路径为: " + getExtSDCardPath())); Toast.makeText(this.mContext, "从父类中继承的mContext,还是需要重新赋值才能使用", Toast.LENGTH_SHORT).show(); } @Override public void onResume() { super.onResume(); } @Override public void onDestroy() { super.onDestroy(); } public void onKeyBoardClick(View view) { Intent intent = new Intent(MainActivity.this, ActivityKeyboard.class); startActivity(intent); } public void onFileClick(View view) { Intent intent = new Intent(MainActivity.this, ActivityFileSystem.class); startActivity(intent); } public void onSafeKeyBoardClick(View view) { Intent intent = new Intent(MainActivity.this, ActivitySafeKeyboard.class); startActivity(intent); } public void onSafeKeyBatteryClick(View view) { Intent intent = new Intent(MainActivity.this, ActivityBattery.class); startActivity(intent); } public void onBottomAdd(View view) { Intent intent = new Intent(MainActivity.this, ActivityAddBottom.class); startActivity(intent); } public void onShutDownClick(View view) { Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS); startActivity(intent); } public void onRelativeClick(View view) { Intent intent = new Intent(MainActivity.this, ActivityRelativeTest.class); startActivity(intent); } public void onCircleImageClick(View view) { Intent intent = new Intent(MainActivity.this, ActivityCircleImage.class); startActivity(intent); } private long exitTime = 0; /** * 监听返回--是否退出程序 */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.i(TAG, String.format("keyDown:%d", keyCode)); if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { if ((System.currentTimeMillis() - exitTime) > 2000) { Toast.makeText(getApplicationContext(), "再点击一次退出程序", Toast.LENGTH_SHORT).show(); exitTime = System.currentTimeMillis(); } else { finish(); } return true; } return super.onKeyDown(keyCode, event); } }
[ "1316855120@qq.com" ]
1316855120@qq.com
75eae869760bced273c411c9c606c82889010e71
9ac59b4a07159be67aa14be01d0f062011351857
/05USACO/USACO.java
0ee1a6fb8997361e684e8d679589496ac6d7de62
[]
no_license
EdMaxPrime/MKS22X
9260307dc2e6fd567db298dac4e264c8f31bdaba
1a29adffd8552c705eb76e8d66b347d271e68224
refs/heads/master
2021-01-25T05:45:19.130828
2017-06-04T13:26:04
2017-06-04T13:26:04
80,681,304
0
0
null
null
null
null
UTF-8
Java
false
false
5,488
java
/* there are 9 cows there are R rows of spots and C of spots 1st number is R, 2nd numberr is C, 3rd number is D, inches by stomping hit the highest number in the 3x3, and then press by D N instructions E is final sea level find V(volume) first line is R C E N next lines are array of elevations next lines are instructions calculate V with inches (one square six by six foot) */ import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class USACO { private int[][] farm; private int sealevel; public static void main (String[] args) throws FileNotFoundException { //testing stuff testBronze(); testSilver(); } public static void testBronze() throws FileNotFoundException { USACO c = new USACO(); Scanner answer; for(int i = 1; i < 10; i++) { int myAnswer = c.bronze("makelake/makelake."+i+".in"); answer = new Scanner(new File("makelake/makelake."+i+".out")); int realAnswer = answer.nextInt(); System.out.printf("[%d] Got %d for %d which is "+(myAnswer==realAnswer)+"%n", i, myAnswer, realAnswer); } } public static void testSilver() throws FileNotFoundException { USACO e = new USACO(); Scanner answer; for(int i = 1; i <= 10; i++) { int myAnswer = e.silver("ctravel/ctravel."+i+".in"); answer = new Scanner(new File("ctravel/ctravel."+i+".out")); int realAnswer = answer.nextInt(); System.out.printf("[%d] Got %d for %d which is "+(myAnswer==realAnswer)+"%n", i, myAnswer, realAnswer); } } public int bronze(String filename)throws FileNotFoundException{ Scanner in = new Scanner(new File(filename)); int rows = in.nextInt(), cols = in.nextInt(); farm = new int[rows][cols]; sealevel = in.nextInt(); int numCommands = in.nextInt(); int r = 0, c = 0; int[][] instructions = new int[numCommands][3]; while(in.hasNextInt()) { if(r < rows) { farm[r][c] = in.nextInt(); c++; if(c >= cols) {r++; c = 0;} } else { instructions[r-rows] = new int[] { in.nextInt(), in.nextInt(), in.nextInt() }; stomp(instructions[r-rows][0]-1, instructions[r-rows][1]-1, instructions[r-rows][2]); r++; } } return computeVolume(); } public void parray(int[][] a){ String retstr = ""; for (int i = 0; i < a.length; i++){ for (int j = 0; j < a[0].length; j++){ retstr+= (a[i][j] + " "); } retstr+="\n"; } System.out.println(retstr); } public void stomp(int row, int col, int amount) { int highest = farm[row][col]; for (int i = row; i < row+3; i++){ for (int j = col; j < col+3; j++){ if (farm[i][j] > highest){highest = farm[i][j];} } } if (highest - amount < 0){highest = amount;} for (int i = row; i < row+3; i++){ for (int j = col; j < col+3; j++){ if (farm[i][j]>highest-amount){farm[i][j] = highest-amount;} } } } public int computeVolume(){ int howmuchwater = 0; for (int i = 0; i < farm.length; i++){ for (int j = 0; j < farm[0].length; j++){ if(sealevel > farm[i][j]){ howmuchwater += (sealevel - farm[i][j])*5184; } } } return howmuchwater; } /*~~~SILVER PROBLEM~~~*/ public int silver(String filename) throws FileNotFoundException { Scanner in = new Scanner(new File(filename)); int rows = in.nextInt(), cols = in.nextInt(), time = in.nextInt(); int[][] pasture = new int[rows][cols]; in.nextLine(); //got to the next line int row = 0; while(row < rows) { String line = in.nextLine(); for(int c = 0; c < cols; c++) { if(line.charAt(c) == '.') pasture[row][c] = 0; //free else if(line.charAt(c) == '*') pasture[row][c] = -1; //tree } row++; } int startRow = in.nextInt()-1, startCol = in.nextInt()-1, endRow = in.nextInt()-1, endCol = in.nextInt()-1; pasture[startRow][startCol] = 1; for(int step = 0; step < time; step++) { moveCow(pasture); } return pasture[endRow][endCol]; } private void moveCow(int[][] pasture) { String newValues = ""; for(int r = 0; r < pasture.length; r++) { for(int c = 0; c < pasture[r].length; c++) { if(pasture[r][c] == 0) { //make it sum of surrounding squares (ignore trees) //add it to string newValues += " " + sum4Neighbors(r, c, pasture); } else if(pasture[r][c] > 0) { //add 0 to string newValues += " 0"; } else { newValues += " -1"; } } newValues += "\n"; } Scanner scanner = new Scanner(newValues); for(int r = 0; r < pasture.length; r++) { for(int c = 0; c < pasture[r].length; c++) { if(scanner.hasNextInt()) pasture[r][c] = scanner.nextInt(); } } } /** Returns the sum of the adjacent four naighbors of a cell in a 2d array, provided that they are all positive integers. @param row the row of the middle cell @param col the column of the middle cell @param data the array of integers @return the nonnegative sum of the four adjacent positive integers. */ private int sum4Neighbors(int row, int col, int[][] data) { int sum = 0; if(row - 1 >= 0 && data[row-1][col] > -1) //above sum += data[row-1][col]; if(col+1 < data[row].length && data[row][col+1] > -1) //left sum += data[row][col+1]; if(row+1 < data.length && data[row+1][col] > -1) //below sum += data[row+1][col]; if(col-1 >= 0 && data[row][col-1] > -1) //right sum += data[row][col-1]; return sum; } }
[ "max.zlotskiy@gmail.com" ]
max.zlotskiy@gmail.com
2e48e6bff8bf0589c65b26fd280171e33ddef305
3f96de61afabf9a5a9d001ddd0296534d17684c4
/app/src/main/java/org/wower/ad_5g_manage/utils/Post.java
71e2c5f36f7b1b68dc175a8b76e7a18df451f4ae
[]
no_license
Humengchao/AD_5G_Manage
ed57286ba9ef4202f62417277e8d49e811b18ade
bc2fbeb53cccd52014a4e8549077ad13897842c0
refs/heads/master
2023-01-09T08:49:35.454713
2020-11-13T09:34:47
2020-11-13T09:34:47
306,797,040
0
0
null
null
null
null
UTF-8
Java
false
false
6,025
java
package org.wower.ad_5g_manage.utils; import android.util.Log; import com.google.gson.Gson; import org.wower.ad_5g_manage.model.User; import org.wower.ad_5g_manage.model.Video; import java.io.File; import java.io.IOException; import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; // 将数据通过json打包,然后post发送到服务器 public class Post { private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); // 服务器地址 // private static final String URL = "http://ad.wqnmd.net:8080"; private static final String URL="http://192.168.3.3:8080"; public static Response sendPost(String url, String json) { RequestBody body = RequestBody.create(JSON, json); OkHttpClient okHttpClient = new OkHttpClient(); // 创建个请求对象 Request request = new Request.Builder().url(url).post(body).build(); // 发送请求获取响应 try { Response response = okHttpClient.newCall(request).execute(); return response; } catch (IOException e) { e.printStackTrace(); } return null; } /** * 发送注册的信息给服务器,注册成功服务器返回该用户的视频列表(所有项都是空的),失败(已经有这个账号了)返回error * @param user * @return */ public static String register(User user) { Gson gson = new Gson(); String userJson = gson.toJson(user); Response response = sendPost(URL + "/register", userJson); String res = null; if (response.isSuccessful()) { // 当注册的请求成功的发送给服务器 try { res = response.body().string(); } catch (IOException e) { e.printStackTrace(); } } return res; } /** * 发送登录信息给服务器,成功服务器返回用户的视频list的json的string,失败返回passworderror字段 * 具体的是否登录成功由activity自己判断 * @param user */ public static String login(User user) { Gson gson = new Gson(); String userJson = gson.toJson(user); Response response = sendPost(URL + "/login", userJson); String res = null; try { res = response.body().string(); } catch (IOException e) { e.printStackTrace(); } return res; } /** * 发送删除视频的请求给服务器,成功删除服务器返回“success”,删除失败返回“error” * @param video * @return */ public static String deleteVideo(Video video) { Gson gson = new Gson(); String videoJson = gson.toJson(video); Response response = sendPost(URL + "/deletevideo", videoJson); String isSuccess = null; try { isSuccess = response.body().string(); } catch (IOException e) { e.printStackTrace(); } return isSuccess; } /** * 上传视频给服务器 * @param filePath 视频在本地的path * @param videoName 视频的名称,到时候存储到服务器端数据库中 * @return */ public static String upload(String filePath, String videoName, String level, String uname) throws IOException { String[] str = filePath.split("/"); String filename = str[str.length - 1]; OkHttpClient client = new OkHttpClient(); RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("uname", uname) .addFormDataPart("video_name", videoName) .addFormDataPart("level", level) .addFormDataPart("time", "false") // 判断是否上传了时间 .addFormDataPart("file", filename, RequestBody.create(MediaType.parse("multipart/form-data"), new File(filePath))) .build(); Request request = new Request.Builder().url(URL + "/videoupload").post(requestBody).build(); Response response = null; String res = null; try { response = client.newCall(request).execute(); res = response.body().string(); } catch (IOException e) { e.printStackTrace(); } return res; } /** * 重载,多了个时和分的变量 * @param filePath * @param videoName * @param level * @param uname * @param hour * @param minute * @return * @throws IOException */ public static String upload(String filePath, String videoName, String level, String uname, String hour, String minute) throws IOException { String[] str = filePath.split("/"); String filename = str[str.length - 1]; OkHttpClient client = new OkHttpClient(); RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("uname", uname) .addFormDataPart("video_name", videoName) .addFormDataPart("level", level) .addFormDataPart("time", "true") // 判断是否上传了时间 .addFormDataPart("hour",hour) .addFormDataPart("minute", minute) .addFormDataPart("file", filename, RequestBody.create(MediaType.parse("multipart/form-data"), new File(filePath))) .build(); Request request = new Request.Builder().url(URL + "/videoupload").post(requestBody).build(); Response response = null; String res = null; try { response = client.newCall(request).execute(); res = response.body().string(); } catch (IOException e) { e.printStackTrace(); } return res; } }
[ "810244965@qq.com" ]
810244965@qq.com
4a89dcbc64d3328bd599e25ac278955e179bd0da
b18ea8a93ede6ca4b0237bf0c4104eed318b0279
/stream-list/src/main/java/com/costa/luiz/stream_and_list/ClientResource.java
5dbbb334b42c5d7d62380fd9a5518bc7c790362d
[ "Apache-2.0" ]
permissive
shreenu1995/16-bits-spring
a3a86f96b98ef99228e6e1354c71d609e0f444de
d6c183310f2b528a57db0491623586e26ccd8e4a
refs/heads/main
2023-07-24T17:21:13.121719
2021-09-03T21:27:52
2021-09-03T21:27:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.costa.luiz.stream_and_list; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.stream.Stream; @RestController @RequestMapping("/api/v1/client") public class ClientResource { @Autowired private final ClientService service; public ClientResource(ClientService service) { this.service = service; } @GetMapping("/list") ResponseEntity<Iterable<Client>> findAll() { return new ResponseEntity(service.findAll(), HttpStatus.OK); } @GetMapping("/stream") Stream<Client> findAllInStreamMode() { return service.readAll(); } }
[ "luiz.gustavo.costa82@gmail.com" ]
luiz.gustavo.costa82@gmail.com
9af656ba0fa489681d9d228a4dd11db3653bee22
521c44f3e918f35e86248029bbcbd83380872f8a
/5. Data Structures & Algorithms/HashTables/src/com/HashTables/TheHashTable.java
4784ab48b48a7ac98b291dc4539a7af36a909723
[]
no_license
vivekworks/learning-to-code
32ef55bb9d8632e95bc064564cb67817159810ef
19950446724bae7582e04d1ab7c79f2eb07739ab
refs/heads/master
2020-04-10T14:09:46.414440
2019-03-26T18:46:08
2019-03-26T18:46:08
161,069,625
0
0
null
null
null
null
UTF-8
Java
false
false
5,441
java
package com.HashTables; import java.util.ArrayList; import java.util.Arrays; public class TheHashTable { private Integer[] theArray = {10,34,56,776,908,100,298,765,22,87,364,492,411,333,900}; private int arraySize; private int[] theHashArray; private TheHashTable(int size){ this.arraySize=size; //this.theArray=new int[this.arraySize]; this.theHashArray=new int[this.arraySize]; Arrays.fill(this.theHashArray,-1); } private void generateArray(){ for(int i=0;i<10;i++) theArray[i]=(int)(Math.random()*10); for(int i=10;i<arraySize;i++) theArray[i]=(int)(Math.random()*10)+10; } private void display(int[] theArray){ for (int i = 0; i < theArray.length; i++) { int length = String.valueOf(theArray[i]).length() - String.valueOf(i).length(); String space = ""; if (length == 1) space = " "; else if (length == 2) space = " "; System.out.print(i + space + " | "); } System.out.println(); //System.out.println("------------------------------------------------------------------------------------"); for (int i = 0; i < theArray.length; i++) System.out.print(theArray[i] + " | "); System.out.println(); //System.out.println("------------------------------------------------------------------------------------"); } private void display(Integer[] theArray){ for (int i = 0; i < theArray.length; i++) { int length = String.valueOf(theArray[i]).length() - String.valueOf(i).length(); String space = ""; if (length == 1) space = " "; else if (length == 2) space = " "; System.out.print(i + space + " | "); } System.out.println(); //System.out.println("------------------------------------------------------------------------------------"); for (int i = 0; i < theArray.length; i++) System.out.print(theArray[i] + " | "); System.out.println(); //System.out.println("------------------------------------------------------------------------------------"); } private void hashFunction(){ for(int i=0;i<theArray.length;i++){ int arrayIndex = theArray[i]%arraySize; while(theHashArray[arrayIndex] != -1){ ++arrayIndex; arrayIndex%=(arraySize); } theHashArray[arrayIndex]=theArray[i]; } } private void doubleHashFunction(){ for(int i=0;i<theArray.length;i++){ int arrayIndex = theArray[i]%arraySize; while(theHashArray[arrayIndex] != -1){ arrayIndex+=5; arrayIndex%=(arraySize); } theHashArray[arrayIndex]=theArray[i]; } } private String findByKey(int key){ int arrayIndex = key%arraySize; int count=0; while(count <arraySize){ if(theHashArray[arrayIndex] == key){ return "In the index "+arrayIndex+", the value is "+key; } ++arrayIndex; arrayIndex%=arraySize; count++; } return null; } private String findByKeyDoubleHash(int key){ int arrayIndex = key%arraySize; int count=0; while(count <arraySize){ if(theHashArray[arrayIndex] == key){ return "In the index "+arrayIndex+", the value is "+key; } arrayIndex+=5; arrayIndex%=arraySize; count++; } return null; } private boolean isPrime(int number){ if(number % 2 == 0) return false; else{ for(int i=3;i<number;i+=2) return number%i != 0; } return true; } private int getNextPrime(int minimumNumber){ for(int i = minimumNumber;true;++i){ if(isPrime(i)) return i; } } private void increaseArraySize(int minimumArraySize){ arraySize = getNextPrime(minimumArraySize); System.out.println(arraySize); theHashArray=new int[arraySize]; Arrays.fill(theHashArray,-1); theArray = moveOldArray(); System.out.println(Arrays.toString(theArray)); hashFunction(); } private Integer[] moveOldArray(){ ArrayList<Integer> list = new ArrayList<>(); for(int value :theArray) list.add(value); return list.toArray(new Integer[list.size()]); } public static void main(String[] args){ TheHashTable hashTable = new TheHashTable(15); hashTable.display(hashTable.theArray); hashTable.hashFunction(); hashTable.display(hashTable.theHashArray); System.out.println(hashTable.findByKey(333)); System.out.println(hashTable.isPrime(45)); System.out.println(hashTable.getNextPrime(80)); hashTable.increaseArraySize(30); hashTable.display(hashTable.theHashArray); Arrays.fill(hashTable.theHashArray,-1); hashTable.doubleHashFunction(); hashTable.display(hashTable.theHashArray); System.out.println(hashTable.findByKeyDoubleHash(298)); } }
[ "vivekts90@gmail.com" ]
vivekts90@gmail.com
5a1b67fe86007d01adf0685f33bd8973f0d0f355
f10bdb3900ef1ee5ec646ad4ce3426e6a1feb09d
/app/src/main/java/com/example/quizzer/Activities/MainActivity.java
043d3da4d0342a161f6027f98002bb0f07dfc047
[]
no_license
Poojan29/QuizApp
b333b8d960a81f2267da5b565729c09a0c1e7cca
21f084b62fc0f58074e7b0c74aa2c8ebb37f62cb
refs/heads/master
2023-04-18T05:04:06.650065
2021-05-06T06:42:58
2021-05-06T06:42:58
298,760,009
0
0
null
null
null
null
UTF-8
Java
false
false
4,746
java
package com.example.quizzer.Activities; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.quizzer.Adapter.LanguageAdapter; import com.example.quizzer.Model.LanguageModel; import com.example.quizzer.R; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.firestore.FirebaseFirestore; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private FirebaseFirestore firebaseFirestore; private FirebaseAuth fAuth; String userID; private LanguageAdapter languageAdapter; private RecyclerView recyclerView; private ProgressBar progressBar; private DatabaseReference databaseReference; private ArrayList<LanguageModel> languageModels; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); firebaseFirestore = FirebaseFirestore.getInstance(); fAuth = FirebaseAuth.getInstance(); userID = fAuth.getCurrentUser().getUid(); recyclerView = findViewById(R.id.recyclerview); progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(View.VISIBLE); languageModels = new ArrayList<>(); databaseReference = FirebaseDatabase.getInstance().getReference().child("Languages"); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setHasFixedSize(true); databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { for (DataSnapshot dataSnapshot : snapshot.getChildren()) { String name = dataSnapshot.child("name").getValue(String.class); LanguageModel languageModel = new LanguageModel(name); languageModels.add(languageModel); } languageAdapter = new LanguageAdapter(MainActivity.this, languageModels); recyclerView.setAdapter(languageAdapter); progressBar.setVisibility(View.GONE); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_item, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.item1: startActivity(new Intent(getApplicationContext(), Profile.class)); return true; case R.id.item2: Toast.makeText(this, "Coming soon...", Toast.LENGTH_SHORT).show(); return true; case R.id.item3: fAuth.signOut(); startActivity(new Intent(this, Login.class)); finish(); } return super.onOptionsItemSelected(item); } public void onBackPressed() { AlertDialog.Builder alert = new AlertDialog.Builder(this) .setMessage("Are you sure to exit?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent a = new Intent(Intent.ACTION_MAIN); a.addCategory(Intent.CATEGORY_HOME); a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(a); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alert.show(); } }
[ "pra.poojan2000@gmail.com" ]
pra.poojan2000@gmail.com
1514550141b0225de10d4543a8981b9c362b32c5
dedbb2cc225583ccd78866ea4772b4147699a7dd
/BSTDistance.java
30dde52bcb73bf17f713ca7f74018cf5a8bc9746
[]
no_license
umeshravuru/hackerrank
dc2939c709282c3b283fe7d84892bfc284cf1b84
318c768f988f4fde147b5ca90e9cfdbfc41cac9b
refs/heads/master
2020-05-22T07:03:33.021100
2019-09-25T03:13:13
2019-09-25T03:13:13
60,627,482
3
4
null
null
null
null
UTF-8
Java
false
false
3,392
java
package webScrap.org.webScrap; import java.util.Scanner; public class BSTDistance { public static Node root; public BSTDistance(){ this.root = null; } public static void main(String[] args) { // TODO Auto-generated method stub int[] values = {5,6,3,1,2,4}; int n = values.length; int node1 = 2; int node2 = 4; System.out.println(bstDistance(values, n, node1, node2)); } public void display(Node root){ if(root!=null){ display(root.left); System.out.print(" " + root.data); display(root.right); } } public static int bstDistance(int[] values, int n, int node1, int node2) { int ans = 0; BSTDistance b = new BSTDistance(); for(int i =0;i<n;i++) { b.insert(values[i]); } // b.display(b.root); if(find(node1) && find(node2)) { int common_ancestor = getLeastCommonAncestor(b.root, node1, node2); int depth_of_node1 = getDepth(node1); int depth_of_node2 = getDepth(node2); int depth_of_common_ancestor = getDepth(common_ancestor); // System.out.println(getLeastCommonAncestor(b.root, 1, 6)); // System.out.println(getDepth(1)); // System.out.println(b.root.data); // int aa = getDepth(root, node1); // System.out.println(find(7)); // System.out.println(depth_of_node1); // System.out.println(depth_of_node2); // System.out.println(depth_of_common_ancestor); return depth_of_node1 + depth_of_node2 - (2*depth_of_common_ancestor); }else return -1; } // public static int getDepth(Node curr, Node target) { // if (curr == null) // return -1; // if (curr == target) // return 0; // int left = getDepth(curr.left, target); // int right = getDepth(curr.right, target); // if (left == -1 && right == -1) // return -1; // return left == -1? right + 1: left + 1; // // } class Node{ int data; Node left; Node right; public Node(int data){ this.data = data; left = null; right = null; } } public void insert(int id){ Node newNode = new Node(id); if(root==null){ root = newNode; return; } Node current = root; Node parent = null; while(true){ parent = current; if(id<current.data){ current = current.left; if(current==null){ parent.left = newNode; return; } }else{ current = current.right; if(current==null){ parent.right = newNode; return; } } } } public static boolean find(int id) { Node current = root; System.out.println(current.data); while (current != null) { if (current.data == id) { return true; } else if (current.data > id) { current = current.left; } else { current = current.right; } } return false; } public static int getLeastCommonAncestor(Node current,int node1,int node2) { if(current ==null) return -1; if(current.data == node1 || current.data == node2) return current.data; int left = getLeastCommonAncestor(current.left, node1, node2 ); int right = getLeastCommonAncestor(current.right, node1, node2 ); if(left != -1 && right != -1) return current.data; return left == -1? right: left; } public static int getDepth(int id) { Node current = root; int ans = 0; while (current != null) { if (current.data == id) { return ans; } else if (current.data > id) { current = current.left; ans++; } else { current = current.right; ans++; } } return -1; } }
[ "umesh_ravuru@homedepot.com" ]
umesh_ravuru@homedepot.com
49e877a4de29b348bc7e27b9df86d074ddbf1d76
795de391475b77668b9f86c22edb48a7579cf2e0
/PM2/pm2/src/ws1617/a2/WarenTyp.java
55cf35a9643749b52723488d48df7575742b6b84
[]
no_license
adrian-helberg/ws2019
3a7937b3f22311b96648331676521d217e610542
40776ba88110d12bf49d8c6c535c0405e4dc8a81
refs/heads/master
2020-07-31T22:45:07.951048
2020-02-21T09:31:32
2020-02-21T09:31:32
210,776,633
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package ws1617.a2; /** * * @author Birgit Wendholt * * Klassifikation von Waren. Ein Ausschnitt aus der Standardklassifikation. */ public enum WarenTyp { Lebensmittel, Genussmittel, Fertigwaren; }
[ "adrianbostelmann@gmx.de" ]
adrianbostelmann@gmx.de
ad9cc70beedbf81b251a777838477699c44e07ef
650914cec55b71ffa1adcb50c90dd911f0bc6009
/src/main/java/com/interview/HelicoptorLanding.java
8a60d7096b4ae5a5ede42a0ace317477af27bb04
[]
no_license
aliqamer/Java-Algorithms
99fbbd448c4fe7c6abd22d21b8394d29fefddbdb
bd9167cbf84892691bd48e847181aa5128b6fc56
refs/heads/master
2023-03-11T22:36:56.100223
2023-03-04T19:02:50
2023-03-04T19:02:50
74,717,319
1
1
null
2020-10-12T18:37:42
2016-11-25T01:59:44
Java
UTF-8
Java
false
false
2,045
java
package com.interview; /** * Created by Ali on 11/27/2016. */ public class HelicoptorLanding { public static void main(String args[]) { String[] s = {"x#o#o#o#x#o", "x#o#o#o#x#x", "x#o#o#o#x#x", "x#o#x#o#x#o", "x#o#x#o#x#o"}; int r = landingPosition(new int[]{6,5}, s); System.out.println(r); } public static int landingPosition(int[] input1,String[] input2){ int n = input1[0]; int m = input1[1]; char[][] input = new char[m][n]; try{ for(int i=0; i<m;i++){ char[] row = input2[i].toCharArray(); int x = 0; for(int j=0;j<n;j++){ input[i][j] = row[x]; x+=2; } } }catch(Exception e){ return -1; } /*for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { System.out.print(input[i][j]+" "); } System.out.println(); }*/ int[][] dp = new int[m][n]; int max = 0; for (int i = 0; i < n; i++) { if(input[0][i] == 'x'){ dp[0][i] = -1; }else{ dp[0][i] = 1; } } for (int i = 1; i < m; i++) { if(input[i][0] == 'x'){ dp[i][0] = -1; }else{ dp[i][0] = 1; } } for (int i = 1; i < m; i++) { for (int j = 1; j < n; j++) { if(input[i][j] == 'x'){ dp[i][j] = -1; }else if(dp[i-1][j] != -1 && dp[i][j-1] != -1 && dp[i-1][j-1] != -1){ dp[i][j] = dp[i-1][j-1]+1; if(max < dp[i][j]){ max = dp[i][j]; } }else{ dp[i][j] = 1; if(max < 1){ max = 1; } } } } return max; } }
[ "Qamer Ali" ]
Qamer Ali
1b33de6e83e2663d2d44257678f49cfd7085bf46
ee878e2cd8888b28c5fca7e3ed1c649a1ad22af6
/src/main/java/com/embl/controller/AppController.java
12e4778b0e34e6d3c711bc29c2c665d3539a187d
[]
no_license
lorrainealisha75/EMBLGenomeStudy
1d4666e71ee411a1ac8305b4cc28cd7ac01906e9
1790e64c20ff95e3084815302f76afffb9b34bc1
refs/heads/master
2021-08-23T11:27:03.406349
2017-12-04T17:54:19
2017-12-04T17:54:19
113,061,375
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package com.embl.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class AppController { @RequestMapping("/") String home(ModelMap modal) { modal.addAttribute("title","Genome Sequencing Study"); return "index"; } @RequestMapping("/partials/{page}") String partialHandler(@PathVariable("page") final String page) { return page; } }
[ "lorraine.alisha.preeti.coelho@sap.com" ]
lorraine.alisha.preeti.coelho@sap.com
306d41dfc5b315316883c94a14fe2f3b32a7bba3
94545ac7251722ecf8e8f86a651aea5635e04832
/src/com/demo/pojo/DataDictionary.java
a1aa5e5590b9bd8b826c470df894640cd1872fbc
[]
no_license
hfwind/crmdb
5877ee25b3caddae222a0872bc774985bba06ba3
874392e923d8781531cf9e7975409b47ec353ad2
refs/heads/master
2021-01-24T08:08:20.631910
2018-02-26T13:54:20
2018-02-26T13:54:20
122,969,484
0
0
null
null
null
null
UTF-8
Java
false
false
1,258
java
package com.demo.pojo; /** * DataDictionary entity. @author MyEclipse Persistence Tools */ public class DataDictionary implements java.io.Serializable { // Fields private Integer dataId; private String dataType; private String entry; private String dataValue; private Integer state; // Constructors /** default constructor */ public DataDictionary() { } /** full constructor */ public DataDictionary(String dataType, String entry, String dataValue, Integer state) { this.dataType = dataType; this.entry = entry; this.dataValue = dataValue; this.state = state; } // Property accessors public Integer getDataId() { return this.dataId; } public void setDataId(Integer dataId) { this.dataId = dataId; } public String getDataType() { return this.dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public String getEntry() { return this.entry; } public void setEntry(String entry) { this.entry = entry; } public String getDataValue() { return this.dataValue; } public void setDataValue(String dataValue) { this.dataValue = dataValue; } public Integer getState() { return this.state; } public void setState(Integer state) { this.state = state; } }
[ "1224236763@qq.com" ]
1224236763@qq.com
751a19ca25c550463cfc59ee498ea62951ae8872
e0461c729dd134c853655a9749be9331a3c407e9
/booking-engine-gateway/entity/src/main/java/com/tl/booking/gateway/entity/constant/values/AddressParamValues.java
ee6288c7cf90fe236fcd94a8c368ab8d1c7f4789
[]
no_license
dpokuri/microservice
5942600f546a146e32c8923e784ba6a826e0b31c
bbffacaab70b2d03f0c09eb6f469b5df4d910d05
refs/heads/master
2021-04-06T18:08:23.329478
2018-12-04T20:06:51
2018-12-04T20:06:51
125,348,484
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
package com.tl.booking.gateway.entity.constant.values; public class AddressParamValues { public static final Integer ADDRESS_ID_CITY = 13; public static final String ADDRESS_TYPE_CITY = "city"; public static final String ADDRESS_ID_COUNTRY = ""; public static final String ADDRESS_ID_PROVINCE = "id"; public static final String ADDRESS_TYPE_COUNTRY = "country"; public static final String ADDRESS_TYPE_PROVINCE = "province"; }
[ "nikkidavid@Nikkis-MacBook-Pro.local" ]
nikkidavid@Nikkis-MacBook-Pro.local
1afd6a86dd479e259da03ad81b8d9c22f8dec8f9
73fdb38f59217fa68334e7c9e911b409871ba4b3
/app/src/main/java/com/example/landmarks/Main2Activity.java
67b0421979b4e82688a7b20d055c0a7ac886b66d
[]
no_license
nannkau/LandMarks
bdea5d14046690350ea55b661164c00441342d86
bc56033ec1a335cf55c2d582d98b62fa19d56b92
refs/heads/master
2022-06-16T18:33:13.885193
2020-05-11T09:19:55
2020-05-11T09:19:55
260,353,175
0
0
null
null
null
null
UTF-8
Java
false
false
2,203
java
package com.example.landmarks; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class Main2Activity extends AppCompatActivity { private TextView txt; private Button bt2; private Button bt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); txt= (TextView) findViewById(R.id.textViewData); bt2 = (Button) findViewById(R.id.button2); bt= (Button) findViewById(R.id.button); final Intent intent= getIntent(); final String name = intent.getStringExtra("data"); txt.setText(name); bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent2= new Intent(Main2Activity.this,MapsActivity.class); intent2.putExtra("data",name); startActivity(intent2); } }); bt2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url; switch(name){ case "Cleveland Tower City" : url="https://www.towercitycenter.com/";break; case "Browns Football Field" : url="https://firstenergystadium.com/";break; case "Cleveland State University" : url="https://www.csuohio.edu/";break; case "Playhouse Square" : url="http://www.playhousesquare.org/";break; case "Art Museum" : url="https://www.vietnamonline.com/attraction/fine-arts-museum-ho-chi-minh-city.html";break; default: throw new IllegalStateException("Unexpected value: " + name); } Intent intent1=new Intent(); intent1.setAction(Intent.ACTION_VIEW); intent1.setData(Uri.parse(url)); startActivity(intent1); } }); } }
[ "48847934+nannkau@users.noreply.github.com" ]
48847934+nannkau@users.noreply.github.com
a4ced566478067b2e041433643c82df9de6cb01d
cecd32e1a11f470cedcf567c803d8270c2b392df
/src/main/java/com/levietthang/shopee/entities/Product.java
052a84c5ac300a0a8a735e3648383cc18c83a8c8
[]
no_license
vietthang197/agile-forest-42101
6941aed03c3b40a852ed970b5200782b2b22f0b7
7263a036ba593e7397fa2ea0cd1027868598ddba
refs/heads/master
2020-04-01T20:07:11.787649
2018-10-25T08:24:07
2018-10-25T08:24:07
153,589,238
0
0
null
null
null
null
UTF-8
Java
false
false
2,635
java
package com.levietthang.shopee.entities; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; import javax.persistence.*; import java.sql.Date; import java.util.Currency; @Entity(name = "product") @Table(name = "product", indexes = {@Index(name = "EMP_product_INDEX", columnList = "id")}) public class Product { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product_id_seq") @SequenceGenerator(name="product_id_seq", sequenceName="product_id_seq", allocationSize=1) private int id; @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "category_id", referencedColumnName = "id", nullable = false) @OnDelete(action = OnDeleteAction.CASCADE) @JsonIgnore private Category category; @Column private String name; @Column(length = 2000) private String description; @Column private Date dateAdded; @Column private String image; @Column private Currency price; @Column private double sale; public Product() { } public Product(Category category, String name, String description, Date dateAdded, String image, Currency price, double sale) { this.category = category; this.name = name; this.description = description; this.dateAdded = dateAdded; this.image = image; this.price = price; this.sale = sale; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getDateAdded() { return dateAdded; } public void setDateAdded(Date dateAdded) { this.dateAdded = dateAdded; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public Currency getPrice() { return price; } public void setPrice(Currency price) { this.price = price; } public double getSale() { return sale; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setSale(double sale) { this.sale = sale; } }
[ "levietthang1997@gmail.com" ]
levietthang1997@gmail.com
24a98065f38d4bc773b818188aedff3641600186
72da7ba7659c44fdd666f7280257af9d37aa8a9e
/src/com/dirsir/servlet/baseservice/DoDelAdminServlet.java
3f027789468541517b5bbc91a5c9145ba9cdf2d2
[]
no_license
whz-hh/Dirsir
5370b845f862337be898c9a9ff5f9c73ca821c8e
37c5b8db43ac3c8bd4e3fb422dbff68bb3bbe5c5
refs/heads/master
2021-04-20T09:54:12.151382
2020-03-23T04:10:56
2020-03-23T04:10:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,048
java
package com.dirsir.servlet.baseservice; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.dirsir.service.admin.AdminService; @WebServlet("/baseservice/DoDelAdminServlet") public class DoDelAdminServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); response.setCharacterEncoding("utf-8"); AdminService service = new AdminService(); int adminId = Integer.parseInt(request.getParameter("adminId")); service.doDelAdmin(adminId); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "1341938367@qq.com" ]
1341938367@qq.com
729601a04db8f8f0194745b35fe81cf6b71ec98a
3387050fa250373d3f26f91f08c06619c0183bf5
/src/test/java/com/lyy/TestSpringCloudApplicationTests.java
c29bb991dbb728786af90a684dcf6b26895728a3
[]
no_license
liuyangyang0424/test-springcloud
3ac5aa25e7a75e7a5303228d823fc0be5bda4961
8119aaf8de4d3d4e2fd01b3a8ce6cf154d08accb
refs/heads/master
2022-06-29T11:35:45.398998
2020-01-16T02:41:47
2020-01-16T02:41:47
232,975,003
0
0
null
2022-06-21T02:37:39
2020-01-10T05:47:49
Java
UTF-8
Java
false
false
208
java
package com.lyy; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class TestSpringCloudApplicationTests { @Test void contextLoads() { } }
[ "942568550@qq.com" ]
942568550@qq.com
e66380e3f9206c5215c4d574c764ab971fc120d3
95f3045deb31567934abd1363bd2d7cb6617560a
/Work/ImageExplorer/MyFrame.java
7c434cfca983a44c852df71c020051766c92b103
[]
no_license
joshitagaur/java-practices
2e958b69f80975473b6679b63a8fa7a0d55cf0a9
f8a9f5a240b7ae0f09c23334c85605f88c35e1af
refs/heads/master
2020-12-31T07:09:29.445335
2016-04-24T18:20:40
2016-04-24T18:20:40
56,987,194
0
0
null
null
null
null
UTF-8
Java
false
false
3,827
java
import java.awt.*; import java.awt.event.*; import java.io.*; class MyFrame extends Frame implements ComponentListener, TextListener, ActionListener, FilenameFilter, ItemListener { Panel leftPanel; Label lblFolder; TextField txtFolder; Button btnExplore; List lstImage; MyCanvas mc; Checkbox chkSlideShow; MyFrame() { super("Image Explorer"); addComponentListener(this); addWindowListener(new MyWindowAdapter()); addControls(); centerAndPlaceWindow(); setVisible(true); txtFolder.setText("G:\\Wallpapers\\Closeups"); btnExplore.setEnabled(true); } private void centerAndPlaceWindow() { Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int)(scrSize.width * 0.8f); int height = (int)(scrSize.height * 0.8f); int x = (scrSize.width - width) / 2; int y = (scrSize.height - height) / 2; setBounds(x,y,width,height); } private void addControls() { setLayout(null); leftPanel = new Panel(); leftPanel.setBackground(new Color(240,240,240)); leftPanel.setSize(350,getSize().height); leftPanel.setLocation(0,0); add(leftPanel); leftPanel.setLayout(null); int x, y; x = 15; y = 40; int width = 320; lblFolder = new Label("Explore Folder"); lblFolder.setSize(width,20); lblFolder.setLocation(x,y); leftPanel.add(lblFolder); y += 20 + 5; txtFolder = new TextField(); txtFolder.setSize(lblFolder.getSize()); txtFolder.setLocation(x,y); leftPanel.add(txtFolder); txtFolder.addTextListener(this); y += 20 + 5; btnExplore = new Button("Explore"); btnExplore.setSize(100,24); btnExplore.setLocation(x + width - btnExplore.getSize().width, y); leftPanel.add(btnExplore); btnExplore.setEnabled(false); btnExplore.addActionListener(this); y += 24 + 5; lstImage = new List(); lstImage.setLocation(x,y); lstImage.setSize(width, 20); lstImage.addItemListener(this); leftPanel.add(lstImage); chkSlideShow = new Checkbox("Slide Show"); chkSlideShow.setSize(width, 20); leftPanel.add(chkSlideShow); y = 30; x = leftPanel.getSize().width; mc = new MyCanvas(); mc.setLocation(x,y); add(mc); } public void componentMoved(ComponentEvent ce){} public void componentShown(ComponentEvent ce){} public void componentHidden(ComponentEvent cd){} public void componentResized(ComponentEvent ce) { leftPanel.setSize(leftPanel.getSize().width, getSize().height); lstImage.setSize(lstImage.getSize().width, leftPanel.getSize().height - lstImage.getLocation().y - 40); int x = lstImage.getLocation().x; int y = lstImage.getLocation().y + lstImage.getSize().height + 5; chkSlideShow.setLocation(x,y); mc.setSize(getSize().width - leftPanel.getSize().width, getSize().height); } public void textValueChanged(TextEvent te) { String str = txtFolder.getText().trim(); boolean flag = str.length() > 0; if (flag) { File dir = new File(str); flag = dir.isDirectory(); } btnExplore.setEnabled(flag); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == btnExplore) { String path = txtFolder.getText().trim(); File dir = new File(path); File aFile[] = dir.listFiles(this); lstImage.removeAll(); for (File f : aFile) lstImage.add(f.getAbsolutePath()); } } public void itemStateChanged(ItemEvent ie) { if (ie.getSource() == lstImage) { if (lstImage.getSelectedIndex() != -1) { String fileName = lstImage.getSelectedItem(); mc.showImage(fileName); } } } public boolean accept(File dir, String fileName) { fileName = fileName.toLowerCase(); if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg") || fileName.endsWith(".gif") || fileName.endsWith(".png")) return true; return false; } }
[ "joshita.gaur@gamil.com" ]
joshita.gaur@gamil.com
3096220ab740d87b63714188bb4f46977145205a
4e6b0ddcd4372e8d9fd8714c356a8339b7012b5b
/src/java/controller/CalculatorController.java
172520a67e07616bbb56f13fb7ed835630bf0559
[]
no_license
rvikmyhr/RectangleCalculatorPart3
10220650a584d523228c5fa42dd4faac1baba0ff
05d8dbae0f9757034d414ef9d23b52471983cce8
refs/heads/master
2016-09-06T13:13:42.039845
2014-09-08T04:35:03
2014-09-08T04:35:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,139
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.CalculatorService; /** * * @author Ronnie */ @WebServlet(name = "CalculatorController", urlPatterns = {"/calculate"}) public class CalculatorController extends HttpServlet { private static final String CALCULATED_PAGE = "MainCalc.jsp"; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String length = request.getParameter("length"); String height = request.getParameter("height"); CalculatorService cs = new CalculatorService(); String result = cs.calculateRectangleArea(length, height); request.setAttribute("calculation", result); RequestDispatcher view = request.getRequestDispatcher(CALCULATED_PAGE); view.forward(request, response); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "" ]
8635d9f58d987c0aabbb4c5afcb1c22683f1dceb
3e4515919232dcb8e09e3f672e8131e569ca1c0f
/src/SistemaOdonto/br/com/dh/odonto/util/Util.java
e37af012777a2b75205f083c496833427857540f
[]
no_license
Ruan-Araujo/backend
e6f121c32e730b8a3af4cbf38d59628b7c5d22a1
7c2198366941ea462f4cde28f1b0c4135d35c579
refs/heads/master
2023-08-27T06:13:57.456778
2021-11-07T15:16:32
2021-11-07T15:16:32
418,621,178
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package SistemaOdonto.br.com.dh.odonto.util; import java.sql.Date; import java.sql.Timestamp; public class Util { public static Timestamp dateToTimestamp(Date date) { Timestamp timestamp = new Timestamp(date.getTime()); return timestamp; } }
[ "ruanaraujo8@gmail.com" ]
ruanaraujo8@gmail.com
c2aee1fe0d030d772664f304d58d6d66edb6084a
cc612955bab98b9d08a2d6076c4e500fafd95b3d
/Lucky/jacklamb/src/main/java/com/lucky/jacklamb/annotation/mapper/QueryTr.java
a3fc01e3b9e6fdc391dc703583eafb4442791e87
[]
no_license
yuanqi99/lucky
5e4174eee129f2d26c54e356f301c8e315d09cd6
7d9ab0e660df5a86051c2bedbd46eab94dae24a2
refs/heads/main
2023-06-06T00:42:34.223293
2021-06-20T10:16:39
2021-06-20T10:16:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.lucky.jacklamb.annotation.mapper; import java.lang.annotation.*; /** * @author fk7075 * @version 1.0 * @date 2020/8/18 14:42 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface QueryTr { String value(); }
[ "1814375626@qq.com" ]
1814375626@qq.com
1a9fcde93cffb1fef49d290f2c462bfc3a5fd8ea
aed6e40440341e6cde6ba87414f1c6ac33bf0ef0
/src/main/java/com/android/ql/lf/electronicbusiness/utils/im/MediaManager.java
4b32f281cce40aad878cf3b127d52e00db7f787f
[]
no_license
qqxliufeng/electronicbusiness
2d274368c181768d254ad13b1cdfccc1fc11ff50
bafd519d4910f239868eec1acecabd1c45b770a0
refs/heads/master
2021-09-06T01:46:28.577259
2018-02-01T11:18:59
2018-02-01T11:18:59
112,688,631
0
0
null
null
null
null
UTF-8
Java
false
false
2,033
java
package com.android.ql.lf.electronicbusiness.utils.im; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; /** * 作者:Rance on 2016/12/15 15:11 * 邮箱:rance935@163.com */ public class MediaManager { private static MediaPlayer mMediaPlayer; private static boolean isPause; /** * 播放音乐 * * @param filePath * @param onCompletionListener */ public static void playSound(final String filePath, final OnCompletionListener onCompletionListener) { if (mMediaPlayer == null) { mMediaPlayer = new MediaPlayer(); //设置一个error监听器 mMediaPlayer.setOnErrorListener(new OnErrorListener() { public boolean onError(MediaPlayer arg0, int arg1, int arg2) { mMediaPlayer.reset(); return false; } }); } else { mMediaPlayer.reset(); } try { mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setOnCompletionListener(onCompletionListener); mMediaPlayer.setDataSource(filePath); mMediaPlayer.prepare(); mMediaPlayer.start(); } catch (Exception e) { } } /** * 暂停播放 */ public static void pause() { if (mMediaPlayer != null && mMediaPlayer.isPlaying()) { //正在播放的时候 mMediaPlayer.pause(); isPause = true; } } /** * 当前是isPause状态 */ public static void resume() { if (mMediaPlayer != null && isPause) { mMediaPlayer.start(); isPause = false; } } /** * 释放资源 */ public static void release() { if (mMediaPlayer != null) { mMediaPlayer.release(); mMediaPlayer = null; } } }
[ "596484713@qq.com" ]
596484713@qq.com
7f464a4cc97515c63d5ceec8246584e7ae618052
c84ada29fc34851261bf7276309c6766088f1174
/libstreaming/src/main/java/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java
74ec1e2d57725dba55d328dccc8b8455deb5ba52
[ "Apache-2.0" ]
permissive
vilyever/Libstreaming
7bdbe97bc6435c59534228df1dbc1031e51edaba
657ddb014bdb2c2f734741db95921bb891e13c21
refs/heads/master
2021-01-01T05:30:23.076319
2016-06-08T03:21:26
2016-06-08T03:21:26
59,287,163
2
0
null
null
null
null
UTF-8
Java
false
false
4,256
java
/* * Copyright (C) 2011-2014 GUIGUI Simon, fyhertz@gmail.com * * This file is part of libstreaming (https://github.com/fyhertz/libstreaming) * * Spydroid is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This source code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this source code; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.majorkernelpanic.streaming.rtp; import java.io.IOException; import java.io.InputStream; import java.net.InetAddress; import java.util.Random; /** * * Each packetizer inherits from this one and therefore uses RTP and UDP. * */ abstract public class AbstractPacketizer { protected static final int rtphl = RtpSocket.RTP_HEADER_LENGTH; // Maximum size of RTP packets protected final static int MAXPACKETSIZE = RtpSocket.MTU - 28; protected RtpSocket socket = null; protected InputStream is = null; protected byte[] buffer; protected long ts = 0; public AbstractPacketizer() { int ssrc = new Random().nextInt(); ts = new Random().nextInt(); socket = new RtpSocket(); socket.setSSRC(ssrc); } public RtpSocket getRtpSocket() { return socket; } public void setSSRC(int ssrc) { socket.setSSRC(ssrc); } public int getSSRC() { return socket.getSSRC(); } public void setInputStream(InputStream is) { this.is = is; } public void setTimeToLive(int ttl) throws IOException { socket.setTimeToLive(ttl); } /** * Sets the destination of the stream. * @param dest The destination address of the stream * @param rtpPort Destination port that will be used for RTP * @param rtcpPort Destination port that will be used for RTCP */ public void setDestination(InetAddress dest, int rtpPort, int rtcpPort) { socket.setDestination(dest, rtpPort, rtcpPort); } /** Starts the packetizer. */ public abstract void start(); /** Stops the packetizer. */ public abstract void stop(); /** Updates data for RTCP SR and sends the packet. */ protected void send(int length) throws IOException { socket.commitBuffer(length); } /** For debugging purposes. */ protected static String printBuffer(byte[] buffer, int start,int end) { String str = ""; for (int i=start;i<end;i++) str+=","+Integer.toHexString(buffer[i]&0xFF); return str; } /** Used in packetizers to estimate timestamps in RTP packets. */ protected static class Statistics { public final static String TAG = "Statistics"; private int count=700, c = 0; private float m = 0, q = 0; private long elapsed = 0; private long start = 0; private long duration = 0; private long period = 10000000000L; private boolean initoffset = false; public Statistics() {} public Statistics(int count, int period) { this.count = count; this.period = period; } public void reset() { initoffset = false; q = 0; m = 0; c = 0; elapsed = 0; start = 0; duration = 0; } public void push(long value) { elapsed += value; if (elapsed>period) { elapsed = 0; long now = System.nanoTime(); if (!initoffset || (now - start < 0)) { start = now; duration = 0; initoffset = true; } // Prevents drifting issues by comparing the real duration of the // stream with the sum of all temporal lengths of RTP packets. value += (now - start) - duration; //Log.d(TAG, "sum1: "+duration/1000000+" sum2: "+(now-start)/1000000+" drift: "+((now-start)-duration)/1000000+" v: "+value/1000000); } if (c<5) { // We ignore the first 20 measured values because they may not be accurate c++; m = value; } else { m = (m*q+value)/(q+1); if (q<count) q++; } } public long average() { long l = (long)m; duration += l; return l; } } }
[ "ws0250450035@gmail.com" ]
ws0250450035@gmail.com
f0b14cb54857a4cd3c494ce5135b8b279412e47a
63a2ca17410fc8cc43444251964a1a6d221e5b5d
/ExCodes/Ex2017_05_03_Inheritance/src/Shape.java
268497113ad9160b3e51255098563c4042e7bda9
[]
no_license
dknife/OOP2017Java
c1d9e2856526165057471e289f90da26ddda4a85
53341f2e33743713a9afd253115a6b97b1ead5c5
refs/heads/master
2020-12-25T18:32:12.277190
2017-04-20T04:57:12
2017-04-20T04:57:12
83,619,925
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
abstract public class Shape { String type; public Shape() { type = "unknown"; System.out.println("unknown shape created"); } public Shape(String type) { this.type = type; System.out.println("shape: "+type+" created"); } abstract public double area(); public String toString() { String s = "shape:"+type+" area:"+area(); return s; } }
[ "young.min.kang@gmail.com" ]
young.min.kang@gmail.com
be38b4abe6c3458ff17e00021708d1e9f1cc8ae8
44744a79d06cb846c8c54d6a7ac598e6744c257d
/estatioapp/dom/src/test/java/org/estatio/dom/budgeting/budget/BudgetMenuTest.java
fea9b095247dea0ce2e8328dbf9524c773e6b0ce
[ "Apache-2.0" ]
permissive
weddingjuma/esta
d7da66e040c61dba2c48e493de2473545632a360
c1d4604079f42ebd3ef097928dc66159f86fe7c5
refs/heads/master
2021-01-01T03:51:55.125909
2016-05-21T06:44:32
2016-05-21T06:44:32
59,343,081
0
1
null
null
null
null
UTF-8
Java
false
false
2,502
java
package org.estatio.dom.budgeting.budget; import java.util.ArrayList; import java.util.List; import org.assertj.core.api.Assertions; import org.jmock.Expectations; import org.jmock.auto.Mock; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.apache.isis.applib.DomainObjectContainer; import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; import org.estatio.dom.asset.Property; /* * * Copyright 2012-2015 Eurocommercial Properties 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. */ public class BudgetMenuTest { public static class Choices1FindBudget extends BudgetMenuTest { @Rule public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES); @Mock private DomainObjectContainer mockContainer; @Mock BudgetRepository mockBudgetRepository; BudgetMenu budgetMenu; @Before public void setUp() throws Exception { budgetMenu = new BudgetMenu(); budgetMenu.budgetRepository = mockBudgetRepository; } @Test public void happyCase() throws Exception { final Property property = new Property(); property.setName("Property"); final Budget budget = new Budget(); budget.setProperty(property); final List<Budget> budgetList = new ArrayList<>(); budgetList.add(budget); // expect context.checking(new Expectations() { { oneOf(mockBudgetRepository).findByProperty(property); will(returnValue(budgetList)); } }); // when final List<Budget> budgets = budgetMenu.choices1FindBudget(property, null); Assertions.assertThat(budgets).hasSize(1); Assertions.assertThat(budgets.get(0)).isEqualTo(budget); } } }
[ "weddingjuma@gmail.com" ]
weddingjuma@gmail.com
e8616dcb156f3ed96a66380c723cc028bf7c9b21
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/2.7.0/code/base/common/tests.unit/com/tc/process/LinkedJavaProcessTest.java
1a8a133c4fda143d439cad5bc40e4ea4daec91b0
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
6,579
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.process; import com.tc.lcp.HeartBeatServer; import com.tc.lcp.LinkedJavaProcess; import com.tc.test.TCTestCase; import java.io.File; /** * Unit test for {@link LinkedJavaProcess}. */ public class LinkedJavaProcessTest extends TCTestCase { private static final boolean DEBUG = false; public void testRunsRightCommand() throws Exception { LinkedJavaProcess process = new LinkedJavaProcess(LinkedJavaProcessTestMain1.class.getName()); process.start(); // This is actually stdout...weird Java StreamCollector outCollector = new StreamCollector(process.getInputStream()); // This is stderr StreamCollector errCollector = new StreamCollector(process.getErrorStream()); outCollector.start(); errCollector.start(); process.waitFor(); outCollector.join(30000); errCollector.join(30000); assertEquals("Ho there!", ignoreStandardWarnings(errCollector.toString()).trim()); assertEquals("Hi there!", ignoreStandardWarnings(outCollector.toString()).trim()); } private static String ignoreStandardWarnings(String input) { debugPrintln("***** inputString=[" + input + "]"); String delimiter = System.getProperty("line.separator", "\n"); debugPrintln("***** delimiter=[" + delimiter + "]"); String[] output = input.split(delimiter); StringBuffer out = new StringBuffer(); for (int i = 0; i < output.length; ++i) { debugPrintln("***** piece=[" + output[i] + "]"); if (output[i].startsWith("DATA: ")) { out.append(output[i].substring("DATA: ".length()) + delimiter); debugPrintln("***** appending [" + output[i].substring("DATA: ".length()) + delimiter + "] to output string"); } } debugPrintln("***** outString=[" + out.toString() + "]"); return out.toString(); } public void testIO() throws Exception { LinkedJavaProcess process = new LinkedJavaProcess(LinkedJavaProcessTestMain2.class.getName()); process.start(); StreamCollector outCollector = new StreamCollector(process.getInputStream()); // stdout StreamCollector errCollector = new StreamCollector(process.getErrorStream()); // stderr outCollector.start(); errCollector.start(); process.getOutputStream().write("Test Input!\n".getBytes()); process.getOutputStream().flush(); process.waitFor(); outCollector.join(30000); errCollector.join(30000); assertEquals("out: <Test Input!>", ignoreStandardWarnings(outCollector.toString()).trim()); assertEquals("err: <Test Input!>", ignoreStandardWarnings(errCollector.toString()).trim()); } public void testExitCode() throws Exception { LinkedJavaProcess process = new LinkedJavaProcess(LinkedJavaProcessTestMain3.class.getName()); process.start(); process.waitFor(); assertEquals(57, process.exitValue()); } public void testSetup() throws Exception { LinkedJavaProcess process = new LinkedJavaProcess(LinkedJavaProcessTestMain4.class.getName()); File dir = getTempFile("mydir"); assertTrue(dir.mkdirs()); String pwd = dir.getCanonicalPath(); process.setDirectory(dir); process.setEnvironment(new String[] { "LD_LIBRARY_PATH=myenv" }); process.setJavaArguments(new String[] { "-Dljpt.foo=myprop" }); process.start(); StreamCollector outCollector = new StreamCollector(process.getInputStream()); // stdout StreamCollector errCollector = new StreamCollector(process.getErrorStream()); // stderr outCollector.start(); errCollector.start(); process.waitFor(); outCollector.join(30000); errCollector.join(30000); String output = outCollector.toString(); String err = errCollector.toString(); assertEquals("", ignoreStandardWarnings(err).trim()); assertContains("ljpt.foo=myprop", output); assertContains(pwd.toLowerCase(), output.toLowerCase()); } public void testKillingParentKillsChildren() throws Exception { File destFile = getTempFile("tkpkc-file"); File child1File = new File(destFile.getAbsolutePath() + "-child-1"); File child2File = new File(destFile.getAbsolutePath() + "-child-2"); LinkedJavaProcess process = new LinkedJavaProcess(LinkedJavaProcessTestMain5.class.getName(), new String[] { destFile.getAbsolutePath(), "true" }); process.start(); StreamCollector stdout = new StreamCollector(process.STDOUT()); stdout.start(); StreamCollector stderr = new StreamCollector(process.STDERR()); stderr.start(); long origSize = destFile.length(); Thread.sleep(6000); long newSize = destFile.length(); System.err.println("Parent first: new=" + newSize + " old=" + origSize); assertTrue(newSize > origSize); // Make sure it's all started + working long child1OrigSize = child1File.length(); long child2OrigSize = child2File.length(); Thread.sleep(5000); long child1NewSize = child1File.length(); long child2NewSize = child2File.length(); System.err.println("Child 1 first: new=" + child1NewSize + " old=" + child1OrigSize); System.err.println("Child 2 first: new=" + child2NewSize + " old=" + child2OrigSize); // Make sure the children are all started + working assertTrue(child1NewSize > child1OrigSize); assertTrue(child2NewSize > child2OrigSize); System.out.println(stdout.toString()); System.out.println(stderr.toString()); process.destroy(); // wait for child process heartbeat to time out and kill themselves Thread.sleep(HeartBeatServer.PULSE_INTERVAL * 2); origSize = destFile.length(); Thread.sleep(5000); newSize = destFile.length(); System.err.println("Parent after kill: new=" + newSize + " old=" + origSize); assertEquals(origSize, newSize); // Make sure the parent is dead child1OrigSize = child1File.length(); child2OrigSize = child2File.length(); Thread.sleep(5000); child1NewSize = child1File.length(); child2NewSize = child2File.length(); System.err.println("Child 1 after kill: new=" + child1NewSize + " old=" + child1OrigSize); System.err.println("Child 2 after kill: new=" + child2NewSize + " old=" + child2OrigSize); assertEquals(child1NewSize, child1OrigSize); // Make sure child 1 is dead assertEquals(child2NewSize, child2OrigSize); // Make sure child 1 is dead } private static void debugPrintln(String s) { if (DEBUG) { System.err.println(s); } } }
[ "foshea@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
foshea@7fc7bbf3-cf45-46d4-be06-341739edd864
ef9262474118b7acd7bde94b7f99b51f5789ae9a
e047870136e1958ce80dad88fa931304ada49a1b
/eu.cessar.ct.core.mms/src/eu/cessar/ct/core/mms/ecuc/commands/NewEcucContainerCommand.java
407dc943f60c949c4bf3ed88bb8be4cd4a18f91a
[]
no_license
ONagaty/SEA-ModellAR
f4994a628459a20b9be7af95d41d5e0ff8a21f77
a0f6bdbb072503ea584d72f872f29a20ea98ade5
refs/heads/main
2023-06-04T07:07:02.900503
2021-06-19T20:54:47
2021-06-19T20:54:47
376,735,297
0
0
null
null
null
null
UTF-8
Java
false
false
11,427
java
package eu.cessar.ct.core.mms.ecuc.commands; import java.math.BigInteger; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.sphinx.emf.util.WorkspaceTransactionUtil; import eu.cessar.ct.core.mms.EcucMetaModelUtils; import eu.cessar.ct.core.mms.IEcucMMService; import eu.cessar.ct.core.mms.IGenericFactory; import eu.cessar.ct.core.mms.IMetaModelService; import eu.cessar.ct.core.mms.MMSRegistry; import eu.cessar.ct.core.mms.MetaModelUtils; import eu.cessar.ct.core.mms.ecuc.commands.parameters.NewEcucContainerCommandParameter; import eu.cessar.ct.core.platform.CESSARPreferencesAccessor; import eu.cessar.ct.core.platform.EProjectVariant; import gautosar.gecucdescription.GContainer; import gautosar.gecucdescription.GModuleConfiguration; import gautosar.gecucparameterdef.GChoiceContainerDef; import gautosar.gecucparameterdef.GContainerDef; import gautosar.gecucparameterdef.GModuleDef; import gautosar.gecucparameterdef.GParamConfContainerDef; import gautosar.ggenericstructure.ginfrastructure.GIdentifiable; /** * Generic implementation of the command that create an ECUC Container, based on the data passed through the command * parameter. */ public class NewEcucContainerCommand extends AbstractCessarCommand { private NewEcucContainerCommandParameter cmdParameter; /** * Default command constructor * * @param parameter * an instance of container command parameter * @param image * an image object to be displayed as command icon */ public NewEcucContainerCommand(NewEcucContainerCommandParameter parameter, Object image) { super(image); Assert.isNotNull(parameter); cmdParameter = parameter; } /* * (non-Javadoc) * * @see org.eclipse.emf.common.command.AbstractCommand#canExecute() */ @Override public boolean canExecute() { if (!(cmdParameter.getOwner() instanceof GIdentifiable)) { return false; } GIdentifiable owner = (GIdentifiable) cmdParameter.getOwner(); // if the owner has a choice definition, the container about to be // created should be considered one of the choices GIdentifiable intermediateOwner = owner; if (owner instanceof GContainer) { GContainerDef containerDef = ((GContainer) owner).gGetDefinition(); if (containerDef instanceof GChoiceContainerDef) { cmdParameter.setChoiceContainerDefinition((GChoiceContainerDef) containerDef); IMetaModelService mmService = MMSRegistry.INSTANCE.getMMService(cmdParameter.getEOwner()); if (mmService.getAutosarReleaseOrdinal() == 4) { intermediateOwner = (GIdentifiable) owner.eContainer(); } } } if (cmdParameter.isChoice()) { return canCreateChoice(intermediateOwner); } else { return EcucMetaModelUtils.canCreateContainer(owner, cmdParameter.getDefinition()); } } /** * Verify if a new choice container instance for the definition of this command parameter can be created * * @param owner * the owner object where the container should be created * @return <code>true</code> if the container instance can be created, or <code>false</code> otherwise. */ private boolean canCreateChoice(GIdentifiable owner) { IEcucMMService ecucMMService = MMSRegistry.INSTANCE.getMMService(owner).getEcucMMService(); GChoiceContainerDef containerDef = cmdParameter.getChoiceContainerDefinition(); // if the project is in production phase, creation of new container is allowed only if their definition has // postBuildChangeable attribute set to true // or if its parent is created in production phase boolean canBeCreatedIfInProduction = EcucMetaModelUtils.canContainerBeCreatedIfInProduction(containerDef, owner); if (!canBeCreatedIfInProduction) { return false; } EList<? extends GParamConfContainerDef> choicesDef = containerDef.gGetChoices(); int noInstances = 0; EList<? extends GContainer> subContainers = null; if (owner instanceof GModuleConfiguration) { subContainers = ((GModuleConfiguration) owner).gGetContainers(); } else if (owner instanceof GContainer) { subContainers = ((GContainer) owner).gGetSubContainers(); } // count the number of choice containers, with and without the existence // of intermediate choice instance for (GContainer subContainerInst: subContainers) { GContainerDef currentDef = subContainerInst.gGetDefinition(); if (currentDef.equals(containerDef)) { // intermediate choice container instance found, but don't count // noInstances++; noInstances += subContainerInst.gGetSubContainers().size(); } else { for (GContainerDef choice: choicesDef) { if (currentDef.equals(choice)) { noInstances++; } } } } // verify how the upper multiplicity of the choice definition is // compared with the counted instances BigInteger upper = ecucMMService.getUpperMultiplicity(containerDef, BigInteger.ONE, true); if (upper.equals(IEcucMMService.MULTIPLICITY_STAR)) { return true; } else { long longUpper = upper.longValue(); return longUpper > noInstances; } } /* * (non-Javadoc) * * @see org.eclipse.emf.edit.command.CommandActionDelegate#getText() */ @Override public String getText() { return cmdParameter.getDefinition().gGetShortName(); } /* * (non-Javadoc) * * @see org.eclipse.emf.common.command.AbstractCommand#undo() */ @Override public void undo() { if (result != null) { int size = result.size(); if (size != 0) { EObject eObject = result.get(size - 1); GChoiceContainerDef choiceContainerDefinition = cmdParameter.getChoiceContainerDefinition(); if (choiceContainerDefinition == null) { removeElementInTransaction(eObject); } else { EObject eContainer = eObject.eContainer(); removeElementInTransaction(eContainer); } result.clear(); } } } /** * Create a transaction to handle the element creation * * @param eContainer * @param eObject */ @SuppressWarnings("static-method") public void removeElementInTransaction(final EObject eObject) { Runnable r = new Runnable() { @Override public void run() { EcoreUtil.remove(eObject); } }; TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(eObject); try { WorkspaceTransactionUtil.executeInWriteTransaction(editingDomain, r, "Undo Element"); //$NON-NLS-1$ } catch (OperationCanceledException e) { eu.cessar.ct.core.mms.internal.CessarPluginActivator.getDefault().logError(e); } catch (ExecutionException e) { eu.cessar.ct.core.mms.internal.CessarPluginActivator.getDefault().logError(e); } } /* * (non-Javadoc) * * @see org.eclipse.emf.common.command.Command#execute() */ // SUPRESS CHECKSTYLLE not needed @Override public void execute() { // Initializations GIdentifiable owner = (GIdentifiable) cmdParameter.getOwner(); GIdentifiable ownerDef = null; EList<GContainer> childrenList = null; IMetaModelService mmService = MMSRegistry.INSTANCE.getMMService(owner); IEcucMMService ecucMMService = mmService.getEcucMMService(); IGenericFactory ecucGenericFactory = MMSRegistry.INSTANCE.getGenericFactory(owner); GContainerDef containerDef = cmdParameter.getDefinition(); if (owner instanceof GModuleConfiguration) { childrenList = ((GModuleConfiguration) owner).gGetContainers(); ownerDef = ((GModuleConfiguration) owner).gGetDefinition(); } else { // (owner instanceof GContainer) childrenList = ((GContainer) owner).gGetSubContainers(); ownerDef = ((GContainer) owner).gGetDefinition(); } // get project phase IProject project = MetaModelUtils.getProject(owner); EProjectVariant projectVariant = EProjectVariant.DEVELOPMENT; if (project != null) { projectVariant = CESSARPreferencesAccessor.getProjectVariant(project); } // check if is a choice container case, and create the intermediate // element if needed if (cmdParameter.isChoice() && ecucMMService.needChoiceIntermediateContainer()) { if (ownerDef instanceof GParamConfContainerDef || ownerDef instanceof GModuleDef) { GChoiceContainerDef choiceDef = cmdParameter.getChoiceContainerDefinition(); GContainer choiceInstance = null; if (mmService.getAutosarReleaseOrdinal() != 4) { choiceInstance = findChoiceIntermediate(childrenList, choiceDef); } if (choiceInstance == null) { // if no instance of choice intermediate was not found, // create one, and the container about to be created // will be added as child to this instance choiceInstance = ecucGenericFactory.createContainer(); choiceInstance.gSetShortName(MetaModelUtils.computeUniqueChildShortName(owner, choiceDef.gGetShortName())); choiceInstance.gSetDefinition(choiceDef); childrenList.add(choiceInstance); // set the project phase for the created container EcucMetaModelUtils.setContainerCreationPhase(choiceInstance, projectVariant); } childrenList = choiceInstance.gGetSubContainers(); } else { // CHECKSTYLE IGNORE check FOR NEXT 3 LINES // the action is executed from the instance of the choice // itself, do nothing, the childreList is already the right one } } // create parameters container and initialize its short name and // definition GContainer newContainer = ecucGenericFactory.createContainer(); newContainer.gSetShortName(cmdParameter.getShortName()); newContainer.gSetDefinition(containerDef); // set the project phase for the created container EcucMetaModelUtils.setContainerCreationPhase(newContainer, projectVariant); childrenList.add(newContainer); result.add(newContainer); } /** * Find the container corresponding to a choice container definition into specified list * * @param childrenList * the children list where the search is performed * @param containerDef * the choice container definition whose instance is searched for * @return The Choice container instance if found, or <code>null</code> otherwise. */ private GContainer findChoiceIntermediate(EList<? extends GContainer> childrenList, GChoiceContainerDef containerDef) { for (GContainer gContainer: childrenList) { if (gContainer.gGetDefinition().equals(containerDef)) { return gContainer; } } return null; } /** * @param runnable * the runnable to execute * @param label * label of the operation * @return <code>true</code> if the change has been performed, <code>false</code> otherwise // */ // protected boolean performChangeWithChecks(Runnable runnable, String label) // { // try // { // WorkspaceTransactionUtil.executeInWriteTransaction(getEditingDomain(), runnable, label); // return true; // } // catch (OperationCanceledException e) // { // CessarPluginActivator.getDefault().logError(e); // return false; // } // catch (ExecutionException e) // { // CessarPluginActivator.getDefault().logError(e); // return false; // } // } }
[ "onagaty@a5sol.com" ]
onagaty@a5sol.com
33d1e592d48881ca4c010da74abe587d6f65313b
b6e7f9f1a041787883afefa191b0d99e4abc01de
/src/sample/editCarInterfaceController.java
bbca81ea64efb6d0d445289ee7ea3347815b9f59
[]
no_license
TokiTahmid64/Car-management-javafx
7a916b8c7124aa37fb912eab747b220e937a6a90
350f89700ef941ecef5caae41ac58f0e5efa46bf
refs/heads/main
2023-03-08T12:30:44.450221
2021-02-23T18:27:42
2021-02-23T18:27:42
341,650,997
0
0
null
null
null
null
UTF-8
Java
false
false
3,094
java
package sample; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.stage.FileChooser; import javafx.stage.Stage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; public class editCarInterfaceController { Socket s; String reply; Stage stg; @FXML private TextField registration; @FXML private TextField model; @FXML private TextField price; @FXML private TextField available; @FXML private TextField color1; @FXML private TextField color2; @FXML private TextField color3; @FXML private TextField year; @FXML private TextField manufacturer; @FXML private ImageView image; String imagePath; public void socketInfo(Socket s) { this.s = s; } public void stageInfo(Stage s) { this.stg = s; } public void getString(String temp) throws IOException { this.reply = temp; String token[] = reply.split(","); registration.setText(token[0]); model.setText(token[1]); price.setText(token[2]); available.setText(token[3]); color1.setText(token[4]); color2.setText(token[5]); color3.setText(token[6]); year.setText(token[7]); manufacturer.setText(token[8]); if (token[9] != null) { imagePath = token[9]; System.out.println(token[9]); image.setImage(new Image(token[9])); } } public void update(ActionEvent e) throws IOException { PrintWriter writer = new PrintWriter(s.getOutputStream(), true); String send = "updateCar" + ";" + registration.getText() + "," + model.getText() + "," + price.getText() + "," + available.getText() + "," + color1.getText() + "," + color2.getText() + "," + color3.getText() + "," + year.getText() + "," + manufacturer.getText() + "," + imagePath; writer.println(send); toast.makeText(stg, "Updated Successfully", 2000, 500, 500); } public void back(ActionEvent e) throws IOException { stg.close(); FXMLLoader loader = new FXMLLoader(getClass().getResource("manufactMainPage.fxml")); Parent root = loader.load(); Scene mainScene = new Scene(root); Stage window = new Stage(); window.setScene(mainScene); manufactMainController controller = loader.getController(); controller.socketInfo(s); controller.getStage(stg); window.show(); } public void choose(ActionEvent e) { FileChooser fc = new FileChooser(); File selected = fc.showOpenDialog(null); System.out.println(selected.toURI().toString()); if (selected != null) { image.setImage(new Image(selected.toURI().toString())); imagePath = selected.toURI().toString(); } } }
[ "sharifulislamtoki@gmail.com" ]
sharifulislamtoki@gmail.com
e7c444339a3548492b181025e2290d765a6deded
68b57975b1a5bcb03b01259a49a8f989ce64f6d3
/thaumcraft/client/renderers/block/BlockMetalDeviceRenderer.java
6c5d7d39247f4d6e85b8a4e5a2c752f7b0dc6552
[]
no_license
KAMKEEL/Thaumcraft4-1.7.10
62ae23c025bb72d826797114c8546c6019b878d7
059a869367c7bfeef97e5c1aeca78a4b9fa26554
refs/heads/master
2021-12-15T02:43:23.921572
2017-07-19T00:56:18
2017-07-19T00:56:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,997
java
/* */ package thaumcraft.client.renderers.block; /* */ /* */ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; /* */ import net.minecraft.block.Block; /* */ import net.minecraft.client.renderer.RenderBlocks; /* */ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; /* */ import net.minecraft.tileentity.TileEntity; /* */ import net.minecraft.util.IIcon; /* */ import net.minecraft.world.IBlockAccess; /* */ import org.lwjgl.opengl.GL11; /* */ import thaumcraft.api.aspects.AspectList; /* */ import thaumcraft.common.config.ConfigBlocks; /* */ import thaumcraft.common.tiles.TileAlembic; /* */ import thaumcraft.common.tiles.TileBrainbox; /* */ import thaumcraft.common.tiles.TileCrucible; /* */ import thaumcraft.common.tiles.TileMagicWorkbenchCharger; /* */ import thaumcraft.common.tiles.TileVisRelay; /* */ /* */ /* */ /* */ public class BlockMetalDeviceRenderer /* */ extends BlockRenderer /* */ implements ISimpleBlockRenderingHandler /* */ { /* */ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) /* */ { /* 27 */ if ((metadata == 0) || (metadata == 6)) { /* 28 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 29 */ renderer.func_147775_a(block); /* 30 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[2], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[4], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[3], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[3], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[3], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[3], true); /* */ /* */ /* */ /* */ } /* 35 */ else if (metadata == 1) { /* 36 */ GL11.glTranslatef(-0.5F, 0.0F, -0.5F); /* 37 */ TileEntityRendererDispatcher.field_147556_a.func_147549_a(new TileAlembic(), 0.0D, 0.0D, 0.0D, 0.0F); /* 38 */ GL11.glEnable(32826); /* */ } /* 40 */ else if (metadata == 5) { /* 41 */ GL11.glTranslatef(0.0F, -0.3F, 0.0F); /* 42 */ block.func_149676_a(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F); /* 43 */ renderer.func_147775_a(block); /* 44 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[8], false); /* 45 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[9], false); /* */ } /* 47 */ else if (metadata == 7) { /* 48 */ block.func_149676_a(W4, W2, W4, W12, W14, W12); /* 49 */ renderer.func_147775_a(block); /* 50 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[11], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[11], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[10], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[10], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[10], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[10], true); /* */ /* */ /* */ /* */ } /* 55 */ else if (metadata == 8) { /* 56 */ block.func_149676_a(W4, W2, W4, W12, W14, W12); /* 57 */ renderer.func_147775_a(block); /* 58 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[13], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[13], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[12], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[12], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[12], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[12], true); /* */ /* */ /* */ /* */ } /* 63 */ else if (metadata == 9) { /* 64 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 65 */ renderer.func_147775_a(block); /* 66 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[16], true); /* */ } /* 68 */ else if (metadata == 3) { /* 69 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 70 */ renderer.func_147775_a(block); /* 71 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[22], true); /* */ } /* 73 */ else if (metadata == 12) { /* 74 */ block.func_149676_a(W3, W3, W3, W13, W13, W13); /* 75 */ renderer.func_147775_a(block); /* 76 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[17], true); /* */ } /* 78 */ else if (metadata == 13) { /* 79 */ block.func_149676_a(W4, W2, W4, W12, W14, W12); /* 80 */ renderer.func_147775_a(block); /* 81 */ drawFaces(renderer, block, ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[19], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[19], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[18], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[18], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[18], ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[18], true); /* */ /* */ /* */ /* */ } /* 86 */ else if (metadata == 14) { /* 87 */ GL11.glPushMatrix(); /* 88 */ GL11.glScaled(1.5D, 1.5D, 1.5D); /* 89 */ GL11.glTranslatef(-0.5F, -0.25F, -0.5F); /* 90 */ TileEntityRendererDispatcher.field_147556_a.func_147549_a(new TileVisRelay(), 0.0D, 0.0D, 0.0D, 0.0F); /* 91 */ GL11.glEnable(32826); /* 92 */ GL11.glPopMatrix(); /* */ } /* 94 */ else if (metadata == 2) { /* 95 */ GL11.glPushMatrix(); /* 96 */ GL11.glTranslatef(-0.5F, -0.5F, -0.5F); /* 97 */ TileEntityRendererDispatcher.field_147556_a.func_147549_a(new TileMagicWorkbenchCharger(), 0.0D, 0.0D, 0.0D, 0.0F); /* 98 */ GL11.glEnable(32826); /* 99 */ GL11.glPopMatrix(); /* */ } /* */ } /* */ /* */ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) /* */ { /* 105 */ int metadata = world.func_72805_g(x, y, z); /* */ /* 107 */ if (metadata == 0) { /* 108 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 109 */ renderer.func_147775_a(block); /* 110 */ renderer.func_147784_q(block, x, y, z); /* */ /* 112 */ IIcon innerSide = ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[5]; /* 113 */ IIcon bottom = ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[6]; /* 114 */ float f5 = 0.123F; /* 115 */ TileEntity te = world.func_147438_o(x, y, z); /* 116 */ if ((te != null) && ((te instanceof TileCrucible)) && (((TileCrucible)te).aspects.size() > 0)) /* 117 */ setBrightness(world, x, y, z, block); /* 118 */ renderer.func_147764_f(block, x - 1.0F + f5, y, z, innerSide); /* 119 */ renderer.func_147798_e(block, x + 1.0F - f5, y, z, innerSide); /* 120 */ renderer.func_147734_d(block, x, y, z - 1.0F + f5, innerSide); /* 121 */ renderer.func_147761_c(block, x, y, z + 1.0F - f5, innerSide); /* 122 */ renderer.func_147806_b(block, x, y - 1.0F + 0.25F, z, bottom); /* 123 */ renderer.func_147768_a(block, x, y + 1.0F - 0.75F, z, bottom); /* */ } /* 125 */ else if ((metadata == 5) || (metadata == 6)) { /* 126 */ setBrightness(world, x, y, z, block); /* 127 */ block.func_149676_a(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F); /* 128 */ renderer.func_147775_a(block); /* 129 */ renderer.func_147784_q(block, x, y, z); /* */ /* 131 */ renderer.func_147764_f(block, x - 1.002F + W3, y, z, block.func_149733_h(0)); /* 132 */ renderer.func_147798_e(block, x + 1.002F - W3, y, z, block.func_149733_h(0)); /* 133 */ renderer.func_147734_d(block, x, y, z - 1.002F + W3, block.func_149733_h(0)); /* 134 */ renderer.func_147761_c(block, x, y, z + 1.002F - W3, block.func_149733_h(0)); /* */ /* 136 */ renderer.func_147764_f(block, x - 1.002F + W9, y, z, block.func_149733_h(0)); /* 137 */ renderer.func_147798_e(block, x + 1.002F - W9, y, z, block.func_149733_h(0)); /* 138 */ renderer.func_147734_d(block, x, y, z - 1.002F + W9, block.func_149733_h(0)); /* 139 */ renderer.func_147761_c(block, x, y, z + 1.002F - W9, block.func_149733_h(0)); /* */ /* 141 */ if (metadata == 6) { /* 142 */ block.func_149676_a(W1, W14, W1, W15, W15, W15); /* 143 */ renderer.func_147775_a(block); /* 144 */ renderer.field_147840_d = ((thaumcraft.common.blocks.BlockMetalDevice)block).icon[9]; /* 145 */ renderer.func_147784_q(block, x, y, z); /* */ } /* */ } /* 148 */ else if ((metadata == 7) || (metadata == 8) || (metadata == 13)) { /* 149 */ block.func_149676_a(W4, W2, W4, W12, W14, W12); /* 150 */ renderer.func_147775_a(block); /* 151 */ renderer.func_147784_q(block, x, y, z); /* */ } /* 153 */ else if ((metadata == 3) || (metadata == 9)) { /* 154 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 155 */ renderer.func_147775_a(block); /* 156 */ renderer.func_147784_q(block, x, y, z); /* */ } /* 158 */ else if (metadata == 12) { /* 159 */ block.func_149676_a(W3, W3, W3, W13, W13, W13); /* 160 */ renderer.func_147775_a(block); /* 161 */ renderer.func_147784_q(block, x, y, z); /* 162 */ TileEntity te = world.func_147438_o(x, y, z); /* 163 */ if ((te != null) && ((te instanceof TileBrainbox))) { /* 164 */ switch (((TileBrainbox)te).facing) { /* */ case UP: /* 166 */ block.func_149676_a(W6, W13, W6, W10, 1.0F, W10); /* 167 */ renderer.func_147775_a(block); /* 168 */ renderer.func_147784_q(block, x, y, z); /* 169 */ break; /* */ case DOWN: /* 171 */ block.func_149676_a(W6, 0.0F, W6, W10, W3, W10); /* 172 */ renderer.func_147775_a(block); /* 173 */ renderer.func_147784_q(block, x, y, z); /* 174 */ break; /* */ case EAST: /* 176 */ block.func_149676_a(W13, W6, W6, 1.0F, W10, W10); /* 177 */ renderer.func_147775_a(block); /* 178 */ renderer.func_147784_q(block, x, y, z); /* 179 */ break; /* */ case WEST: /* 181 */ block.func_149676_a(0.0F, W6, W6, W3, W10, W10); /* 182 */ renderer.func_147775_a(block); /* 183 */ renderer.func_147784_q(block, x, y, z); /* 184 */ break; /* */ case SOUTH: /* 186 */ block.func_149676_a(W6, W6, W13, W10, W10, 1.0F); /* 187 */ renderer.func_147775_a(block); /* 188 */ renderer.func_147784_q(block, x, y, z); /* 189 */ break; /* */ case NORTH: /* 191 */ block.func_149676_a(W6, W6, 0.0F, W10, W10, W3); /* 192 */ renderer.func_147775_a(block); /* 193 */ renderer.func_147784_q(block, x, y, z); /* */ } /* */ /* */ } /* */ } /* */ /* */ /* */ /* 201 */ renderer.func_147771_a(); /* 202 */ block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); /* 203 */ renderer.func_147775_a(block); /* 204 */ return true; /* */ } /* */ /* */ public boolean shouldRender3DInInventory(int modelId) /* */ { /* 209 */ return true; /* */ } /* */ /* */ public int getRenderId() /* */ { /* 214 */ return ConfigBlocks.blockMetalDeviceRI; /* */ } /* */ } /* Location: /Users/shannon/Desktop/Thaumcraft-1.7.10-4.2.3.5.jar!/thaumcraft/client/renderers/block/BlockMetalDeviceRenderer.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "phanegan2@gmail.com" ]
phanegan2@gmail.com
a9d08ee07c717079163bd363c222c48c2fae951a
134c484294598c0c7bacad23046f1e537f007509
/src/test/java/com/xiaolanyun/appium/DataTest/pages/Mart_BuyerOrdersPage.java
ed28527c7a0738024fa763394bd0e0af1851285c
[]
no_license
xiaolanyun/DevOps_AppiumParallelTest
368baf75f3ea40fba8d6100bddea6631d5ea595b
dfcf31e81c57a092c4ad5ce1bf0e4c4c41c31e20
refs/heads/master
2020-05-16T09:04:29.776294
2019-04-30T02:36:02
2019-04-30T02:36:02
182,936,179
0
1
null
null
null
null
UTF-8
Java
false
false
234
java
package com.xiaolanyun.appium.DataTest.pages; import org.openqa.selenium.By; /* * @author 24075 * @classname:Mart_BuyerOrdersPage * @Description:买家订单列表,初始为空 */ public class Mart_BuyerOrdersPage { //订单 }
[ "2407512504@qq.com" ]
2407512504@qq.com
0e5f7fdd0d3a95e6951cadda026cad897962549d
990e69956fd896422123c47bbc5b3f8a64bbe22a
/src/beautyshop/EndButton.java
60a172a7953e6ac54fa231868f9f6963ad0e5e0e
[]
no_license
HuiYuLong/BeautyApp
593076c29ff119e5e427010ccf018eb30b169aab
1e9604911c2ecbb6d3a263c18f75d66b7f082258
refs/heads/main
2023-05-17T00:59:59.926461
2021-06-12T06:13:20
2021-06-12T06:13:20
358,834,405
0
0
null
null
null
null
UTF-8
Java
false
false
513
java
package beautyshop; import util.ImageLoader; //Create an ending screen that will have a restart button allowing the application to be relaunched. public class EndButton extends MyObject{ public EndButton(double x, double y, double s) { super(x, y, s); img = ImageLoader.loadImage("assets/end_button.PNG"); } @Override public void setImg(int state) { // TODO Auto-generated method stub } @Override public void react() { // TODO Auto-generated method stub } }
[ "noreply@github.com" ]
HuiYuLong.noreply@github.com
729742f5851ca2574576dbee262ea5251baeddf6
9d5dee95b3eba29c72fb0afa90da8a7ee0a08db3
/RandomizedTreeSet.java
368135bfd514c3161b74766e1d2e0fc349190bcc
[]
no_license
walikhancodes/TreeSorter
79953d6101fa9197f4823bd292fa38a93a9fa9a5
ec8a5e13b9615363ed32ab7393214c078f93579b
refs/heads/main
2023-02-10T08:06:31.492919
2021-01-06T12:57:43
2021-01-06T12:57:43
326,834,210
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
import java.util.ArrayList; import java.util.Collections; public class RandomizedTreeSet<K> extends TreeSet<K> { @Override public void insertList(ArrayList<K> list){ ArrayList<K> listCopy = new ArrayList<K>(); for (K key : list) listCopy.add(key); Collections.shuffle(listCopy); for (K key : listCopy) put(key); } }
[ "noreply@github.com" ]
walikhancodes.noreply@github.com
35013285b058be4231f2c3f8f641261d3a4142e1
f84e13bc1c6dc21ca494ff4ca7cea49f7c657079
/design-patterns/src/main/java/com/atguigu/design/structural/bridge/StudentSale.java
ba014ffdaa0d9e0e1a88d083b74c726030e25eec
[]
no_license
lihuaiqiang/MySourceCodeStudy
5f45e412cd3f38223b9869e8579e46b5695119a4
d857198e2450d2e5b84398afda606ee5e3fc422b
refs/heads/master
2023-03-28T10:50:16.759659
2021-03-22T08:52:20
2021-03-22T08:52:20
350,194,388
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package com.atguigu.design.structural.bridge; public class StudentSale extends AbstractSale{ public StudentSale(String type, Integer price) { super(type, price); } }
[ "lihq@primeton.com" ]
lihq@primeton.com
559cb08b31398c562be0a4acd085a0480f5adae2
6e0ad966e571f7c29a5f23be286b80549efe7fc3
/common-module-mybatis/src/main/java/org/common/module/mybatis/plugin/PageHelper.java
ede283e4e2dd58aa3813f27a4c8a2472a4207306
[]
no_license
ywu2014/CommonModules
9f2ac64f2483d51893431ba8bf9df11a94cf7bb6
e35ca304c36ab0d98b421f2b338c99d3555f5885
refs/heads/master
2021-01-04T14:21:45.740208
2016-07-22T08:48:55
2016-07-22T08:48:55
60,601,150
0
0
null
null
null
null
UTF-8
Java
false
false
12,712
java
/** * Copyright (c) 2015-2016 yejunwu126@126.com * * Licensed under the Apache License, Version 2.0 (the "License"); */ package org.common.module.mybatis.plugin; import java.sql.SQLException; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; import javax.sql.DataSource; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Invocation; import org.apache.ibatis.plugin.Plugin; import org.apache.ibatis.plugin.Signature; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; import com.github.pagehelper.Dialect; import com.github.pagehelper.ISelect; import com.github.pagehelper.Page; import com.github.pagehelper.SqlUtil; import com.github.pagehelper.SqlUtilConfig; import com.github.pagehelper.StringUtil; /** * @description 分页插件扩展,提供了自动从线程上下文中获取分页参数的方法 * @author ywu@wuxicloud.com * 2016年1月9日 上午10:59:40 */ @Intercepts(@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class})) public class PageHelper implements Interceptor { //sql工具类 private SqlUtil sqlUtil; //属性参数信息 private Properties properties; //配置对象方式 private SqlUtilConfig sqlUtilConfig; //自动获取dialect,如果没有setProperties或setSqlUtilConfig,也可以正常进行 private boolean autoDialect = true; //运行时自动获取dialect private boolean autoRuntimeDialect; //缓存 private Map<String, SqlUtil> urlSqlUtilMap = new ConcurrentHashMap<String, SqlUtil>(); /** * 获取任意查询方法的count总数 * @param select * @return */ public static long count(ISelect select) { Page<?> page = startPage(1, -1, true); select.doSelect(); return page.getTotal(); } /** * 开始分页 * @return */ public static boolean startPage() { Integer currentPage = PageContext.getCurrentPage(); Integer pageSize = PageContext.getPageSize(); if (null == currentPage || null == pageSize) { return false; } startPage(currentPage, pageSize, true); return true; } /** * 开始分页 * * @param pageNum 页码 * @param pageSize 每页显示数量 */ public static <E> Page<E> startPage(int pageNum, int pageSize) { return startPage(pageNum, pageSize, true); } /** * 开始分页 * * @param pageNum 页码 * @param pageSize 每页显示数量 * @param count 是否进行count查询 */ public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count) { return startPage(pageNum, pageSize, count, null); } /** * 开始分页 * * @param pageNum 页码 * @param pageSize 每页显示数量 * @param orderBy 排序 */ public static <E> Page<E> startPage(int pageNum, int pageSize, String orderBy) { Page<E> page = startPage(pageNum, pageSize); page.setOrderBy(orderBy); return page; } /** * 开始分页 * * @param offset 页码 * @param limit 每页显示数量 */ public static <E> Page<E> offsetPage(int offset, int limit) { return offsetPage(offset, limit, true); } /** * 开始分页 * * @param offset 页码 * @param limit 每页显示数量 * @param count 是否进行count查询 */ public static <E> Page<E> offsetPage(int offset, int limit, boolean count) { Page<E> page = new Page<E>(new int[]{offset, limit}, count); //当已经执行过orderBy的时候 Page<E> oldPage = SqlUtil.getLocalPage(); if (oldPage != null && oldPage.isOrderByOnly()) { page.setOrderBy(oldPage.getOrderBy()); } SqlUtil.setLocalPage(page); return page; } /** * 开始分页 * * @param offset 页码 * @param limit 每页显示数量 * @param orderBy 排序 */ public static <E> Page<E> offsetPage(int offset, int limit, String orderBy) { Page<E> page = offsetPage(offset, limit); page.setOrderBy(orderBy); return page; } /** * 开始分页 * * @param pageNum 页码 * @param pageSize 每页显示数量 * @param count 是否进行count查询 * @param reasonable 分页合理化,null时用默认配置 */ public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count, Boolean reasonable) { return startPage(pageNum, pageSize, count, reasonable, null); } /** * 开始分页 * * @param pageNum 页码 * @param pageSize 每页显示数量 * @param count 是否进行count查询 * @param reasonable 分页合理化,null时用默认配置 * @param pageSizeZero true且pageSize=0时返回全部结果,false时分页,null时用默认配置 */ public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count, Boolean reasonable, Boolean pageSizeZero) { Page<E> page = new Page<E>(pageNum, pageSize, count); page.setReasonable(reasonable); page.setPageSizeZero(pageSizeZero); //当已经执行过orderBy的时候 Page<E> oldPage = SqlUtil.getLocalPage(); if (oldPage != null && oldPage.isOrderByOnly()) { page.setOrderBy(oldPage.getOrderBy()); } SqlUtil.setLocalPage(page); return page; } /** * 开始分页 * * @param params */ public static <E> Page<E> startPage(Object params) { Page<E> page = SqlUtil.getPageFromObject(params); //当已经执行过orderBy的时候 Page<E> oldPage = SqlUtil.getLocalPage(); if (oldPage != null && oldPage.isOrderByOnly()) { page.setOrderBy(oldPage.getOrderBy()); } SqlUtil.setLocalPage(page); return page; } /** * 排序 * * @param orderBy */ @SuppressWarnings("rawtypes") public static void orderBy(String orderBy) { Page<?> page = SqlUtil.getLocalPage(); if (page != null) { page.setOrderBy(orderBy); } else { page = new Page(); page.setOrderBy(orderBy); page.setOrderByOnly(true); SqlUtil.setLocalPage(page); } } /** * 获取orderBy * * @return */ public static String getOrderBy() { Page<?> page = SqlUtil.getLocalPage(); if (page != null) { String orderBy = page.getOrderBy(); if (StringUtil.isEmpty(orderBy)) { return null; } else { return orderBy; } } return null; } /** * Mybatis拦截器方法 * @param invocation 拦截器入参 * @return 返回执行结果 * @throws Throwable 抛出异常 */ public Object intercept(Invocation invocation) throws Throwable { if (autoRuntimeDialect) { SqlUtil sqlUtil = getSqlUtil(invocation); return sqlUtil.processPage(invocation); } else { if (autoDialect) { initSqlUtil(invocation); } return sqlUtil.processPage(invocation); } } /** * 初始化sqlUtil * @param invocation */ public synchronized void initSqlUtil(Invocation invocation) { if (this.sqlUtil == null) { this.sqlUtil = getSqlUtil(invocation); if (!autoRuntimeDialect) { properties = null; sqlUtilConfig = null; } autoDialect = false; } } /** * 根据daatsource创建对应的sqlUtil * @param invocation */ public SqlUtil getSqlUtil(Invocation invocation) { MappedStatement ms = (MappedStatement) invocation.getArgs()[0]; //改为对dataSource做缓存 String url; DataSource dataSource = ms.getConfiguration().getEnvironment().getDataSource(); try { url = dataSource.getConnection().getMetaData().getURL(); } catch (SQLException e) { throw new RuntimeException(e); } if (urlSqlUtilMap.containsKey(url)) { return urlSqlUtilMap.get(url); } ReentrantLock lock = new ReentrantLock(); try { lock.lock(); if (urlSqlUtilMap.containsKey(url)) { return urlSqlUtilMap.get(url); } if (StringUtil.isEmpty(url)) { throw new RuntimeException("无法自动获取jdbcUrl,请在分页插件中配置dialect参数!"); } String dialect = Dialect.fromJdbcUrl(url); if (dialect == null) { throw new RuntimeException("无法自动获取数据库类型,请通过dialect参数指定!"); } SqlUtil sqlUtil = new SqlUtil(dialect); if (this.properties != null) { sqlUtil.setProperties(properties); } else if (this.sqlUtilConfig != null) { sqlUtil.setSqlUtilConfig(this.sqlUtilConfig); } urlSqlUtilMap.put(url, sqlUtil); return sqlUtil; } finally { lock.unlock(); } } /** * 只拦截Executor * @param target * @return */ public Object plugin(Object target) { if (target instanceof Executor) { return Plugin.wrap(target, this); } else { return target; } } private void checkVersion() { //MyBatis3.2.0版本校验 try { Class.forName("org.apache.ibatis.scripting.xmltags.SqlNode");//SqlNode是3.2.0之后新增的类 } catch (ClassNotFoundException e) { throw new RuntimeException("您使用的MyBatis版本太低,MyBatis分页插件PageHelper支持MyBatis3.2.0及以上版本!"); } } /** * 设置属性值 * * @param p 属性值 */ public void setProperties(Properties p) { checkVersion(); //数据库方言 String dialect = p.getProperty("dialect"); String runtimeDialect = p.getProperty("autoRuntimeDialect"); if (StringUtil.isNotEmpty(runtimeDialect) && runtimeDialect.equalsIgnoreCase("TRUE")) { this.autoRuntimeDialect = true; this.autoDialect = false; this.properties = p; } else if (StringUtil.isEmpty(dialect)) { autoDialect = true; this.properties = p; } else { autoDialect = false; sqlUtil = new SqlUtil(dialect); sqlUtil.setProperties(p); } } /** * 设置属性值 * * @param config */ public void setSqlUtilConfig(SqlUtilConfig config) { checkVersion(); if (config.isAutoRuntimeDialect()) { this.autoRuntimeDialect = true; this.autoDialect = false; this.sqlUtilConfig = config; } else if (StringUtil.isEmpty(config.getDialect())) { autoDialect = true; this.sqlUtilConfig = config; } else { autoDialect = false; sqlUtil = new SqlUtil(config.getDialect()); sqlUtil.setSqlUtilConfig(config); } } /** * 封装返回分页结果 * @param data * @return */ public static org.common.module.entity.query.Page getPageResult(List<?> data) { if (data instanceof Page) { Page<?> page = (Page<?>)data; org.common.module.entity.query.Page wrapperPage = new org.common.module.entity.query.Page(page.getPageNum(), page.getPageSize()); wrapperPage.setData(data); wrapperPage.setTotalRecords(page.getTotal()); return wrapperPage; } throw new RuntimeException("非法分页数据..."); } }
[ "yejunwu123@gmail.com" ]
yejunwu123@gmail.com
dacd9a72a40a8a6b4710799b1de875a89baa851b
1990c6651698ee4a8c754c31f21bc31a3f3242c1
/src/main/java/com/ldlood/dto/OrderDTO.java
ad26097916fc8878e5b779b58ad40cb4bfb4865d
[ "Apache-2.0" ]
permissive
caoxiaowei414/sell
ff4ce05a26a5ce7fba18a7978741c27a24735e12
d92fe7508c4e4e6a7a4310a311df2598cd875065
refs/heads/master
2020-03-11T08:39:21.165027
2019-03-07T09:04:37
2019-03-07T09:04:37
129,889,257
3
0
null
null
null
null
UTF-8
Java
false
false
1,756
java
package com.ldlood.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.ldlood.dataobject.OrderDetail; import com.ldlood.enums.OrderStatusEnum; import com.ldlood.enums.PayStatusEnum; import com.ldlood.utils.EnumUtil; import com.ldlood.utils.serializer.Date2LongSerializer; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import java.util.List; /** * Created by Ldlood on 2017/7/21. */ @Data public class OrderDTO { /** * 订单id. */ private String orderId; /** * 买家名字. */ private String buyerName; /** * 买家手机号. */ private String buyerPhone; /** * 买家地址. */ private String buyerAddress; /** * 买家微信Openid. */ private String buyerOpenid; /** * 订单总金额. */ private BigDecimal orderAmount; /** * 订单状态, 默认为0新下单. */ private Integer orderStatus; /** * 支付状态, 默认为0未支付. */ private Integer payStatus; /** * 创建时间. */ @JsonSerialize(using = Date2LongSerializer.class) private Date createTime; /** * 更新时间. */ @JsonSerialize(using = Date2LongSerializer.class) private Date updateTime; private List<OrderDetail> orderDetailList; @JsonIgnore public OrderStatusEnum getOrderStatusEnum() { return EnumUtil.getByCode(orderStatus, OrderStatusEnum.class); } @JsonIgnore public PayStatusEnum getPayStatusEnum() { return EnumUtil.getByCode(payStatus, PayStatusEnum.class); } }
[ "xz95@outlokk.com" ]
xz95@outlokk.com
8bb57d29330180a8e84c36b75de8204fd3e0f923
622c9b0c2b88555dc5af5fae0a6511e135874b02
/ChileDiarios/src/cl/suika/cineschile/LogIn.java
f11d58cc0db55ccb962ac68388195081f7c50505
[]
no_license
radioidioteke/SUIKA
122ceccc4a127df94b5a2e1806cf38c0ef048e0f
b6c85a4252cfbc7045880dcae267656241dc20b0
refs/heads/master
2016-09-11T05:50:57.440938
2014-01-06T21:48:49
2014-01-06T21:48:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,099
java
package cl.suika.cineschile; import java.util.Arrays; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import cl.suika.cineschile.R; import cl.suika.cineschile.connection.AsyncResponse; import cl.suika.cineschile.connection.ConnectionFacebookLogin; import cl.suika.cineschile.connection.ConnectionLogIn; import cl.suika.cineschile.database.DbHelper; import cl.suika.cineschile.utils.HeightResizeAnimation; import cl.suika.cineschile.utils.LoadingDialog; import cl.suika.cineschile.utils.Varios; import com.facebook.AppEventsLogger; import com.facebook.Request; import com.facebook.Response; import com.facebook.Session; import com.facebook.SessionState; import com.facebook.UiLifecycleHelper; import com.facebook.model.GraphUser; import com.facebook.widget.LoginButton; import com.google.analytics.tracking.android.EasyTracker; import com.parse.Parse; import com.parse.ParseInstallation; import com.parse.PushService; public class LogIn extends Activity implements AsyncResponse { private UiLifecycleHelper uiHelper; private LoadingDialog preloader; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); Parse.initialize(this, getString(R.string.parse_appId), getString(R.string.parse_clientKey)); PushService.subscribe(this, getString(R.string.parse_channel), Notificaciones.class); PushService.setDefaultPushCallback(this, Notificaciones.class); ParseInstallation.getCurrentInstallation().saveInBackground(); if (!Varios.getMasterTokn(this).equals("null")) { startActivity(new Intent(this, Main.class)); finish(); return; } uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onCreate(savedInstanceState); LoginButton loginButton = (LoginButton) findViewById(R.id.login_button); loginButton.setReadPermissions(Arrays.asList("email", "user_birthday")); preloader = new LoadingDialog(this); if (Varios.database == null || !Varios.database.isOpen()) { DbHelper dbHelper = new DbHelper(this); Varios.database = dbHelper.getWritableDatabase(); } setListeners(); Button suikaLoginButton = (Button) findViewById(R.id.suikaLoginButton); suikaLoginButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { LinearLayout suikaLogCont = (LinearLayout) findViewById(R.id.suikaLoginContenedor); int toHeight = 0; if (suikaLogCont.getLayoutParams().height == 0) { toHeight = 200; } HeightResizeAnimation anim = new HeightResizeAnimation(suikaLogCont, Varios.cDpToPx(toHeight, LogIn.this), false); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { ((ScrollView) findViewById(R.id.masterScroll)).fullScroll(View.FOCUS_DOWN); if(((EditText) findViewById(R.id.User)).requestFocus()) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationStart(Animation arg0) { } }); anim.setFillAfter(true); anim.setDuration(500); suikaLogCont.startAnimation(anim); LoginButton login_button = (LoginButton) findViewById(R.id.login_button); int toHeightFb = 0; if (login_button.getLayoutParams().height == 0) { toHeightFb = 55; } HeightResizeAnimation anim2 = new HeightResizeAnimation(login_button, Varios.cDpToPx(toHeightFb, LogIn.this), false); anim2.setFillAfter(true); anim2.setDuration(500); login_button.startAnimation(anim2); View separatior = (View) findViewById(R.id.separatior); int separatiorH = 0; if (separatior.getLayoutParams().height == 0) { separatiorH = 20; } HeightResizeAnimation anim3 = new HeightResizeAnimation(separatior, Varios.cDpToPx(separatiorH, LogIn.this), false); anim3.setFillAfter(true); anim3.setDuration(500); separatior.startAnimation(anim3); } }); } @Override public void processFinish(Object[] output) { preloader.dismiss(); if (output[0].equals("OK")) { startActivity(new Intent(LogIn.this, Main.class)); finish(); } else { Toast.makeText(this, "" + output[0], Toast.LENGTH_LONG).show(); } } @Override protected void onResume() { super.onResume(); uiHelper.onResume(); Varios.clearAllNotifications = false; AppEventsLogger.activateApp(this, getString(R.string.facebook_app_id)); EasyTracker.getInstance(this).activityStart(this); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } @Override protected void onPause() { super.onPause(); uiHelper.onPause(); EasyTracker.getInstance(this).activityStop(this); } private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(final Session session, SessionState state, Exception exception) { if (state.toString().equals("OPENED")) { preloader.show(); Request.newMeRequest(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if (user != null && user.asMap().get("email") != null) { ConnectionFacebookLogin fblog = new ConnectionFacebookLogin(LogIn.this, LogIn.this, user); fblog.execute(); } else { Session session = Session.getActiveSession(); if (session != null && (session.isOpened())) { session.close(); } preloader.dismiss(); Toast.makeText(getApplicationContext(), "No se ha logrado iniciar sesi�n con Facebook", Toast.LENGTH_SHORT).show(); } } }).executeAsync(); } } }; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); } @Override public void onDestroy() { super.onDestroy(); if (Varios.database != null && Varios.database.isOpen()) { Varios.database.close(); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (((LinearLayout) findViewById(R.id.suikaLoginContenedor)).getLayoutParams().height != 0) { ((Button) findViewById(R.id.suikaLoginButton)).performClick(); } else { finish(); } return true; } return super.onKeyDown(keyCode, event); } private void setListeners() { ((Button) findViewById(R.id.inicioSesion)).setOnClickListener(new OnClickListener() { public void onClick(View v) { preloader.show(); String user = ((EditText) findViewById(R.id.User)).getText().toString(); String pass = ((EditText) findViewById(R.id.Pass)).getText().toString(); ConnectionLogIn log = new ConnectionLogIn(LogIn.this, LogIn.this, user, pass); log.execute(); } }); ((TextView) findViewById(R.id.registro)).setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivity(new Intent(LogIn.this, Registro.class)); } }); ((TextView) findViewById(R.id.forgotPass)).setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "soporte@chilediarios.cl" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Recuperar Contrase�a"); intent.putExtra(Intent.EXTRA_TEXT, ""); startActivity(Intent.createChooser(intent, "Recuperar Contrase�a")); } }); } }
[ "felipe.hernandez@suika.cl" ]
felipe.hernandez@suika.cl
6bf6983febf6cf5fe8af5078bb0687b107996629
99080931e5e96002d9a63b739b2f310b02313707
/src/main/java/com/kozlowst/microcache/MetaData.java
9ab5e71e480415a8d946e1187bd2888b82fb0aa9
[]
no_license
rysiekblah/micro-cache
79ed440b171e2b5bc8f31ef5eeb46cbab160550d
b627d74fb1bbb9aed975896950bce78ffada2ef1
refs/heads/master
2020-03-11T00:48:38.639068
2018-05-11T12:21:17
2018-05-11T12:21:17
129,672,467
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package com.kozlowst.microcache; import java.util.ArrayList; import java.util.List; import com.kozlowst.microcache.tuple.Tuples.Tuple2; import static com.kozlowst.microcache.tuple.Tuples.tuple; public class MetaData { private List<Tuple2> data = new ArrayList<>(); protected void add(Object k, Object v) { add(tuple(k, v)); } protected void add(Tuple2 tuple) { data.add(tuple); } public List<Tuple2> getData() { return data; } }
[ "tkozlowski007@gmail.com" ]
tkozlowski007@gmail.com
6800175cfd819401dae3f230ebbdd43d6968ff7e
62175f6420b447978e2ecd607171fc90df7f8a80
/src/main/java/com/dell/isg/smi/service/server/action/SimpleCORSFilter.java
52eb50fa029353ae5ab748a4634c04a3b3922ddb
[ "Apache-2.0" ]
permissive
prashanthlgowda/smi-service-dell-server-action
7cef306506fd3cf2b4213511cbbdeab5f1522ae8
827e9e3ffcff3f0ab0541a9555910bb509ba3d47
refs/heads/master
2020-12-30T15:08:23.180780
2017-10-02T16:21:35
2017-10-02T16:21:35
91,109,584
0
0
null
2017-05-12T16:21:12
2017-05-12T16:21:11
null
WINDOWS-1252
Java
false
false
1,258
java
/** * Copyright © 2017 DELL Inc. or its subsidiaries. All Rights Reserved. */ package com.dell.isg.smi.service.server.action; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; @Component public class SimpleCORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "PULL, POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with"); response.setHeader("Access-Control-Allow-Headers", "Content-Type, api_key, Authorization"); chain.doFilter(req, res); } public void init(FilterConfig filterConfig) { } public void destroy() { } }
[ "Michael_Hepfer@dell.com" ]
Michael_Hepfer@dell.com
23fba64000b8d75daccbf9026863ad4443096f3c
4596ba28a1c935d8bba57e4093da2d52c992d5a1
/libaray/src/main/java/com/jsq/gav/gles/GlUtil.java
2fae907c4fa2e9287e619ef4f265efdbf2e66a46
[ "MIT" ]
permissive
JarvisBuop/gav
706db2677ae38742cdd125073b58368bbe574078
a9ed61f6e5ad4359a88a0a50ae47da4d4c392189
refs/heads/master
2020-09-30T17:55:59.619986
2019-11-27T03:22:39
2019-11-27T03:22:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,896
java
/* * Copyright 2014 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jsq.gav.gles; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLES20; import android.opengl.GLES30; import android.opengl.GLUtils; import android.opengl.Matrix; import android.util.Log; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; /** * Some OpenGL utility functions. */ public class GlUtil { public static final String TAG = "LibVideo"; /** * Identity matrix for general use. Don't modify or life will get weird. */ public static final float[] IDENTITY_MATRIX; static { IDENTITY_MATRIX = new float[16]; Matrix.setIdentityM(IDENTITY_MATRIX, 0); } private static final int SIZEOF_FLOAT = 4; private GlUtil() { } // do not instantiate /** * Creates a new program from the supplied vertex and fragment shaders. * * @return A handle to the program, or 0 on failure. */ public static int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); if (pixelShader == 0) { return 0; } int program = GLES20.glCreateProgram(); checkGlError("glCreateProgram"); if (program == 0) { Log.e(TAG, "Could not create program"); } GLES20.glAttachShader(program, vertexShader); checkGlError("glAttachShader"); GLES20.glAttachShader(program, pixelShader); checkGlError("glAttachShader"); GLES20.glLinkProgram(program); int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] != GLES20.GL_TRUE) { Log.e(TAG, "Could not link program: "); Log.e(TAG, GLES20.glGetProgramInfoLog(program)); GLES20.glDeleteProgram(program); program = 0; } return program; } /** * Compiles the provided shader source. * * @return A handle to the shader, or 0 on failure. */ public static int loadShader(int shaderType, String source) { int shader = GLES20.glCreateShader(shaderType); checkGlError("glCreateShader type=" + shaderType); GLES20.glShaderSource(shader, source); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (compiled[0] == 0) { Log.e(TAG, "Could not compile shader " + shaderType + ":"); Log.e(TAG, " " + GLES20.glGetShaderInfoLog(shader)); GLES20.glDeleteShader(shader); shader = 0; } return shader; } /** * Checks to see if a GLES error has been raised. */ public static void checkGlError(String op) { int error = GLES20.glGetError(); if (error != GLES20.GL_NO_ERROR) { String msg = op + ": glError 0x" + Integer.toHexString(error); Log.e(TAG, msg); throw new RuntimeException(msg); } } /** * Checks to see if the location we obtained is valid. GLES returns -1 if a label * could not be found, but does not set the GL error. * <p> * Throws a RuntimeException if the location is invalid. */ public static void checkLocation(int location, String label) { if (location < 0) { throw new RuntimeException("Unable to locate '" + label + "' in program"); } } /** * Creates a texture from raw data. * * @param data Image data, in a "direct" ByteBuffer. * @param width Texture width, in pixels (not bytes). * @param height Texture height, in pixels. * @param format Image data format (use constant appropriate for glTexImage2D(), e.g. GL_RGBA). * @return Handle to texture. */ public static int createImageTexture(ByteBuffer data, int width, int height, int format) { int[] textureHandles = new int[1]; int textureHandle; GLES20.glGenTextures(1, textureHandles, 0); textureHandle = textureHandles[0]; GlUtil.checkGlError("glGenTextures"); // Bind the texture handle to the 2D texture target. GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle); // Configure min/mag filtering, i.e. what scaling method do we use if what we're rendering // is smaller or larger than the source image. GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GlUtil.checkGlError("loadImageTexture"); // Load the data from the buffer into the texture handle. GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, /*level*/ 0, format, width, height, /*border*/ 0, format, GLES20.GL_UNSIGNED_BYTE, data); GlUtil.checkGlError("loadImageTexture"); return textureHandle; } public static int createImageTexture(InputStream inputStream) { int textureId = genTextureId(); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); return textureId; } public static void bindImageTexture(int textureId, InputStream inputStream) { Bitmap bitmap = BitmapFactory.decodeStream(inputStream); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); } public static void glClearColor() { GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); } public static int createImageTexture(String filename) { int textureId = genTextureId(); bindImageTexture(textureId, filename); return textureId; } public static void bindImageTexture(int textureId, String filename) { Bitmap bitmap = BitmapFactory.decodeFile(filename); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); } public static int genTextureId() { int[] textures = new int[1]; GLES20.glGenTextures(1, textures, 0); return textures[0]; } public static FloatBuffer createFloatBuffer(float[] coords) { FloatBuffer buffer = ByteBuffer.allocateDirect(coords.length * SIZEOF_FLOAT) .order(ByteOrder.nativeOrder()) .asFloatBuffer(); buffer.put(coords).position(0); return buffer; } /** * Writes GL version info to the log. */ public static void logVersionInfo() { Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR)); Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER)); Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION)); if (false) { int[] values = new int[1]; GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0); int majorVersion = values[0]; GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0); int minorVersion = values[0]; if (GLES30.glGetError() == GLES30.GL_NO_ERROR) { Log.i(TAG, " version: " + majorVersion + "." + minorVersion); } } } }
[ "jiang947@163.com" ]
jiang947@163.com
c581d5d9488599de0e6ab0826dc96df27f86f666
7f449f8d9a2f3636547617e45ae22156e24add75
/app/src/main/java/com/leruka/leruka/net/ErrorCodes.java
b8a11e6197f70d9dcd22ee6cfb5ab57e29d2a892
[]
no_license
Leruka/leruka
93f4dfad474c26984c669467efbdffd20588f0ad
d772ebe179963f1c3dfbb9de7dbe126bf057021b
refs/heads/master
2021-01-17T14:40:45.739026
2016-06-10T20:06:58
2016-06-10T20:06:58
44,250,072
1
2
null
null
null
null
UTF-8
Java
false
false
1,430
java
package com.leruka.leruka.net; /** * This is a copy of the file from the lerukaServer. Theses codes are returned in case of an error. */ public class ErrorCodes { // Request public final static int REQUEST_CONTENT_TYPE_NOT_JSON = 101; // User public static final int USER_NAME_USED = 201; public static final int USER_NAME_INVALID = 202; public static final int USER_PASS_INVALID = 203; // Database public static final int DB_UNKNOWN_ERROR = 301; public static String getReadableError(com.leruka.protobuf.ErrorCodes.ErrorCode code) { switch (code) { case LOGIN_NAME_UNKNOWN: return "Der Nickmane ist nicht vergeben"; case LOGIN_PASS_WRONG: return "Das Passwort ist falsch"; case USER_NAME_INVALID: return "Der Nickname ist ungültig"; case USER_PASS_INVALID: return "Das Passwort ist ungültig"; case REGISTER_NAME_USED: return "Der Nickname wird bereits verwendet"; case REQUEST_WRONG_CONTENT_TYPE: return "Es ist ein Fehler bei der Kommunikation aufgetreten (" + code.name() + ")"; case DB_UNKNOWN_ERROR: return "Es ist ein Serverfehler aufgetreten"; default: return "Es ist ein unbekannter Fehler aufgetreten (" + code.name() + ")"; } } }
[ "leif.bernsdorf@tariwe.de" ]
leif.bernsdorf@tariwe.de
ba328ee77318707cd6234ae0c9ca1155259ec266
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_57b5927094e701e90467f159f11e9d1c2731a5c6/DictionaryFactory/5_57b5927094e701e90467f159f11e9d1c2731a5c6_DictionaryFactory_t.java
d1d758723eaf4afbfa4f449e01dd93a3abb0f5f8
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
13,754
java
package com.menny.android.anysoftkeyboard.dictionary; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import android.util.Log; import com.menny.android.anysoftkeyboard.AnyKeyboardContextProvider; import com.menny.android.anysoftkeyboard.AnySoftKeyboardConfiguration; import com.menny.android.anysoftkeyboard.dictionary.ExternalDictionaryFactory.DictionaryBuilder; public class DictionaryFactory { private static UserDictionaryBase msUserDictionary = null; private static final List<Dictionary> msDictionaries; // Maps id to specific index in msDictionaries private static final Map<String, Integer> msDictionariesById; // Maps language to specific index in msDictionaries private static final Map<String, Integer> msDictionariesByLanguage; static { msDictionaries = new ArrayList<Dictionary>(); msDictionariesById = new HashMap<String, Integer>(); msDictionariesByLanguage = new HashMap<String, Integer>(); } public synchronized static UserDictionaryBase createUserDictionary(AnyKeyboardContextProvider context) { if (msUserDictionary == null) { try { msUserDictionary = new AndroidUserDictionary(context); msUserDictionary.loadDictionary(); } catch(final Exception ex) { Log.w("AnySoftKeyboard", "Failed to load 'AndroidUserDictionary' (could be that the platform does not support it). Will use fall-back dictionary. Error:"+ex.getMessage()); try { msUserDictionary = new FallbackUserDictionary(context); msUserDictionary.loadDictionary(); } catch (final Exception e) { Log.e("AnySoftKeyboard", "Failed to load failback user dictionary!"); e.printStackTrace(); } } } return msUserDictionary; } public synchronized static Dictionary getDictionaryByLanguage(final String language, AnyKeyboardContextProvider context){ return getDictionaryImpl(language, null, context); } public synchronized static Dictionary getDictionaryById(final String id, AnyKeyboardContextProvider context){ return getDictionaryImpl(null, id, context); } private synchronized static Dictionary getDictionaryImpl(final String language, final String id, AnyKeyboardContextProvider context) { final String languageFormat = language == null ? "(null)" : language; final String idFormat = id == null ? "(null)" : id; if (language != null && msDictionariesByLanguage.containsKey(language)) { return msDictionaries.get(msDictionariesByLanguage.get(language)); } if (id != null && msDictionariesById.containsKey(id)) { return msDictionaries.get(msDictionariesById.get(id)); } Dictionary dict = null; try { if(id == null) { if ((language == null) || (language.length() == 0 || ("none".equalsIgnoreCase(language)))) { return null; } } if(language == null) { if ((id == null) || (id.length() == 0 || ("none".equalsIgnoreCase(id)))) { return null; } } if(id != null) { dict = locateDictionaryByIdInFactory(id, context); } else if(language != null) { dict = locateDictionaryByLanguageInFactory(language, context); } if (dict == null) { Log.d("DictionaryFactory", MessageFormat.format("Could not locate dictionary for language {0} and id {1}. Maybe it was not loaded yet (installed recently?)", new Object[]{languageFormat, idFormat})); ExternalDictionaryFactory.resetBuildersCache(); //trying again if(id != null) { dict = locateDictionaryByIdInFactory(id, context); } else if(language != null) { dict = locateDictionaryByLanguageInFactory(language, context); } if (dict == null) Log.w("DictionaryFactory", MessageFormat.format("Could not locate dictionary for language {0} and id {1}.", new Object[]{languageFormat, idFormat})); } //checking again, cause it may have loaded the second try. if (dict != null) { final Dictionary dictToLoad = dict; final Thread loader = new Thread() { @Override public void run() { try { dictToLoad.loadDictionary(); } catch (final Exception e) { Log.e("DictionaryFactory", MessageFormat.format( "Failed load dictionary for language {0} with id {1}! Will reset the map. Error:{2}", new Object[]{languageFormat, idFormat, e.getMessage()})); e.printStackTrace(); if(id != null) { removeDictionaryById(id); }else { removeDictionaryByLanguage(language); } } } }; //a little less... loader.setPriority(Thread.NORM_PRIORITY - 1); loader.start(); if(id != null) { addDictionaryById(id, dict); }else { addDictionaryByLanguage(language, dict); } } } catch(final Exception ex) { Log.e("DictionaryFactory", "Failed to load main dictionary for: "+language); ex.printStackTrace(); } return dict; } private static Dictionary locateDictionaryByLanguageInFactory(final String language, AnyKeyboardContextProvider context) throws Exception { Dictionary dict = null; if (language == null) return dict; final ArrayList<DictionaryBuilder> allBuilders = ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext()); for(DictionaryBuilder builder : allBuilders) { if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()){ Log.d("DictionaryFactory", MessageFormat.format("Checking if builder ''{0}'' with locale ''{1}'' matches locale ''{2}''", new Object[] {builder.getId(), builder.getLanguage(), language})); } if (builder.getLanguage().equalsIgnoreCase(language)) { dict = builder.createDictionary(); break; } } return dict; } private static Dictionary locateDictionaryByIdInFactory(final String id, AnyKeyboardContextProvider context) throws Exception { Dictionary dict = null; if (id == null) return dict; final ArrayList<DictionaryBuilder> allBuilders = ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext()); for(DictionaryBuilder builder : allBuilders) { if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()){ Log.d("DictionaryFactory", MessageFormat.format("Checking if builder ''{0}'' with locale ''{1}'' matches id ''{2}''", new Object[] {builder.getId(), builder.getLanguage(), id})); } if (builder.getId().equalsIgnoreCase(id)) { dict = builder.createDictionary(); break; } } return dict; } public synchronized static void addDictionaryByLanguage(String language, Dictionary dictionary) { if(language == null || dictionary == null) return; // Add dictionary to msDictionaries, if necessary int position = msDictionaries.indexOf(dictionary); if(position < 0) { msDictionaries.add(dictionary); position = msDictionaries.size() - 1; } assert msDictionaries.get(position) == dictionary; // Overwrite/Create language->dictionary mapping msDictionariesByLanguage.put(language, position); } public synchronized static void addDictionaryById(String id, Dictionary dictionary) { if(id == null || dictionary == null) return; // Add dictionary to msDictionaries, if necessary int position = msDictionaries.indexOf(dictionary); if(position < 0) { msDictionaries.add(dictionary); position = msDictionaries.size() - 1; } assert msDictionaries.get(position) == dictionary; // Overwrite/Create id->dictionary mapping msDictionariesById.put(id, position); } public synchronized static void removeDictionaryByLanguage(String language) { if(language == null) return; if (msDictionariesByLanguage.containsKey(language)) { final int index = msDictionariesByLanguage.get(language); final Dictionary dict = msDictionaries.get(index); dict.close(); msDictionaries.remove(index); msDictionariesById.remove(language); Collection<Integer> languageMappings = msDictionariesByLanguage.values(); // Note that changes in this collection are mapped back to the map which // is what we want languageMappings.remove(index); } } public synchronized static void removeDictionaryById(String id) { if(id == null) return; if (msDictionariesById.containsKey(id)) { final int index = msDictionariesById.get(id); final Dictionary dict = msDictionaries.get(index); dict.close(); msDictionaries.remove(index); msDictionariesById.remove(id); Collection<Integer> idMappings = msDictionariesById.values(); // Note that changes in this collection are mapped back to the map which // is what we want idMappings.remove(index); } } public synchronized static void close() { if (msUserDictionary != null) { msUserDictionary.close(); } for(final Dictionary dict : msDictionaries) { dict.close(); } msUserDictionary = null; msDictionaries.clear(); msDictionariesById.clear(); msDictionariesByLanguage.clear(); } public static void releaseAllDictionaries() { close(); } public synchronized static void onLowMemory(Dictionary currentlyUsedDictionary) { //I'll clear all dictionaries but the required. Dictionary dictToKeep = null; int index = msDictionaries.indexOf(currentlyUsedDictionary); if(index >= 0) { dictToKeep = msDictionaries.get(index); } String idMappingToDict = null; String languageMappingToDict = null; // We search first the id->dictionary mapping and // then language->dictionary mapping. { Iterator<Entry<String, Integer>> idIterator = msDictionariesById.entrySet().iterator(); while(idIterator.hasNext()) { Entry<String, Integer> value = idIterator.next(); if(value.getValue() == index) { idMappingToDict = value.getKey(); break; } } } Iterator<Entry<String, Integer>> languageIterator = msDictionariesByLanguage.entrySet().iterator(); while(languageIterator.hasNext()) { Entry<String, Integer> value = languageIterator.next(); if(value.getValue() == index) { languageMappingToDict = value.getKey(); break; } } assert idMappingToDict != null || languageMappingToDict != null; msDictionaries.clear(); msDictionariesByLanguage.clear(); msDictionariesById.clear(); if (dictToKeep != null) { if(idMappingToDict != null){ addDictionaryById(idMappingToDict, currentlyUsedDictionary); } if(languageMappingToDict != null){ addDictionaryByLanguage(languageMappingToDict, currentlyUsedDictionary); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
a3730d97241a56827a4afbc696c65a461bfe19ca
695473e69dc92a6e116eaccbb59b9fa0dad7e1dc
/src/main/java/com/solomon/mvc/repository/exception/ToDoPersistenseException.java
b3884d7a620943eff71da39807cdb165c920a4fa
[]
no_license
Solomon3038/mvc
1c3455da16ef0b60a19a39b53164aa683ed40d05
19a774a05d7c29bf63f821ed64aabdf331bde965
refs/heads/master
2020-03-14T08:10:19.433485
2018-08-05T11:37:30
2018-08-05T11:37:30
131,519,038
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.solomon.mvc.repository.exception; public abstract class ToDoPersistenseException extends RuntimeException { //rootklass exception public ToDoPersistenseException() { } public ToDoPersistenseException(String message) { super(message); } public ToDoPersistenseException(String message, Throwable cause) { super(message, cause); } public ToDoPersistenseException(Throwable cause) { super(cause); } }
[ "anhalt79@gmail.com" ]
anhalt79@gmail.com
952f4639a63e5a386915d085c0b71036f3e196f7
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/25c3f18240f0ff935f294f91253b333734201cf1/after/StringPattern.java
99b7df238521a2021cda1dce9734b6aa695e656c
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
7,043
java
/* * Copyright 2000-2009 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.patterns; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ProcessingContext; import dk.brics.automaton.Automaton; import dk.brics.automaton.DatatypesAutomatonProvider; import dk.brics.automaton.RegExp; import dk.brics.automaton.RunAutomaton; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Collections; import java.util.regex.Pattern; /** * @author peter */ public class StringPattern extends ObjectPattern<String, StringPattern> { private static final InitialPatternCondition<String> CONDITION = new InitialPatternCondition<String>(String.class) { @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof String; } @Override public void append(@NotNull @NonNls final StringBuilder builder, final String indent) { builder.append("string()"); } }; protected StringPattern() { super(CONDITION); } @NotNull public StringPattern startsWith(@NonNls @NotNull final String s) { return with(new PatternCondition<String>("startsWith") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { return str.startsWith(s); } }); } @NotNull public StringPattern endsWith(@NonNls @NotNull final String s) { return with(new PatternCondition<String>("endsWith") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { return str.endsWith(s); } }); } @NotNull public StringPattern contains(@NonNls @NotNull final String s) { return with(new PatternCondition<String>("contains") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { return str.contains(s); } }); } @NotNull public StringPattern containsChars(@NonNls @NotNull final String s) { return with(new PatternCondition<String>("containsChars") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { for (int i=0, len=s.length(); i<len; i++) { if (str.indexOf(s.charAt(i))>-1) return true; } return false; } }); } @NotNull public StringPattern matches(@NonNls @NotNull final String s) { final String escaped = StringUtil.escapeToRegexp(s); if (escaped.equals(s)) { return equalTo(s); } // may throw PatternSyntaxException here final Pattern pattern = Pattern.compile(s); return with(new ValuePatternCondition<String>("matches") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { return pattern.matcher(newBombedCharSequence(str)).matches(); } @Override public Collection<String> getValues() { return Collections.singleton(s); } }); } @NotNull public StringPattern matchesBrics(@NonNls @NotNull final String s) { final String escaped = StringUtil.escapeToRegexp(s); if (escaped.equals(s)) { return equalTo(s); } StringBuilder sb = new StringBuilder(s.length()*5); for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); if(c == ' ') { sb.append("<whitespace>"); } else //This is really stupid and inconvenient builder - it breaks any normal pattern with uppercase if(Character.isUpperCase(c)) { sb.append('[').append(Character.toUpperCase(c)).append(Character.toLowerCase(c)).append(']'); } else { sb.append(c); } } final RegExp regExp = new RegExp(sb.toString()); final Automaton automaton = regExp.toAutomaton(new DatatypesAutomatonProvider()); final RunAutomaton runAutomaton = new RunAutomaton(automaton, true); return with(new ValuePatternCondition<String>("matchesBrics") { @Override public boolean accepts(@NotNull String str, final ProcessingContext context) { if (!str.isEmpty() && (str.charAt(0) == '"' || str.charAt(0) == '\'')) str = str.substring(1); return runAutomaton.run(str); } @Override public Collection<String> getValues() { return Collections.singleton(s); } }); } @NotNull public StringPattern contains(@NonNls @NotNull final ElementPattern<Character> pattern) { return with(new PatternCondition<String>("contains") { @Override public boolean accepts(@NotNull final String str, final ProcessingContext context) { for (int i = 0; i < str.length(); i++) { if (pattern.accepts(str.charAt(i))) return true; } return false; } }); } public StringPattern longerThan(final int minLength) { return with(new PatternCondition<String>("longerThan") { @Override public boolean accepts(@NotNull final String s, final ProcessingContext context) { return s.length() > minLength; } }); } public StringPattern shorterThan(final int maxLength) { return with(new PatternCondition<String>("shorterThan") { @Override public boolean accepts(@NotNull final String s, final ProcessingContext context) { return s.length() < maxLength; } }); } public StringPattern withLength(final int length) { return with(new PatternCondition<String>("withLength") { @Override public boolean accepts(@NotNull final String s, final ProcessingContext context) { return s.length() == length; } }); } @Override @NotNull public StringPattern oneOf(@NonNls final String... values) { return super.oneOf(values); } @NotNull public StringPattern oneOfIgnoreCase(@NonNls final String... values) { return with(new CaseInsensitiveValuePatternCondition("oneOfIgnoreCase", values)); } @Override @NotNull public StringPattern oneOf(@NonNls final Collection<String> set) { return super.oneOf(set); } @NotNull public static CharSequence newBombedCharSequence(@NotNull CharSequence sequence) { return new StringUtil.BombedCharSequence(sequence) { @Override protected void checkCanceled() { ProgressManager.checkCanceled(); } }; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
78e83c06f4ec79604fff8ff6e4e96f8a6adae91b
decd484becb3e113302da3c15f785ad232266dd3
/src/main/java/com/xinonix/retrofhir/interactor/DocumentReferenceInteractor.java
de3aa3213de192353afb35147bff2172fe7dd1b4
[ "LicenseRef-scancode-other-permissive", "MIT" ]
permissive
davidvaccaro/RetroFHIR
9dae11512568ce9db078e1c3ae99578bd77a7562
a40d8e3ee5af2df8ce8b6f4e51c695127e6c2a54
refs/heads/master
2020-03-20T22:00:56.319726
2018-06-18T18:28:10
2018-06-18T18:28:10
137,774,389
0
0
null
null
null
null
UTF-8
Java
false
false
937
java
package com.xinonix.retrofhir.interactor; import com.xinonix.retrofhir.Parameters; import com.xinonix.retrofhir.service.DocumentReferenceService; import com.xinonix.hl7.fhir.stu3.DocumentReference; public class DocumentReferenceInteractor extends ResourceInteractor<DocumentReferenceService, DocumentReference> { public static class DocumentReferenceComposer extends Composer<DocumentReferenceService, DocumentReference, DocumentReferenceComposer> { public DocumentReferenceComposer() { super((Class) DocumentReferenceService.class, (Class) DocumentReference.class); } public ResourceInteractor.Composer setStatus(DocumentReference.Status value) { return setParameter(Parameters.STATUS, value); } } public static <T> DocumentReferenceInteractor.DocumentReferenceComposer Composer() { return new DocumentReferenceComposer(); } }
[ "dvaccaro@xinonix.com" ]
dvaccaro@xinonix.com
1118f050b7e2049d4b7ffb887523e06f71376346
00ca10fb9e9f3ce097366fa22e3fd6d852c68fb9
/src/main/java/com/abc/rest/webservice/restfulwebservices/bean/UserTypeBean.java
26816a203df3c94661a4f803bffd149b5fb69a21
[]
no_license
parthpatel2310/TodoApplication-RestAPI-
c5eb613778fbe37280fc04db60ea28bb18a5ce65
1d3a665ed67d2a324a7b21dc87f4d83e039ca305
refs/heads/master
2021-08-26T07:39:01.938430
2021-08-03T18:27:45
2021-08-03T18:27:45
237,284,588
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
package com.abc.rest.webservice.restfulwebservices.bean; import org.springframework.web.bind.annotation.CrossOrigin; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name="USERTYPE") @CrossOrigin public class UserTypeBean implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "usertypeid") private int id; private String userTypeName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserTypeName() { return userTypeName; } public void setUserTypeName(String userTypeName) { this.userTypeName = userTypeName; } public UserTypeBean(){ } public UserTypeBean(int id) { this.id = id; } public UserTypeBean(int i, String user) { id =i; userTypeName = user; } }
[ "parth.patelpp180@gmail.com" ]
parth.patelpp180@gmail.com
904752ba1d67a52d0ed1059188bded74af62e269
f40747ed1b112514f5c7a9190708cb384dbf5f7a
/spi/src/main/java/io/machinecode/chainlink/spi/inject/ArtifactReference.java
27ca7e05823d9557c4acad8ab16ad782ba82c4f5
[ "Apache-2.0" ]
permissive
machinecode-io/chainlink
aa755924d587377a8dcca8178e3359f9f417023e
31d5c367bd94ce83f3d0fa7a22b38c680651eb5a
refs/heads/master
2020-12-30T18:16:06.669427
2015-03-09T23:30:27
2015-03-09T23:30:27
21,302,325
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
package io.machinecode.chainlink.spi.inject; import io.machinecode.chainlink.spi.context.ExecutionContext; /** * @author <a href="mailto:brent.n.douglas@gmail.com">Brent Douglas</a> * @since 1.0 */ public interface ArtifactReference { /** * @return The identifier of this artifact. */ String ref(); /** * @param as The interface to load the artifact as. * @param injectionContext * @param context * @param <T> The type of the loaded artifact. * @return The artifact identified by {@link #ref()} or null if none can be found. * @throws ArtifactOfWrongTypeException If the artifact loaded does not implement {@param as}. * @throws Exception If an error occurs. */ <T> T load(final Class<T> as, final InjectionContext injectionContext, final ExecutionContext context) throws Exception; }
[ "brent.n.douglas@gmail.com" ]
brent.n.douglas@gmail.com
c5a272f219fcf97263752c88a2ce69a8a9d2e7da
c480638920377d2d7c608bef553193b6c2e36bd3
/pinjamkelas/app/src/main/java/id/ac/nurulfikri/pinjamkelas/NotifActivity.java
0a5f559fff8660a2f8ef559f0d39d7a0e312897b
[]
no_license
nopiansyahhh/androPinjamKelas
03ca7aad6b221841bba96d8472534f76838d8be9
9ca6c3353860ecfc9c0b60aad9209ffb964a2a8f
refs/heads/master
2020-09-04T02:22:54.084442
2020-01-17T03:28:29
2020-01-17T03:28:29
219,637,460
0
0
null
null
null
null
UTF-8
Java
false
false
1,708
java
package id.ac.nurulfikri.pinjamkelas; import androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class NotifActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notif_berhasil); final ImageView menuHome = findViewById(R.id.menuHome); menuHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent( NotifActivity.this, HomepageActivity.class ); startActivity(i); } }); final ImageView menuPinjam = findViewById(R.id.menuPeminjaman); menuPinjam.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent( NotifActivity.this, PeminjamanActivity.class ); startActivity(i); } }); final ImageView menuRiwayat = findViewById(R.id.menuRiwayat); menuRiwayat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent( NotifActivity.this, RiwayatActivity.class ); startActivity(i); } }); } }
[ "nopiansyahhh@gmail.com" ]
nopiansyahhh@gmail.com
dfc9fc1b30dfcb04e949a43099b7a67e2da6cbed
ceeacb5157b67b43d40615daf5f017ae345816db
/generated/sdk/storage/azure-resourcemanager-storage-generated/src/main/java/com/azure/resourcemanager/storage/generated/models/LeaseStatus.java
3ffce72b371fb50aee67f666918d08ae89acf4ce
[ "LicenseRef-scancode-generic-cla" ]
no_license
ChenTanyi/autorest.java
1dd9418566d6b932a407bf8db34b755fe536ed72
175f41c76955759ed42b1599241ecd876b87851f
refs/heads/ci
2021-12-25T20:39:30.473917
2021-11-07T17:23:04
2021-11-07T17:23:04
218,717,967
0
0
null
2020-11-18T14:14:34
2019-10-31T08:24:24
Java
UTF-8
Java
false
false
1,160
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.storage.generated.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** Defines values for LeaseStatus. */ public final class LeaseStatus extends ExpandableStringEnum<LeaseStatus> { /** Static value Locked for LeaseStatus. */ public static final LeaseStatus LOCKED = fromString("Locked"); /** Static value Unlocked for LeaseStatus. */ public static final LeaseStatus UNLOCKED = fromString("Unlocked"); /** * Creates or finds a LeaseStatus from its string representation. * * @param name a name to look for. * @return the corresponding LeaseStatus. */ @JsonCreator public static LeaseStatus fromString(String name) { return fromString(name, LeaseStatus.class); } /** @return known LeaseStatus values. */ public static Collection<LeaseStatus> values() { return values(LeaseStatus.class); } }
[ "actions@github.com" ]
actions@github.com
ff43814ad2e5245620a9f31cc1e09d40ac8b23d8
0b017a9374af66e9b79f2e45849c91f9f476b94e
/company.java
7876e050cf6039a71cd49835ea73a566a334aa63
[]
no_license
amuleek/java
0c9100d7ec502d728da5e2b45d66a87ed346b7d0
357ae48e56a7d11167b896c091cdaeb9e1174600
refs/heads/master
2020-12-23T01:01:22.169809
2020-06-07T17:05:43
2020-06-07T17:05:43
236,984,285
3
0
null
null
null
null
UTF-8
Java
false
false
358
java
class Company { String domainName; // object is created in another class public Company(){ domainName = "programiz.com"; } } public class CompanyImplementation { public static void main(String[] args) { Company companyObj = new Company(); System.out.println("Domain name = "+ companyObj.domainName); } }
[ "noreply@github.com" ]
amuleek.noreply@github.com
f844f4ba67ca3768d5c789862c22d23da92d7378
01dfb27f1288a9ed62f83be0e0aeedf121b4623a
/Contabilidade/src/java/com/t2tierp/contabilidade/cliente/ContabilHistoricoGridController.java
182d8b17c086b4372b6c1aed523d387e362e30a1
[ "MIT" ]
permissive
FabinhuSilva/T2Ti-ERP-2.0-Java-OpenSwing
deb486a13c264268d82e5ea50d84d2270b75772a
9531c3b6eaeaf44fa1e31b11baa630dcae67c18e
refs/heads/master
2022-11-16T00:03:53.426837
2020-07-08T00:36:48
2020-07-08T00:36:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,675
java
/* * The MIT License * * Copyright: Copyright (C) 2014 T2Ti.COM * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * The author may be contacted at: t2ti.com@gmail.com * * @author Claudio de Barros (T2Ti.com) * @version 2.0 */ package com.t2tierp.contabilidade.cliente; import com.t2tierp.padrao.java.Constantes; import com.t2tierp.contabilidade.java.ContabilHistoricoVO; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.openswing.swing.client.GridControl; import org.openswing.swing.mdi.client.MDIFrame; import org.openswing.swing.message.receive.java.Response; import org.openswing.swing.message.receive.java.ValueObject; import org.openswing.swing.message.send.java.GridParams; import org.openswing.swing.table.client.GridController; import org.openswing.swing.table.java.GridDataLocator; import org.openswing.swing.util.client.ClientUtils; public class ContabilHistoricoGridController extends GridController implements GridDataLocator { private ContabilHistoricoGrid grid; private String acaoServidor; public ContabilHistoricoGridController() { grid = new ContabilHistoricoGrid(this); acaoServidor = "contabilHistoricoGridAction"; MDIFrame.add(grid); } public Response loadData(int action, int startIndex, Map filteredColumns, ArrayList currentSortedColumns, ArrayList currentSortedVersusColumns, Class valueObjectType, Map otherGridParams) { //define os parametros da grid otherGridParams.put("acao", Constantes.LOAD); return ClientUtils.getData(acaoServidor, new GridParams(action, startIndex, filteredColumns, currentSortedColumns, currentSortedVersusColumns, otherGridParams)); } @Override public boolean beforeInsertGrid(GridControl grid) { new ContabilHistoricoDetalheController(this.grid, null); return false; } @Override public void doubleClick(int rowNumber, ValueObject persistentObject) { ContabilHistoricoVO contabilHistorico = (ContabilHistoricoVO) persistentObject; new ContabilHistoricoDetalheController(grid, contabilHistorico.getId().toString()); } @Override public Response deleteRecords(ArrayList persistentObjects) throws Exception { //define os parametros da grid Map otherGridParams = new HashMap(); otherGridParams.put("acao", Constantes.DELETE); otherGridParams.put("persistentObjects", persistentObjects); //seta os parametros da grid GridParams pars = new GridParams(0, 0, null, null, null, otherGridParams); return ClientUtils.getData(acaoServidor, pars); } }
[ "claudiobsi@gmail.com" ]
claudiobsi@gmail.com
4bf74969a728dbbbdcabbcffc7f48129a3429138
a62e9571a0205d17e16e73de8d26075d2c36d0e1
/src/main/java/learning/edu/designpattern/chapter01/DuckCall.java
76c8b61fbad2246a6303f0d2ad867a16f23d552b
[]
no_license
duchuunguyen/designpattern
7c49f831db80b73eac0ecf343c452ddee7a87723
ae1ff1eef7d565baac5f7432bd93aa5b78705a3c
refs/heads/master
2021-01-21T15:12:48.523408
2017-06-29T03:11:50
2017-06-29T20:29:44
91,830,887
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package learning.edu.designpattern.chapter01; /** * Created by duchuunguyen on 5/17/2017. */ public class DuckCall { private Duck duck; public void setDuck(Duck duck) { this.duck = duck; } public void quack() { duck.performQuack(); } }
[ "duchuunguyen@kms-technology.com" ]
duchuunguyen@kms-technology.com
90cab28fa75ef0d2ab9e6317081af9a5db30e2bb
7181f1d750f07f905f9121852d056730476b64f1
/kang/app/src/main/java/com/lanmei/kang/qrcode/NCodeActivity.java
56852f4d118050862e9c2d3bb4a986d8d4692551
[]
no_license
xiongkai888/kang
f23e22daa24801023ce0d33f242a69c92ea2e3db
319af46e05b3839c4b3f0df0f9c3da102fc8b6cd
refs/heads/master
2020-03-29T18:42:55.552075
2019-01-18T08:26:38
2019-01-18T08:26:38
150,218,985
0
0
null
null
null
null
UTF-8
Java
false
false
1,939
java
package com.lanmei.kang.qrcode; import android.graphics.Bitmap; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.widget.ImageView; import com.lanmei.kang.R; import com.xson.common.app.BaseActivity; import com.xson.common.utils.UIHelper; import com.xson.common.widget.CenterTitleToolbar; import butterknife.InjectView; import cn.bingoogolapple.qrcode.core.BGAQRCodeUtil; import cn.bingoogolapple.qrcode.zxing.QRCodeEncoder; public class NCodeActivity extends BaseActivity { @InjectView(R.id.toolbar) CenterTitleToolbar mToolbar; @InjectView(R.id.img_code) ImageView imageView; @Override public int getContentViewId() { return R.layout.activity_code; } @Override protected void initAllMembersView(Bundle savedInstanceState) { setSupportActionBar(mToolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayShowTitleEnabled(true); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setTitle("消费二维码"); actionbar.setHomeAsUpIndicator(R.mipmap.back_g); String des3Code = getIntent().getStringExtra("value"); final String code = Des.encrypt(des3Code); new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... params) { return QRCodeEncoder.syncEncodeQRCode(code, BGAQRCodeUtil.dp2px(NCodeActivity.this, 250), Color.parseColor("#000000")); } @Override protected void onPostExecute(Bitmap bitmap) { if (bitmap != null) { imageView.setImageBitmap(bitmap); } else { UIHelper.ToastMessage(NCodeActivity.this, "生成二维码失败"); finish(); } } }.execute(); } }
[ "173422042@qq.com" ]
173422042@qq.com