blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea98053f4c4b5eec10473bd2062516e0740515f4 | 2be981887daa07d40efe1790001d1b4ff6f36c0e | /Server/src/main/java/com/goaleaf/validators/HabitTitleValidator.java | 1778777a7e1e59163bfabcd64046e4a83513db42 | [
"BSD-3-Clause"
] | permissive | Pplociennik/GoaLeaf | a8cc1a0d4c186b0d7bcf0eed22afb1f0108bf51d | a63f9379009aaebeab7cae0ebeb15394a0e70064 | refs/heads/master | 2022-10-15T20:50:56.601568 | 2020-01-21T23:38:34 | 2020-01-21T23:38:34 | 175,187,757 | 0 | 6 | NOASSERTION | 2022-09-22T18:39:34 | 2019-03-12T10:29:54 | Java | UTF-8 | Java | false | false | 182 | java | package com.goaleaf.validators;
public class HabitTitleValidator {
public boolean isValid(String title) {
return (title.length() <= 50 && title.length() >= 5);
}
}
| [
"przemx.84@gmail.com"
] | przemx.84@gmail.com |
4de255851f64d08a532f303ac9f493775ce6f2b9 | d555eb65b9c65999964dec7fbb5170c2d1001e48 | /src/main/java/com/future/phase2/tugas/TugasApplication.java | 94e68c0d2d9173b20f365690a2c001808562cab8 | [] | no_license | karnandohuang/tugas-day2-spring-boot | 3c93b91a42efe1ed71fa14dae3828905a1a667fb | 76eddb146d32c9b23015893e34b54a1327cdcf9b | refs/heads/master | 2020-04-15T11:19:20.045510 | 2019-01-09T16:34:11 | 2019-01-09T16:34:11 | 164,625,202 | 0 | 0 | null | 2019-01-09T16:34:23 | 2019-01-08T10:33:40 | Java | UTF-8 | Java | false | false | 315 | java | package com.future.phase2.tugas;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TugasApplication {
public static void main(String[] args) {
SpringApplication.run(TugasApplication.class, args);
}
}
| [
"karnandohuang@outlook.com"
] | karnandohuang@outlook.com |
8a3375296cfc1807fe5527bf452441620a5a54da | c56929f5a414d768a1d8b6c8b16db94f087fa2d2 | /app/src/main/java/com/MsoftTexas/WeatherOnMyTripRoute/Models/LatLng.java | 717726b74aff53fde7851a43fcd648f7f9b1a152 | [] | no_license | rishabhnayak/GMap_DarkSky_App | a844017e78c73922e85f5c361744635100f6235e | 700be39721746449f3e3fe4c78b553c92fab6f64 | refs/heads/master | 2020-04-01T17:56:00.513119 | 2019-01-09T17:18:38 | 2019-01-09T17:18:38 | 153,460,148 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java | package com.MsoftTexas.WeatherOnMyTripRoute.Models;
/*
* 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.
*/
import com.google.maps.internal.StringJoin.UrlValue;
import java.io.Serializable;
import java.util.Locale;
import java.util.Objects;
/** A place on Earth, represented by a latitude/longitude pair. */
public class LatLng implements UrlValue, Serializable {
private static final long serialVersionUID = 1L;
/** The latitude of this location. */
public double lat;
/** The longitude of this location. */
public double lng;
/**
* Constructs a location with a latitude/longitude pair.
*
* @param lat The latitude of this location.
* @param lng The longitude of this location.
*/
public LatLng(double lat, double lng) {
this.lat = lat;
this.lng = lng;
}
/** Serialisation constructor. */
public LatLng() {}
@Override
public String toString() {
return toUrlValue();
}
@Override
public String toUrlValue() {
// Enforce Locale to English for double to string conversion
return String.format(Locale.ENGLISH, "%.8f,%.8f", lat, lng);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LatLng latLng = (LatLng) o;
return Double.compare(latLng.lat, lat) == 0 && Double.compare(latLng.lng, lng) == 0;
}
@Override
public int hashCode() {
return Objects.hash(lat, lng);
}
} | [
"vasubantikamlesh@gmail.com"
] | vasubantikamlesh@gmail.com |
33b1d9fd5755f70bef370f2b8200f59eb9e2cc75 | 5b8337c39cea735e3817ee6f6e6e4a0115c7487c | /sources/androidx/legacy/app/FragmentStatePagerAdapter.java | a0f7b8700876a34f101847384503eef3aa426edf | [] | no_license | karthik990/G_Farm_Application | 0a096d334b33800e7d8b4b4c850c45b8b005ccb1 | 53d1cc82199f23517af599f5329aa4289067f4aa | refs/heads/master | 2022-12-05T06:48:10.513509 | 2020-08-10T14:46:48 | 2020-08-10T14:46:48 | 286,496,946 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,584 | java | package androidx.legacy.app;
import android.app.Fragment;
import android.app.Fragment.SavedState;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import androidx.viewpager.widget.PagerAdapter;
import java.util.ArrayList;
@Deprecated
public abstract class FragmentStatePagerAdapter extends PagerAdapter {
private static final boolean DEBUG = false;
private static final String TAG = "FragStatePagerAdapter";
private FragmentTransaction mCurTransaction = null;
private Fragment mCurrentPrimaryItem = null;
private final FragmentManager mFragmentManager;
private ArrayList<Fragment> mFragments = new ArrayList<>();
private ArrayList<SavedState> mSavedState = new ArrayList<>();
@Deprecated
public abstract Fragment getItem(int i);
@Deprecated
public FragmentStatePagerAdapter(FragmentManager fragmentManager) {
this.mFragmentManager = fragmentManager;
}
@Deprecated
public void startUpdate(ViewGroup viewGroup) {
if (viewGroup.getId() == -1) {
StringBuilder sb = new StringBuilder();
sb.append("ViewPager with adapter ");
sb.append(this);
sb.append(" requires a view id");
throw new IllegalStateException(sb.toString());
}
}
@Deprecated
public Object instantiateItem(ViewGroup viewGroup, int i) {
if (this.mFragments.size() > i) {
Fragment fragment = (Fragment) this.mFragments.get(i);
if (fragment != null) {
return fragment;
}
}
if (this.mCurTransaction == null) {
this.mCurTransaction = this.mFragmentManager.beginTransaction();
}
Fragment item = getItem(i);
if (this.mSavedState.size() > i) {
SavedState savedState = (SavedState) this.mSavedState.get(i);
if (savedState != null) {
item.setInitialSavedState(savedState);
}
}
while (this.mFragments.size() <= i) {
this.mFragments.add(null);
}
item.setMenuVisibility(false);
FragmentCompat.setUserVisibleHint(item, false);
this.mFragments.set(i, item);
this.mCurTransaction.add(viewGroup.getId(), item);
return item;
}
@Deprecated
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
Fragment fragment = (Fragment) obj;
if (this.mCurTransaction == null) {
this.mCurTransaction = this.mFragmentManager.beginTransaction();
}
while (this.mSavedState.size() <= i) {
this.mSavedState.add(null);
}
this.mSavedState.set(i, fragment.isAdded() ? this.mFragmentManager.saveFragmentInstanceState(fragment) : null);
this.mFragments.set(i, null);
this.mCurTransaction.remove(fragment);
}
@Deprecated
public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) {
Fragment fragment = (Fragment) obj;
Fragment fragment2 = this.mCurrentPrimaryItem;
if (fragment != fragment2) {
if (fragment2 != null) {
fragment2.setMenuVisibility(false);
FragmentCompat.setUserVisibleHint(this.mCurrentPrimaryItem, false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
FragmentCompat.setUserVisibleHint(fragment, true);
}
this.mCurrentPrimaryItem = fragment;
}
}
@Deprecated
public void finishUpdate(ViewGroup viewGroup) {
FragmentTransaction fragmentTransaction = this.mCurTransaction;
if (fragmentTransaction != null) {
fragmentTransaction.commitAllowingStateLoss();
this.mCurTransaction = null;
this.mFragmentManager.executePendingTransactions();
}
}
@Deprecated
public boolean isViewFromObject(View view, Object obj) {
return ((Fragment) obj).getView() == view;
}
@Deprecated
public Parcelable saveState() {
Bundle bundle;
if (this.mSavedState.size() > 0) {
bundle = new Bundle();
SavedState[] savedStateArr = new SavedState[this.mSavedState.size()];
this.mSavedState.toArray(savedStateArr);
bundle.putParcelableArray("states", savedStateArr);
} else {
bundle = null;
}
for (int i = 0; i < this.mFragments.size(); i++) {
Fragment fragment = (Fragment) this.mFragments.get(i);
if (fragment != null && fragment.isAdded()) {
if (bundle == null) {
bundle = new Bundle();
}
StringBuilder sb = new StringBuilder();
sb.append("f");
sb.append(i);
this.mFragmentManager.putFragment(bundle, sb.toString(), fragment);
}
}
return bundle;
}
@Deprecated
public void restoreState(Parcelable parcelable, ClassLoader classLoader) {
if (parcelable != null) {
Bundle bundle = (Bundle) parcelable;
bundle.setClassLoader(classLoader);
Parcelable[] parcelableArray = bundle.getParcelableArray("states");
this.mSavedState.clear();
this.mFragments.clear();
if (parcelableArray != null) {
for (Parcelable parcelable2 : parcelableArray) {
this.mSavedState.add((SavedState) parcelable2);
}
}
for (String str : bundle.keySet()) {
if (str.startsWith("f")) {
int parseInt = Integer.parseInt(str.substring(1));
Fragment fragment = this.mFragmentManager.getFragment(bundle, str);
if (fragment != null) {
while (this.mFragments.size() <= parseInt) {
this.mFragments.add(null);
}
FragmentCompat.setMenuVisibility(fragment, false);
this.mFragments.set(parseInt, fragment);
} else {
StringBuilder sb = new StringBuilder();
sb.append("Bad fragment at key ");
sb.append(str);
Log.w(TAG, sb.toString());
}
}
}
}
}
}
| [
"knag88@gmail.com"
] | knag88@gmail.com |
35881ece111b036d61fa3b555b41b7776b0da828 | 235fdb2dc7b13d35031b3b0ffa0916f397a4d3b8 | /connect-examples/v2/square-connect-sdk/java/src/main/java/com/squareup/connect/models/V1UpdateVariationRequest.java | bacc4c6024c9c4c8c14a76a1fa0edbe710dc95e2 | [
"Apache-2.0"
] | permissive | fakeNetflix/square-repo-connect-api-examples | 0d63bef859917d48c9837fe97a3086c189e5e7f1 | c5db8e77988c3b47317a3588458604e785ddb23d | refs/heads/master | 2023-02-05T18:01:42.260483 | 2019-08-15T21:40:03 | 2019-08-15T21:40:03 | 203,054,353 | 0 | 0 | null | 2022-12-14T07:33:29 | 2019-08-18T20:40:30 | Java | UTF-8 | Java | false | false | 2,327 | java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.V1Variation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*/
@ApiModel(description = "")
public class V1UpdateVariationRequest {
@JsonProperty("body")
private V1Variation body = null;
public V1UpdateVariationRequest body(V1Variation body) {
this.body = body;
return this;
}
/**
* An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return body
**/
@ApiModelProperty(required = true, value = "An object containing the fields to POST for the request. See the corresponding object definition for field details.")
public V1Variation getBody() {
return body;
}
public void setBody(V1Variation body) {
this.body = body;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1UpdateVariationRequest v1UpdateVariationRequest = (V1UpdateVariationRequest) o;
return Objects.equals(this.body, v1UpdateVariationRequest.body);
}
@Override
public int hashCode() {
return Objects.hash(body);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1UpdateVariationRequest {\n");
sb.append(" body: ").append(toIndentedString(body)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"xiao@squareup.com"
] | xiao@squareup.com |
32dee02019d9249de020a3964a0844b1e575c28d | 06eb59d91495a2b9568d21019e4dcb61ff236b7a | /izpack-src/tags/milestone-3-8-0-M2/src/lib/com/izforge/izpack/util/OsVersion.java | 50dacd1f9ee6fac731858a12dfac6685d5023122 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jponge/izpack-full-svn-history-copy | 8fa773fb3f9f4004e762d29f708273533ba0ff1f | 7a521ccd6ce0dd1a0664eaae12fd5bba5571d231 | refs/heads/master | 2016-09-01T18:24:14.656773 | 2010-03-01T07:38:22 | 2010-03-01T07:38:22 | 551,191 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,661 | java | /*
* IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
*
* http://www.izforge.com/izpack/ http://developer.berlios.de/projects/izpack/
*
* Copyright 2004 Hani Suleiman
*
* 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.izforge.izpack.util;
import java.io.File;
import java.io.IOException;
/**
* This is a convienient class, which helps you to detect / identify the running OS/Distribution
*
* Created at: Date: Nov 9, 2004 Time: 8:53:22 PM
*
* @author hani, Marc.Eppelmann@reddot.de
*/
public final class OsVersion implements OsVersionConstants, StringConstants
{
//~ Static fields/initializers
// *******************************************************************************************************************************
/** OS_NAME = System.getProperty( "os.name" ) */
public static final String OS_NAME = System.getProperty( OSNAME );
/** True if this is FreeBSD. */
public static final boolean IS_FREEBSD = StringTool.startsWithIgnoreCase(OS_NAME, FREEBSD );
/** True if this is Linux. */
public static final boolean IS_LINUX = StringTool.startsWithIgnoreCase(OS_NAME, LINUX );
/** True if this is HP-UX. */
public static final boolean IS_HPUX = StringTool.startsWithIgnoreCase(OS_NAME, HP_UX );
/** True if this is AIX. */
public static final boolean IS_AIX = StringTool.startsWithIgnoreCase(OS_NAME, AIX );
/** True if this is SunOS. */
public static final boolean IS_SUNOS = StringTool.startsWithIgnoreCase(OS_NAME, SUNOS );
/** True if this is OS/2. */
public static final boolean IS_OS2 = StringTool.startsWith(OS_NAME, OS_2 );
/** True is this is Mac OS */
public static final boolean IS_MAC = StringTool.startsWith(OS_NAME, MAC );
/** True if this is the Mac OS X. */
public static final boolean IS_OSX = StringTool.startsWithIgnoreCase(OS_NAME, MACOSX);
/** True if this is Windows. */
public static final boolean IS_WINDOWS = StringTool.startsWith(OS_NAME, WINDOWS );
/** True if this is some variant of Unix (OSX, Linux, Solaris, FreeBSD, etc). */
public static final boolean IS_UNIX = !IS_OS2 && !IS_WINDOWS;
/** True if RedHat Linux was detected */
public static final boolean IS_REDHAT_LINUX = IS_LINUX
&& ( ( FileUtil.fileContains(getReleaseFileName(), REDHAT ) || FileUtil.fileContains(getReleaseFileName() ,
RED_HAT ) ) );
/** True if Fedora Linux was detected */
public static final boolean IS_FEDORA_LINUX = IS_LINUX
&& FileUtil.fileContains(getReleaseFileName(), FEDORA );
/** True if Mandriva(Mandrake) Linux was detected */
public static final boolean IS_MANDRAKE_LINUX = IS_LINUX
&& FileUtil.fileContains( getReleaseFileName(), MANDRAKE );
/** True if Mandrake/Mandriva Linux was detected */
public static final boolean IS_MANDRIVA_LINUX = ( IS_LINUX
&& FileUtil.fileContains( getReleaseFileName(), MANDRIVA ) ) || IS_MANDRAKE_LINUX;
/** True if SuSE Linux was detected */
public static final boolean IS_SUSE_LINUX = IS_LINUX
&& FileUtil.fileContains( getReleaseFileName(), SUSE );
/** True if Debian Linux or derived was detected */
public static final boolean IS_DEBIAN_LINUX = (IS_LINUX
&& FileUtil.fileContains(PROC_VERSION, DEBIAN )) || ( IS_LINUX && new File( "/etc/debian_version" ).exists() );
// TODO detect the newcomer (K)Ubuntu */
//~ Methods
// **************************************************************************************************************************************************
/**
* Gets the etc Release Filename
*
* @return name of the file the release info is stored in for Linux distributions
*/
private static String getReleaseFileName()
{
String result = new String();
File[] etcList = new File("/etc").listFiles();
if( etcList != null )
for (int idx = 0; idx < etcList.length; idx++)
{
File etcEntry = etcList[idx];
if (etcEntry.isFile())
{
if (etcEntry.getName().endsWith("-release"))
{
//match :-)
return result = etcEntry.toString();
}
}
}
return result;
}
/**
* Gets the Details of a Linux Distribution
*
* @return description string of the Linux distribution
*/
private static String getLinuxDistribution()
{
String result = null;
if (IS_SUSE_LINUX)
{
try
{
result = SUSE + SP + LINUX + NL + StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
else if (IS_REDHAT_LINUX)
{
try
{
result = REDHAT + SP + LINUX + NL + StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
else if (IS_FEDORA_LINUX)
{
try
{
result = FEDORA + SP + LINUX + NL
+ StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
else if (IS_MANDRAKE_LINUX)
{
try
{
result = MANDRAKE + SP + LINUX + NL
+ StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
else if (IS_MANDRIVA_LINUX)
{
try
{
result = MANDRIVA + SP + LINUX + NL
+ StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
else if (IS_DEBIAN_LINUX)
{
try
{
result = DEBIAN + SP + LINUX + NL
+ StringTool.stringArrayListToString(FileUtil.getFileContent("/etc/debian_version"));
}
catch (IOException e)
{
// TODO ignore
}
}
else
{
try
{
result = "Unknown Linux Distribution\n"
+ StringTool.stringArrayListToString(FileUtil.getFileContent(getReleaseFileName()));
}
catch (IOException e)
{
// TODO ignore
}
}
return result;
}
/**
* returns a String which contains details of known OSs
* @return the details
*/
public static String getOsDetails()
{
StringBuffer result = new StringBuffer();
result.append( "OS_NAME=" + OS_NAME + NL );
if( IS_UNIX )
{
if( IS_LINUX )
{
result.append( getLinuxDistribution() + NL );
}
else
{
try
{
result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL );
}
catch (IOException e)
{
// TODO handle or ignore
}
}
}
if( IS_WINDOWS )
{
result.append( System.getProperty( OSNAME ) + SP
+ System.getProperty( "sun.os.patch.level", "" ) + NL );
}
return result.toString();
}
/**
* Testmain
*
* @param args Commandline Args
*/
public static void main(String[] args)
{
System.out.println( getOsDetails() );
}
}
| [
"(no author)@7d736ef5-cfd4-0310-9c9a-b52d5c14b761"
] | (no author)@7d736ef5-cfd4-0310-9c9a-b52d5c14b761 |
fad21fbcc4a3cfa2950315d1321bd479df4e2396 | bfbe1d3f7d69ed32142018316c7536ac84745f4c | /app/src/main/java/Zxing/view/ViewfinderResultPointCallback.java | de100507c4f0fd33aec3159cabad4b7990c2952f | [] | no_license | GitYeJiaWei/newapp | 036a3178274d28f2ed2119f91affd5f1c238b48b | c011d6ad7a2d6469d2cd58b49f8bb46b54cb542c | refs/heads/master | 2020-04-01T09:25:09.897034 | 2018-10-15T07:55:39 | 2018-10-15T07:55:39 | 153,073,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | /*
* Copyright (C) 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package Zxing.view;
import com.google.zxing.ResultPoint;
import com.google.zxing.ResultPointCallback;
public final class ViewfinderResultPointCallback implements ResultPointCallback {
private final ViewfinderView viewfinderView;
public ViewfinderResultPointCallback(ViewfinderView viewfinderView) {
this.viewfinderView = viewfinderView;
}
@Override
public void foundPossibleResultPoint(ResultPoint point) {
viewfinderView.addPossibleResultPoint(point);
}
}
| [
"y994471"
] | y994471 |
cdb34b0480eafa6d20755f9ead518924933cf8f5 | 5a8b79e628c4760ea8baacd99a30940785a9285f | /app/src/main/java/localhost/foof/models/Account.java | c2a8c16a4cbd4c1a747b8f6f3729633c740414f8 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | Wact/FooF | b91ee133b659c5cb245f5721481097487743e35a | ac59e8b925ad770d21b45ac4dcb90aa3fa2db2c4 | refs/heads/master | 2021-01-23T06:16:13.202170 | 2017-11-06T06:47:01 | 2017-11-06T06:47:01 | 93,017,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package localhost.foof.models;
/**
* Класс Аккаунт
*/
public class Account {
String mail;
String password;
String dataAboutAccount;
String orders;
String bonus;
public Account(String mail, String password, String dataAboutAccount, String orders, String bonus) {
this.mail = mail;
this.password = password;
this.dataAboutAccount = dataAboutAccount;
this.orders = orders;
this.bonus = bonus;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDataAboutAccount() {
return dataAboutAccount;
}
public void setDataAboutAccount(String dataAboutAccount) {
this.dataAboutAccount = dataAboutAccount;
}
public String getOrders() {
return orders;
}
public void setOrders(String orders) {
this.orders = orders;
}
public String getBonus() {
return bonus;
}
public void setBonus(String bonus) {
this.bonus = bonus;
}
}
| [
"malygin.wm@gmail.com"
] | malygin.wm@gmail.com |
7236db02440b1e78346fa9a90f52f73a8c949b2c | d8898da62440313b41934209fd6b2929b6dcaf51 | /model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/rbac/TestAssignmentValidity.java | 0ce5482e6566f038a531fce71e347fe403f1fa14 | [
"Apache-2.0"
] | permissive | softwarenerd7/engerek | 9fdb67f812599a32391b5bee717b134762a13b43 | 92757f9764c97fb1b81dbd1492d5517ebe3be97a | refs/heads/master | 2021-12-16T02:26:59.694019 | 2017-09-12T12:25:40 | 2017-09-12T12:25:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49,792 | java | /*
* Copyright (c) 2010-2017 Evolveum
*
* 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.evolveum.midpoint.model.intest.rbac;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertTrue;
import javax.xml.datatype.XMLGregorianCalendar;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.internals.InternalsConfig;
import com.evolveum.midpoint.schema.internals.TestingPaths;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.DummyResourceContoller;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
/**
* @author semancik
*
*/
@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"})
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class TestAssignmentValidity extends AbstractRbacTest {
private XMLGregorianCalendar jackPirateValidTo;
@Override
public void initSystem(Task initTask, OperationResult initResult)
throws Exception {
super.initSystem(initTask, initResult);
// InternalsConfig.setTestingPaths(TestingPaths.REVERSED);
}
/**
* MID-4110
*/
@Test
public void test100JackAssignRolePirateValidTo() throws Exception {
final String TEST_NAME = "test100JackAssignRolePirateValidTo";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, activationType, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test102Forward15min() throws Exception {
final String TEST_NAME = "test102Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test104JackAssignRolePirateAgain() throws Exception {
final String TEST_NAME = "test104JackAssignRolePirateAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* Unassign valid assignment. Only invalid assignment remains.
* MID-4110
*/
@Test
public void test106JackUnassignRolePirateValid() throws Exception {
final String TEST_NAME = "test106JackUnassignRolePirateValid";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
// WHEN
displayWhen(TEST_NAME);
unassignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* MID-4110
*/
@Test
public void test109JackUnassignAll() throws Exception {
unassignAll("test109JackUnassignAll");
}
/**
* Raw modification of assignment. The assignment is not effective immediately,
* as this is raw operation. So, nothing much happens. Yet.
* MID-4110
*/
@Test
public void test110JackAssignRolePirateValidToRaw() throws Exception {
final String TEST_NAME = "test110JackAssignRolePirateValidToRaw";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
ModelExecuteOptions options = ModelExecuteOptions.createRaw();
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_PIRATE_OID, RoleType.COMPLEX_TYPE, null,
task, null, activationType, true, options, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, null);
assertRoleMembershipRef(userAfter);
assertDelegatedRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* MID-4110, MID-4114
*/
@Test
public void test111RecomputeJack() throws Exception {
final String TEST_NAME = "test111RecomputeJack";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test112Forward15min() throws Exception {
final String TEST_NAME = "test102Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test114JackAssignRolePirateAgain() throws Exception {
final String TEST_NAME = "test114JackAssignRolePirateAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* MID-4110
*/
@Test
public void test119JackUnassignAll() throws Exception {
unassignAll("test119JackUnassignAll");
}
/**
* Sailor is an idempotent(conservative) role.
* MID-4110
*/
@Test
public void test120JackAssignRoleSailorValidTo() throws Exception {
final String TEST_NAME = "test120JackAssignRoleSailorValidTo";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, activationType, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test122Forward15min() throws Exception {
final String TEST_NAME = "test122Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test124JackAssignRoleSailorAgain() throws Exception {
final String TEST_NAME = "test124JackAssignRoleSailorAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* MID-4110
*/
@Test
public void test129JackUnassignAll() throws Exception {
unassignAll("test129JackUnassignAll");
}
/**
* Raw modification of assignment. The assignment is not effective immediately,
* as this is raw operation. So, nothing much happens. Yet.
* MID-4110
*/
@Test
public void test130JackAssignRoleSailorValidToRaw() throws Exception {
final String TEST_NAME = "test130JackAssignRoleSailorValidToRaw";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
ModelExecuteOptions options = ModelExecuteOptions.createRaw();
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, RoleType.COMPLEX_TYPE, null,
task, null, activationType, true, options, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, null);
assertRoleMembershipRef(userAfter);
assertDelegatedRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* MID-4110, MID-4114
*/
@Test
public void test131RecomputeJack() throws Exception {
final String TEST_NAME = "test131RecomputeJack";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test132Forward15min() throws Exception {
final String TEST_NAME = "test132Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test134JackAssignRoleSailorAgain() throws Exception {
final String TEST_NAME = "test134JackAssignRoleSailorAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* MID-4110
*/
@Test
public void test139JackUnassignAll() throws Exception {
unassignAll("test139JackUnassignAll");
}
/**
* This time do not recompute. Just set everything up, let the assignment expire
* and assign the role again.
* MID-4110
*/
@Test
public void test140JackAssignRoleSailorValidToRaw() throws Exception {
final String TEST_NAME = "test140JackAssignRoleSailorValidToRaw";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
ModelExecuteOptions options = ModelExecuteOptions.createRaw();
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, RoleType.COMPLEX_TYPE, null,
task, null, activationType, true, options, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, null);
assertRoleMembershipRef(userAfter);
assertDelegatedRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* Assignment expires. BUt do NOT recompute.
* MID-4110
*/
@Test
public void test142Forward15min() throws Exception {
final String TEST_NAME = "test142Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
// WHEN
displayWhen(TEST_NAME);
clockForward("PT15M");
// do NOT recompute
// THEN
displayThen(TEST_NAME);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, null); // Not recomputed
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test144JackAssignRoleSailorAgain() throws Exception {
final String TEST_NAME = "test144JackAssignRoleSailorAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
XMLGregorianCalendar endTs = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertModifyMetadata(userAfter, startTs, endTs);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* MID-4110
*/
@Test
public void test149JackUnassignAll() throws Exception {
unassignAll("test149JackUnassignAll");
}
/**
* MID-4110
*/
@Test
public void test150JackAssignRolePirate() throws Exception {
final String TEST_NAME = "test150JackAssignRolePirate";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* Sailor is an idempotent(conservative) role.
* MID-4110
*/
@Test
public void test151JackAssignRoleSailorValidTo() throws Exception {
final String TEST_NAME = "test151JackAssignRoleSailorValidTo";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, activationType, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSailorAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test153Forward15min() throws Exception {
final String TEST_NAME = "test153Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertJackDummyPirateAccount();
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test154JackAssignRoleSailorAgain() throws Exception {
final String TEST_NAME = "test154JackAssignRoleSailorAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 3);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSailorAccount();
}
/**
* MID-4110
*/
@Test
public void test159JackUnassignAll() throws Exception {
unassignAll("test159JackUnassignAll");
}
/**
* MID-4110
*/
@Test
public void test160JackAssignRolePirate() throws Exception {
final String TEST_NAME = "test160JackAssignRolePirate";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* MID-4110
*/
@Test
public void test161JackAssignRoleSailorValidToRaw() throws Exception {
final String TEST_NAME = "test161JackAssignRoleSailorValidToRaw";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
ModelExecuteOptions options = ModelExecuteOptions.createRaw();
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, RoleType.COMPLEX_TYPE, null,
task, null, activationType, true, options, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, null);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID); // SAILOR is not here, we are raw
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* Recompute should fix it all.
* MID-4110
*/
@Test
public void test162RecomputeJack() throws Exception {
final String TEST_NAME = "test162RecomputeJack";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
// WHEN
displayWhen(TEST_NAME);
reconcileUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSailorAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test163Forward15min() throws Exception {
final String TEST_NAME = "test163Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertJackDummyPirateAccount();
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test164JackAssignRoleSailorAgain() throws Exception {
final String TEST_NAME = "test164JackAssignRoleSailorAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 3);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSailorAccount();
}
/**
* MID-4110
*/
@Test
public void test169JackUnassignAll() throws Exception {
unassignAll("test169JackUnassignAll");
}
/**
* MID-4110
*/
@Test
public void test170JackAssignRolePirate() throws Exception {
final String TEST_NAME = "test170JackAssignRolePirate";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateAccount();
}
/**
* MID-4110
*/
@Test
public void test171JackAssignRoleWeakSingerValidTo() throws Exception {
final String TEST_NAME = "test171JackAssignRoleWeakSingerValidTo";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_WEAK_SINGER_OID, activationType, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentSingerTypeAfter = assertAssignedRole(userAfter, ROLE_WEAK_SINGER_OID);
assertEffectiveActivation(assignmentSingerTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_WEAK_SINGER_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSingerAccount();
}
/**
* Assignment expires.
* MID-4110, MID-4114
*/
@Test
public void test173Forward15min() throws Exception {
final String TEST_NAME = "test173Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
AssignmentType assignmentPirateTypeAfter = assertAssignedRole(userAfter, ROLE_PIRATE_OID);
assertEffectiveActivation(assignmentPirateTypeAfter, ActivationStatusType.ENABLED);
AssignmentType assignmentSailorTypeAfter = assertAssignedRole(userAfter, ROLE_WEAK_SINGER_OID);
assertEffectiveActivation(assignmentSailorTypeAfter, ActivationStatusType.DISABLED);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID);
// Dummy attribute "title" is tolerant, so the singer value remains
assertJackDummyPirateSingerAccount();
}
/**
* New assignment. No time validity.
* MID-4110
*/
@Test
public void test174JackAssignRoleSingerAgain() throws Exception {
final String TEST_NAME = "test174JackAssignRoleSingerAgain";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
assignRole(USER_JACK_OID, ROLE_WEAK_SINGER_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 3);
assertRoleMembershipRef(userAfter, ROLE_PIRATE_OID, ROLE_WEAK_SINGER_OID);
assertDelegatedRef(userAfter);
assertJackDummyPirateSingerAccount();
}
/**
* MID-4110
*/
@Test
public void test179JackUnassignAll() throws Exception {
unassignAll("test179JackUnassignAll");
}
/**
* This time do both assigns as raw. And do NOT recompute until everything is set up.
* MID-4110
*/
@Test
public void test180JackAssignRoleSailorValidToRaw() throws Exception {
final String TEST_NAME = "test180JackAssignRoleSailorValidToRaw";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
ActivationType activationType = new ActivationType();
jackPirateValidTo = getTimestamp("PT10M");
activationType.setValidTo(jackPirateValidTo);
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, RoleType.COMPLEX_TYPE, null,
task, null, activationType, true, ModelExecuteOptions.createRaw(), result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 1);
AssignmentType assignmentTypeAfter = assertAssignedRole(userAfter, ROLE_STRONG_SAILOR_OID);
assertEffectiveActivation(assignmentTypeAfter, null);
assertRoleMembershipRef(userAfter);
assertDelegatedRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* MID-4110
*/
@Test
public void test182Forward15minAndAssignRaw() throws Exception {
final String TEST_NAME = "test142Forward15min";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
clockForward("PT15M");
// WHEN
displayWhen(TEST_NAME);
modifyUserAssignment(USER_JACK_OID, ROLE_STRONG_SAILOR_OID, RoleType.COMPLEX_TYPE, null,
task, null, null, true, ModelExecuteOptions.createRaw(), result);
// THEN
displayThen(TEST_NAME);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
/**
* MID-4110, MID-4114
*/
@Test
public void test184RecomputeJack() throws Exception {
final String TEST_NAME = "test184RecomputeJack";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
recomputeUser(USER_JACK_OID, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 2);
assertRoleMembershipRef(userAfter, ROLE_STRONG_SAILOR_OID);
assertDelegatedRef(userAfter);
assertJackDummySailorAccount();
}
/**
* MID-4110
*/
@Test
public void test189JackUnassignAll() throws Exception {
unassignAll("test189JackUnassignAll");
}
private void assertJackDummyPirateAccount() throws Exception {
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, ROLE_PIRATE_TITLE);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, USER_JACK_LOCALITY);
// Outbound mapping for weapon is weak, therefore the mapping in role should override it
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, ROLE_PIRATE_WEAPON);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
"Jack Sparrow is the best pirate Caribbean has ever seen");
}
private void assertJackDummySailorAccount() throws Exception {
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, RESOURCE_DUMMY_DRINK, ROLE_SAILOR_DRINK);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, USER_JACK_LOCALITY);
}
private void assertJackDummyPirateSailorAccount() throws Exception {
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, ROLE_PIRATE_TITLE);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, RESOURCE_DUMMY_DRINK, ROLE_SAILOR_DRINK);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, USER_JACK_LOCALITY);
// Outbound mapping for weapon is weak, therefore the mapping in role should override it
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, ROLE_PIRATE_WEAPON);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
"Jack Sparrow is the best pirate Caribbean has ever seen");
}
private void assertJackDummyPirateSingerAccount() throws Exception {
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, ROLE_PIRATE_TITLE, ROLE_WEAK_SINGER_TITLE);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, RESOURCE_DUMMY_DRINK);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, USER_JACK_LOCALITY);
// Outbound mapping for weapon is weak, therefore the mapping in role should override it
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, ROLE_PIRATE_WEAPON);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME,
"Jack Sparrow is the best pirate Caribbean has ever seen");
}
private void unassignAll(final String TEST_NAME) throws Exception {
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_JACK_OID);
display("User jack before", userBefore);
// WHEN
displayWhen(TEST_NAME);
unassignAll(userBefore, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignments(userAfter, 0);
assertRoleMembershipRef(userAfter);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
}
| [
"radovan.semancik@evolveum.com"
] | radovan.semancik@evolveum.com |
8978660df1d0c6c378ac3633a1b043633caf71ab | ca26b94bfe82b7080637b7bd6dec9f45fe2f2c8a | /app/app/src/main/java/com/example/voicecrackclient/Global.java | 982123a281c400f00bcd16840418e5d203853ce3 | [] | no_license | RensDofferhoff/VoiceCrack_API_2019 | f60c75c70d30b9a31457d820f639f7b287886faf | 4426e90ee288fbc2dcb18ce83d6cebc74aaf99f4 | refs/heads/master | 2020-12-12T07:26:40.926573 | 2020-01-16T14:39:05 | 2020-01-16T14:39:05 | 234,077,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.example.voicecrackclient;
import android.content.Context;
import android.content.SharedPreferences;
import java.io.File;
class Global {
static String serverUrl;
static File storageDir;
static String solidToneName = "solid_tone.wav";
static String recordingName = "recording.mp3";
}
| [
"you@example.com"
] | you@example.com |
2a85d5aeb94d2c0f52cc93137ac9843deeb9ac73 | 027bb43f0f5289fcd56e4d5a8edc28832cc34619 | /school-management-system/src/main/java/patika/dev/schoolmanagementsystem/api/controllers/InstructorsController.java | efdd92b67ac5f045416357674e88c76cb434cc24 | [
"MIT"
] | permissive | 113-GittiGidiyor-Java-Spring-Bootcamp/third-homework-fatimeyukkaldiran | 6ecf05f5f14a133acd0863a2d4eec6fade9c91d3 | 319d762bd339cf53c2bbe5dc9f3c9a903707f44a | refs/heads/main | 2023-07-05T07:31:55.930754 | 2021-08-29T20:06:22 | 2021-08-29T20:06:22 | 398,887,116 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,508 | java | package patika.dev.schoolmanagementsystem.api.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import patika.dev.schoolmanagementsystem.business.abstracts.InstructorService;
import patika.dev.schoolmanagementsystem.entities.concretes.Student;
import patika.dev.schoolmanagementsystem.entities.abstracts.Instructor;
import java.util.List;
@RestController
@RequestMapping("/api/instructors")
public class InstructorsController {
private final InstructorService instructorService;
@Autowired
public InstructorsController(InstructorService instructorService) {
this.instructorService = instructorService;
}
@GetMapping("/getall")
public ResponseEntity<List<Instructor>> getAllInstructor(){
return new ResponseEntity<>(this.instructorService.findAll(), HttpStatus.OK);
}
@PostMapping("/add")
public Instructor addInstructor(@RequestBody Instructor instructor){
return instructorService.save(instructor);
}
@GetMapping("/get/{id}")
public ResponseEntity<Instructor> getStudentById(@PathVariable int id){
return new ResponseEntity<>(instructorService.findById(id),HttpStatus.OK);
}
@PutMapping("/update")
public Instructor updateInstructor(@RequestBody Instructor instructor){
return instructorService.update(instructor);
}
@DeleteMapping("/delete/{id}")
public String deleteInstructorById(@PathVariable int id) {
instructorService.deleteById(id);
return "Deleted...";
}
@GetMapping("/getByInstructorName/{name}")
public List<Instructor> getCourseName(@PathVariable String name){
return instructorService.getByInstructorName(name);
}
@GetMapping("/findFirst3BySalaryGreaterThan/{salary}")
public List<Instructor> findFirst3BySalaryGreaterThan(@PathVariable double salary){
return instructorService.findFirst3BySalaryGreaterThan(salary);
}
@GetMapping("/findFirst3BySalaryLessThan/{salary}")
public List<Instructor> findFirst3BySalaryLessThan(@PathVariable double salary){
return instructorService.findFirst3BySalaryLessThan(salary);
}
@DeleteMapping("/deleteByName/{name}")
public String deleteByInstructorName(@PathVariable String name){
instructorService.deleteByFullName(name);
return "Deleted student...";
}
}
| [
"fatime.yukkaldiran8@gmail.com"
] | fatime.yukkaldiran8@gmail.com |
839a29ac5db12b00fad1b565aca9d72b8a3cb67d | 363c789ed2a8e6fa3b2da066f8c62e9a28ab78d6 | /gs-messaging-stomp-websocket-complete/src/main/java/hello/Response.java | 408a77e03096a40b53031e4628a34366055dd7b6 | [] | no_license | mojmax/WebSocketTemperature | c630d3f02b06e2c354d3af3d8b570b5bb617b55b | 86d3b4a2b7ff8d4db6dd812d9cbdcdb2760c0fe4 | refs/heads/master | 2020-03-25T08:40:22.133289 | 2019-03-31T09:10:59 | 2019-03-31T09:10:59 | 143,626,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,347 | java | package hello;
public class Response {
private String content;
private String hour;
private String minute;
private String seconds;
private String temperature;
private String umidity;
private String scale;
public void setContent(String content) {
this.content = content;
}
public void setHour(String hour) {
this.hour = hour;
}
public void setMinute(String minute) {
this.minute = minute;
}
public void setSeconds(String seconds) {
this.seconds = seconds;
}
public void setTemperature(String temperature) {
this.temperature = temperature;
}
public void setUmidity(String umidity) {
this.umidity = umidity;
}
public void setScale(String scale) {
this.scale = scale;
}
public String getHour() {
return hour;
}
public String getMinute() {
return minute;
}
public String getSeconds() {
return seconds;
}
public String getTemperature() {
return temperature;
}
public String getUmidity() {
return umidity;
}
public String getScale() {
return scale;
}
public Response() {
}
@Override
public String toString() {
return "" + scale + " : " + getTemperature() + " RH% : " + getUmidity() + " at " + getHour() + ":" + getMinute() + ":" + getSeconds() ;
}
public String getContent() {
return content;
}
}
| [
"mojettam@gmail.com"
] | mojettam@gmail.com |
000cc3572811911d64bfded7c62080b0767b3c16 | 6beb278b8d98eb01533de335ae7db05377d4ce6d | /src/Graphs/LongestPath/Vertex.java | 047dbf8f3715295563f6bd79fd74f0dae2538b16 | [] | no_license | vishnu93tr/AlgoandDS | e738d0e8546300506e01322497326b7f74486ebb | ee550bfbd7e865b489345053af4d5022e1c5a4e8 | refs/heads/master | 2021-01-30T13:56:07.445785 | 2020-04-27T07:47:06 | 2020-04-27T07:47:06 | 243,501,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package Graphs.LongestPath;
import java.util.ArrayList;
import java.util.List;
public class Vertex implements Comparable<Vertex>
{
private String name;
private List<Edge> adjacenciesList;
private Vertex predecessor;
private double distance=Double.MAX_VALUE;
public Vertex(String name){
this.name=name;
this.adjacenciesList=new ArrayList<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Edge> getAdjacenciesList() {
return adjacenciesList;
}
public void setAdjacenciesList(List<Edge> adjacenciesList) {
this.adjacenciesList = adjacenciesList;
}
public Vertex getPredecessor() {
return predecessor;
}
public void setPredecessor(Vertex predecessor) {
this.predecessor = predecessor;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
@Override
public String toString() {
return this.name;
}
@Override
public int compareTo(Vertex otherVertex)
{
return Double.compare(distance,otherVertex.getDistance());
}
}
| [
"vishnu.vardhan@ET-C02T91MYG8WN.local"
] | vishnu.vardhan@ET-C02T91MYG8WN.local |
983c5c8f118bf6ffd6dcafd82c1f6f1a19555d26 | 0e2d6488c2a54fdb54512e744218d3043b8667d8 | /src/main/java/hsps/services/logic/basic/Beendend.java | 10a908ffbdf6eefe7cad47dd4d9c62c0b2814f95 | [] | no_license | mhecktor/hsps-doppelkopf-server | 6ce4ef13d8fd41ed9bcf666641c5a9ec76b3eaac | 302b27ca532ef60b1a5c80fa50f0a8b6266793eb | refs/heads/master | 2020-03-13T14:24:51.593678 | 2018-06-05T18:32:54 | 2018-06-05T18:32:54 | 131,158,013 | 0 | 0 | null | 2018-06-05T18:32:55 | 2018-04-26T13:13:57 | null | UTF-8 | Java | false | false | 2,023 | java | package hsps.services.logic.basic;
import hsps.services.logic.player.Spieler;
public class Beendend extends Zustand {
public Beendend( Spiel spiel ) {
super( spiel );
auswerten();
}
@Override
public void initialisieren() {
if( Spiel.DEBUG )
System.out.println( "Spiel wird initialisiert..." );
spiel.setAktuellerZustand( new Initialisierend( spiel ) );
}
@Override
public void pausieren() {
if( Spiel.DEBUG )
System.out.println( "Spiel bereits beendet!" );
}
@Override
public void wiederaufnehmen() {
if( Spiel.DEBUG )
System.out.println( "Spiel bereits beendet!" );
}
@Override
public void beenden() {
if( Spiel.DEBUG )
System.out.println( "Spiel bereits beendet!" );
}
@Override
public State getState() {
return State.BEENDEND;
}
@Override
public String toString() {
return getState().toString();
}
private void auswerten() {
if( spiel.rundenAnzahl == spiel.maxRundenZahl ) {
int punkteRe = 0;
int punkteContra = 0;
boolean siegRe = false;
for( Spieler s : spiel.spielerListe ) {
if( s.isRe() ) {
punkteRe += s.getStichpunkte();
} else {
punkteContra += s.getStichpunkte();
}
}
if( punkteRe > punkteContra ) {
System.out.println( "Re gewinnt" );
siegRe = true;
} else {
System.out.println( "Contra gewinnt" );
}
for( Spieler s : spiel.spielerListe ) {
if( s.isRe() ) {
if( siegRe ) {
s.getStatistik().setSiege( s.getStatistik().getSiege() + 1 );
s.getStatistik().setPunkte( s.getStatistik().getPunkte() + 1 );
} else {
s.getStatistik().setPunkte( s.getStatistik().getPunkte() - 1 );
}
} else {
if( !siegRe ) {
s.getStatistik().setSiege( s.getStatistik().getSiege() + 1 );
s.getStatistik().setPunkte( s.getStatistik().getPunkte() + 1 );
} else {
s.getStatistik().setPunkte( s.getStatistik().getPunkte() - 1 );
}
}
}
}
}
}
| [
"marco.hecktor@com2m.de"
] | marco.hecktor@com2m.de |
58e3f0034c09fa1c0a30c102eb8d2604030d0a40 | 366474541e2de89224326c5afe58bfb45cdcc832 | /app/src/main/java/com/freshdigitable/udonroad/datastore/PerspectivalStatus.java | 7118a8d95740a2cac7e061f6d549f9efed941bcf | [
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0"
] | permissive | akihito104/UdonRoad | 07aac31210053e7f575b6cb57e0c320bca751666 | 5d8aa075b884e31757556b9651041b605de388b5 | refs/heads/master | 2021-01-24T11:09:25.485496 | 2018-07-29T10:59:24 | 2018-07-29T10:59:24 | 44,474,708 | 0 | 1 | Apache-2.0 | 2018-07-29T10:59:25 | 2015-10-18T10:58:51 | Java | UTF-8 | Java | false | false | 999 | java | /*
* Copyright (c) 2016. Matsuda, Akihit (akihito104)
*
* 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.freshdigitable.udonroad.datastore;
import twitter4j.Status;
/**
* PerspectivalStatus is to define Status has StatusReaction.
* StatusReaction is a perspective data of Status.
*
* Created by akihit on 2016/12/08.
*/
public interface PerspectivalStatus extends Status {
StatusReaction getStatusReaction();
void setStatusReaction(StatusReaction reaction);
}
| [
"matsuda104@gmail.com"
] | matsuda104@gmail.com |
f0da9d4abcd283c7aaef8d4697d687f7f9b3d1fe | 3110ecf23a8aa79ebb1bb8ceaeeb82f99494d80e | /kb-security-backend/server/src/main/java/com/bin/kong/security/server/shiro/MyExceptionHandler.java | 84e1ce090b89a2011aa7b48cd6d5083c23ea2b98 | [] | no_license | micheal-guo/kb-security | d196323b8aa29592e849536347fea751ddb6fafd | a9d70aef1e8f996134a4542f0c8297ff62e71f2f | refs/heads/master | 2022-06-03T03:33:42.581367 | 2019-08-03T05:14:21 | 2019-08-03T05:14:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,723 | java | package com.bin.kong.security.server.shiro;
import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.bin.kong.security.core.constants.ResponseConstants;
import com.bin.kong.security.core.exception.UserNotExistException;
import com.bin.kong.security.core.exception.UserStatusException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import javax.naming.CommunicationException;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.Map;
public class MyExceptionHandler implements HandlerExceptionResolver {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception ex) {
ex.printStackTrace();
Map<String, Object> attributes = new LinkedHashMap<>();
if (ex instanceof UnauthenticatedException) {
attributes.put("err_code", ResponseConstants.STATUS_TOKEN_ERROR);
attributes.put("msg", "token错误");
} else if (ex instanceof UnauthorizedException) {
attributes.put("err_code", ResponseConstants.STATUS_NO_AUTH);
attributes.put("msg", "用户无权限");
} else if (ex instanceof AuthenticationException) {
Throwable cause = ex.getCause();
if (cause instanceof UserNotExistException) {
attributes.put("msg", "用户不存在");
} else if (cause instanceof UserStatusException) {
attributes.put("msg", cause.getMessage());
} else if (cause instanceof CommunicationException) {
attributes.put("msg", "LDAP请求超时");
} else if (cause instanceof NamingException) {
attributes.put("msg", "用户名密码错误");
} else {
attributes.put("msg", String.format("登录异常:%s", cause.getMessage()));
}
attributes.put("err_code", ResponseConstants.STATUS_WRONG_PWD);
} else {
attributes.put("err_code", ResponseConstants.STATUS_OTHER);
attributes.put("msg", ex.getMessage());
}
FastJsonJsonView view = new FastJsonJsonView();
view.setAttributesMap(attributes);
return new ModelAndView(view);
}
}
| [
"kongbin02@ppdai.com"
] | kongbin02@ppdai.com |
d6d81f80f512178b3cec50c9e2fad40d73055393 | 1726ce1273a23073cfdc005a173e312671c0ef33 | /EVA3_9_HANDLER_POST/app/src/main/java/com/example/eva3_9_handler_post/MainActivity.java | b6974d39d174ff79ca0b73d0e66810daf09a5fef | [
"MIT"
] | permissive | AndresCM12/EVA3_practicas_APPS1 | 912d3b5ffcdd1b79fc3cec5f51f01feb74e9d4c9 | 076cee14a29d6af0307cdc42a070f71e44da1466 | refs/heads/main | 2023-06-09T04:17:27.564398 | 2021-07-03T03:14:36 | 2021-07-03T03:14:36 | 382,513,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package com.example.eva3_9_handler_post;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView txtVwMostrar;
Handler handler = new Handler();
//Trabajo pesado en segundo plano
Runnable background = new Runnable() {
@Override
public void run() {
while (true){
try {
Thread.sleep(1000);
handler.post(foreground);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
}
}
};
//trabajo con la ui
Runnable foreground = new Runnable() {
@Override
public void run() {
txtVwMostrar.append("Hola mundo!!! \n");
}
};
Thread thread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtVwMostrar = findViewById(R.id.txtVwEtiqueta);
thread = new Thread(background);
thread.start();
}
@Override
protected void onDestroy() {
super.onDestroy();
thread.interrupt();
}
} | [
"ve15361@innovaccion.mx"
] | ve15361@innovaccion.mx |
43c59cda4b03dd27bf76f8c15910b2235633f92f | e1dc92813e7ba41c222c1bf61d3fa0c0a04b4022 | /ocp/src/wbs/io/ConsoleDemo.java | 6e568e8154930bbaa60036756ed894a285db9da6 | [] | no_license | m0rii/JavaOCP | 6c3ee64901f7c0acbfe3b34d352032acda69b7e1 | df3cb824a63825fd886f5190fa3b10925b371f39 | refs/heads/master | 2023-05-13T06:55:39.743193 | 2021-05-19T18:04:28 | 2021-05-19T18:04:28 | 368,955,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package wbs.io;
import java.io.Console;
//path_to_workspace/ocp/bin> java wbs.io.ConsoleDemo
//hinweise:
//eine console steht nicht immer zur verfügung
//(z.b. aufruf aus entwicklungsumgebung, start als hintergrundprozess, ein-
//ausgabe-umlenkung)
//eine referenz auf eine console bekommt man nur über System.console()
//(liefert null, aber keine exception, falls keine console geliefert werden
//kann)
//Console ist isoliert, direkter Subtyp von Object
//methoden von Console liefern im fehlerfall einen Error aber keine
//Exception
//es schadet nichts, die methoden von Console namentlich zu kennen...
class ConsoleDemo {
public static void main(String[] args) {
Console console = System.console();
if (console == null) {
System.err.println("no console ... ");
System.exit(-1);
}
String user;
char[] password;
console.printf("your name: ");
user = console.readLine();
console.printf("your password: ");
password = console.readPassword();
console.printf("your name is %s%n", user);
console.format("your password is %s%n", new String(password));
console.printf("good bye ").format(user);
}
// in terminal C:\Users\Administrator\eclipse-workspace\ocp\bin>java wbs.io.ConsoleDemo
} | [
"morteza.nabhan@gmail.com"
] | morteza.nabhan@gmail.com |
1980d6ef51925fb165f7dc37ef649698a4348920 | c3ffbf7ba5f29c6ba0622855e566ede1741a1254 | /src/main/java/com/mycompany/netbest/OrderWindow.java | 980ec597feec1212196924a84db09b2a2d428528 | [] | no_license | xenox852/NetBest | ab139a560521c3bda4e287120a28baa81c908220 | 2b98e6c22a6536914e7f542a903ed778cde1a1b6 | refs/heads/master | 2021-09-03T15:55:25.032722 | 2018-01-10T07:47:38 | 2018-01-10T07:47:38 | 116,874,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 88,958 | 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 com.mycompany.netbest;
import java.awt.Color;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
/**
*
* @author domin
*/
public class OrderWindow extends javax.swing.JFrame {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs;
Statement statement;
String queryString;
int selectedRowIndex;
boolean istnieje;
String login;
public String currentDateStr()
{
String currDate;
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = new java.util.Date();
currDate = dateFormat.format(date);
return (currDate);
}
public void odswiez() throws SQLException, NoSuchAlgorithmException{
for(int i=0;i<37;i++){
userTable.getModel().setValueAt(" ", i, 0);
userTable.getModel().setValueAt(" ", i, 1);
userTable.getModel().setValueAt(" ", i, 2);
userTable.getModel().setValueAt(" ", i, 3);
userTable.getModel().setValueAt(" ", i, 4);
}
try{
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
queryString = "select Orders.ID_Order, Users.Login, Clients.Name, Clients.Lastname, Orders.Adres, Orders.Date, Products.Name, Products.Price from Clients\n" +
"join Orders on Clients.Pesel = Orders.ID_Client\n" +
"join Products on Orders.ID_Product = Products.Name\n" +
"join Users on Orders.id_user = Users.login;";
statement= conn.createStatement();
rs = statement.executeQuery(queryString);
for(int i=0;rs.next();i++){
userTable.getModel().setValueAt(rs.getString("Orders.ID_Order"), i, 0);
userTable.getModel().setValueAt(rs.getString("Users.Login"), i, 1);
userTable.getModel().setValueAt(rs.getString("Clients.Name"), i, 2);
userTable.getModel().setValueAt(rs.getString("Clients.Lastname"), i, 3);
userTable.getModel().setValueAt(rs.getString("Orders.Adres"), i, 4);
userTable.getModel().setValueAt(rs.getString("Orders.Date"), i, 5);
userTable.getModel().setValueAt(rs.getString("Products.Name"), i, 6);
userTable.getModel().setValueAt(rs.getString("Products.Price"), i, 7);
}
}
catch(Exception e){
e.printStackTrace();
}
}
public void dodajOrder () throws SQLException, NoSuchAlgorithmException{
try {
stmt = conn.prepareStatement("INSERT INTO `sql2212964`.`Orders` (`ID_User`, `ID_Product`, `ID_Client`, `Date`, `Adres`) VALUES (?, ?, ?, ?, ?);");
stmt.setString(1, (String) jComboBox2.getSelectedItem());
stmt.setString(2, (String) jComboBox1.getSelectedItem());
stmt.setString(3, ulicaText1.getText());
stmt.setString(4, currentDateStr());
stmt.setString(5, ulText.getText()+" "+domText.getText()+", "+kodText.getText()+" "+miejscowoscText.getText());
stmt.executeUpdate();
odswiez();
addOrder.setVisible(false);
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (Exception e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (Exception e) {
}
}
}
public void combo1() throws SQLException{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT Name FROM Products");
stmt.executeQuery();
rs = stmt.executeQuery( );
while(rs.next()){
jComboBox1.addItem(rs.getString(1));
}
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (SQLException e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (SQLException e) {
}
}
}
public void combo2() throws SQLException{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT Login FROM Users");
stmt.executeQuery();
rs = stmt.executeQuery( );
while(rs.next()){
jComboBox2.addItem(rs.getString(1));
}
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (SQLException e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (SQLException e) {
}
}
}
public void combo3() throws SQLException{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT Name FROM Products");
stmt.executeQuery();
rs = stmt.executeQuery( );
while(rs.next()){
jComboBox3.addItem(rs.getString(1));
}
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (SQLException e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (SQLException e) {
}
}
}
public void combo4() throws SQLException{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT Login FROM Users");
stmt.executeQuery();
rs = stmt.executeQuery( );
while(rs.next()){
jComboBox4.addItem(rs.getString(1));
}
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (SQLException e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (SQLException e) {
}
}
}
public void peselBox() throws SQLException{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT Id_Client FROM Orders WHERE Id_Order=?");
stmt.setString(1, login);
stmt.executeQuery();
rs = stmt.executeQuery( );
while(rs.next()){
peselText2.setText(rs.getString(1));
}
}
finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (SQLException e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (SQLException e) {
}
}
}
public boolean sprawdz(String pesel){
// zakładamy tablicę z wagami
int[] wagi = {1, 3, 7, 9, 1, 3, 7 ,9 ,1 ,3};
// sprawdzamy długość PESEL'a, jeśli nie jest to 11 zwracamy false
if (pesel.length() != 11) return false;
// zakładamy zmienną będącą sumą kontrolną
int suma = 0;
// liczymy w pętli sumę kontrolną przemnażając odpowiednie
// cyfry z PESEL'a przez odpowiednie wagi
for (int i = 0; i < 10; i++)
suma += Integer.parseInt(pesel.substring(i, i+1)) * wagi[i];
// pobieramy do zmiennej cyfraKontrolna wartość ostatniej cyfry z PESEL'a
int cyfraKontrolna = Integer.parseInt(pesel.substring(10, 11));
// obliczamy cyfrę kontrolną z sumy (najpierw modulo 10 potem odejmujemy 10 i jeszcze raz modulo 10)
suma %= 10;
suma = 10 - suma;
suma %= 10;
// zwracamy wartość logiczną porównania obliczonej i pobranej cyfry kontrolnej
return (suma == cyfraKontrolna);
}
public OrderWindow() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
addOrder = new javax.swing.JDialog();
jPanel45 = new javax.swing.JPanel();
jLabel100 = new javax.swing.JLabel();
jLabel101 = new javax.swing.JLabel();
jSeparator75 = new javax.swing.JSeparator();
jLabel102 = new javax.swing.JLabel();
jPanel46 = new javax.swing.JPanel();
jLabel103 = new javax.swing.JLabel();
jSeparator77 = new javax.swing.JSeparator();
ulText = new javax.swing.JTextField();
jSeparator78 = new javax.swing.JSeparator();
jLabel105 = new javax.swing.JLabel();
jSeparator79 = new javax.swing.JSeparator();
domText = new javax.swing.JTextField();
jLabel106 = new javax.swing.JLabel();
jSeparator80 = new javax.swing.JSeparator();
kodText = new javax.swing.JTextField();
jLabel107 = new javax.swing.JLabel();
miejscowoscText = new javax.swing.JTextField();
jSeparator81 = new javax.swing.JSeparator();
jLabel108 = new javax.swing.JLabel();
bladText3 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox<>();
ulicaText1 = new javax.swing.JTextField();
jSeparator82 = new javax.swing.JSeparator();
jComboBox2 = new javax.swing.JComboBox<>();
jLabel104 = new javax.swing.JLabel();
czyUsun = new javax.swing.JDialog();
jPanel8 = new javax.swing.JPanel();
jLabel28 = new javax.swing.JLabel();
jPanel9 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jPanel10 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
updateOrder = new javax.swing.JDialog();
jPanel47 = new javax.swing.JPanel();
jLabel109 = new javax.swing.JLabel();
jLabel110 = new javax.swing.JLabel();
jSeparator76 = new javax.swing.JSeparator();
jLabel111 = new javax.swing.JLabel();
jPanel48 = new javax.swing.JPanel();
jLabel112 = new javax.swing.JLabel();
jSeparator83 = new javax.swing.JSeparator();
ulText1 = new javax.swing.JTextField();
jSeparator84 = new javax.swing.JSeparator();
jLabel113 = new javax.swing.JLabel();
jSeparator85 = new javax.swing.JSeparator();
domText1 = new javax.swing.JTextField();
jLabel114 = new javax.swing.JLabel();
jSeparator86 = new javax.swing.JSeparator();
kodText1 = new javax.swing.JTextField();
jLabel115 = new javax.swing.JLabel();
miejscowoscText1 = new javax.swing.JTextField();
jSeparator87 = new javax.swing.JSeparator();
jLabel116 = new javax.swing.JLabel();
bladText4 = new javax.swing.JLabel();
jComboBox3 = new javax.swing.JComboBox<>();
peselText2 = new javax.swing.JTextField();
jSeparator88 = new javax.swing.JSeparator();
jComboBox4 = new javax.swing.JComboBox<>();
jLabel117 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
NetBest = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jPanel2 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel12 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel13 = new javax.swing.JLabel();
jSeparator7 = new javax.swing.JSeparator();
jScrollPane4 = new javax.swing.JScrollPane();
userTable = new javax.swing.JTable();
addOrder.setMinimumSize(new java.awt.Dimension(390, 550));
addOrder.setPreferredSize(new java.awt.Dimension(390, 550));
addOrder.setResizable(false);
jPanel45.setBackground(new java.awt.Color(255, 255, 255));
jPanel45.setMinimumSize(new java.awt.Dimension(390, 550));
jPanel45.setRequestFocusEnabled(false);
jLabel100.setFont(new java.awt.Font("Tahoma", 0, 48)); // NOI18N
jLabel100.setForeground(new java.awt.Color(207, 6, 46));
jLabel100.setText("NetBest");
jLabel101.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel101.setForeground(new java.awt.Color(207, 6, 46));
jLabel101.setText("ID produktu:");
jLabel102.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel102.setForeground(new java.awt.Color(207, 6, 46));
jLabel102.setText("Pesel klienta:");
jPanel46.setBackground(new java.awt.Color(255, 255, 255));
jPanel46.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel46.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel46MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel46MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel46MouseExited(evt);
}
});
jLabel103.setBackground(new java.awt.Color(255, 255, 255));
jLabel103.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel103.setForeground(new java.awt.Color(207, 6, 46));
jLabel103.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel103.setText("Dodaj zamówienie!");
jLabel103.setToolTipText("");
javax.swing.GroupLayout jPanel46Layout = new javax.swing.GroupLayout(jPanel46);
jPanel46.setLayout(jPanel46Layout);
jPanel46Layout.setHorizontalGroup(
jPanel46Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator77)
.addGroup(jPanel46Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel103)
.addContainerGap(33, Short.MAX_VALUE))
);
jPanel46Layout.setVerticalGroup(
jPanel46Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel46Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel103)
.addGap(18, 18, 18)
.addComponent(jSeparator77, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE))
);
ulText.setBorder(null);
ulText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ulTextActionPerformed(evt);
}
});
jLabel105.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel105.setForeground(new java.awt.Color(207, 6, 46));
jLabel105.setText("Ulica:");
domText.setBorder(null);
domText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
domTextActionPerformed(evt);
}
});
jLabel106.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel106.setForeground(new java.awt.Color(207, 6, 46));
jLabel106.setText("Numer domu:");
kodText.setBorder(null);
kodText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kodTextActionPerformed(evt);
}
});
jLabel107.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel107.setForeground(new java.awt.Color(207, 6, 46));
jLabel107.setText("Kod pocztowy:");
miejscowoscText.setBorder(null);
miejscowoscText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miejscowoscTextActionPerformed(evt);
}
});
jLabel108.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel108.setForeground(new java.awt.Color(207, 6, 46));
jLabel108.setText("Miejscowość:");
bladText3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
bladText3.setForeground(new java.awt.Color(207, 6, 46));
bladText3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
bladText3.setText("Niepoprawnie uzupełnione pola formularza!");
bladText3.setToolTipText("");
jComboBox1.setBorder(null);
ulicaText1.setBorder(null);
ulicaText1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ulicaText1ActionPerformed(evt);
}
});
jComboBox2.setBorder(null);
jLabel104.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel104.setForeground(new java.awt.Color(207, 6, 46));
jLabel104.setText("Sprzedawca:");
javax.swing.GroupLayout jPanel45Layout = new javax.swing.GroupLayout(jPanel45);
jPanel45.setLayout(jPanel45Layout);
jPanel45Layout.setHorizontalGroup(
jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel45Layout.createSequentialGroup()
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel45Layout.createSequentialGroup()
.addGap(132, 132, 132)
.addComponent(jLabel100))
.addGroup(jPanel45Layout.createSequentialGroup()
.addGap(107, 107, 107)
.addComponent(jPanel46, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel45Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel45Layout.createSequentialGroup()
.addComponent(jLabel106)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator79, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(domText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel45Layout.createSequentialGroup()
.addComponent(jLabel107)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator80, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(kodText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel45Layout.createSequentialGroup()
.addComponent(jLabel108)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator81, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(miejscowoscText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel45Layout.createSequentialGroup()
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel102, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel45Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel104)
.addComponent(jLabel101))))
.addComponent(jLabel105))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator78, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(ulText)
.addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator82, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(ulicaText1, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(bladText3, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(25, Short.MAX_VALUE))
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator75, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
);
jPanel45Layout.setVerticalGroup(
jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel45Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel100)
.addGap(34, 34, 34)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel104)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel101)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel45Layout.createSequentialGroup()
.addComponent(jLabel102)
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel45Layout.createSequentialGroup()
.addComponent(ulicaText1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jSeparator82, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(7, 7, 7)))
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ulText, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel105))
.addGap(0, 0, 0)
.addComponent(jSeparator78, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel106)
.addGroup(jPanel45Layout.createSequentialGroup()
.addComponent(domText)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator79, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel107)
.addGroup(jPanel45Layout.createSequentialGroup()
.addComponent(kodText)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator80, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel108)
.addGroup(jPanel45Layout.createSequentialGroup()
.addComponent(miejscowoscText)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator81, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel46, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bladText3)
.addContainerGap(39, Short.MAX_VALUE))
.addGroup(jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel45Layout.createSequentialGroup()
.addGap(79, 79, 79)
.addComponent(jSeparator75, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(456, Short.MAX_VALUE)))
);
javax.swing.GroupLayout addOrderLayout = new javax.swing.GroupLayout(addOrder.getContentPane());
addOrder.getContentPane().setLayout(addOrderLayout);
addOrderLayout.setHorizontalGroup(
addOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel45, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
addOrderLayout.setVerticalGroup(
addOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel45, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
czyUsun.setMaximumSize(new java.awt.Dimension(400, 200));
czyUsun.setMinimumSize(new java.awt.Dimension(400, 200));
czyUsun.setPreferredSize(new java.awt.Dimension(400, 200));
czyUsun.setResizable(false);
jPanel8.setBackground(new java.awt.Color(255, 255, 255));
jLabel28.setBackground(new java.awt.Color(255, 255, 255));
jLabel28.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel28.setForeground(new java.awt.Color(207, 6, 46));
jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel28.setText("Czy chcesz usunąć zamówienie:");
jLabel28.setToolTipText("");
jPanel9.setBackground(new java.awt.Color(255, 255, 255));
jPanel9.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel9.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel9MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel9MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel9MouseExited(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("TAK");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(65, 65, 65)
.addComponent(jLabel2)
.addContainerGap(69, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel2)
.addContainerGap(39, Short.MAX_VALUE))
);
jPanel10.setBackground(new java.awt.Color(255, 255, 255));
jPanel10.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel10.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel10MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel10MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel10MouseExited(evt);
}
});
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("NIE");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap(69, Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(67, 67, 67))
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel3)
.addContainerGap(40, Short.MAX_VALUE))
);
jLabel29.setBackground(new java.awt.Color(255, 255, 255));
jLabel29.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel29.setForeground(new java.awt.Color(207, 6, 46));
jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel29.setText("UWAGA! Ta operacja jest nieodwracalna!");
jLabel29.setToolTipText("");
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addContainerGap(22, Short.MAX_VALUE)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21))
);
javax.swing.GroupLayout czyUsunLayout = new javax.swing.GroupLayout(czyUsun.getContentPane());
czyUsun.getContentPane().setLayout(czyUsunLayout);
czyUsunLayout.setHorizontalGroup(
czyUsunLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
czyUsunLayout.setVerticalGroup(
czyUsunLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
updateOrder.setMaximumSize(new java.awt.Dimension(390, 550));
updateOrder.setMinimumSize(new java.awt.Dimension(390, 550));
updateOrder.setResizable(false);
jPanel47.setBackground(new java.awt.Color(255, 255, 255));
jPanel47.setMinimumSize(new java.awt.Dimension(390, 550));
jPanel47.setRequestFocusEnabled(false);
jLabel109.setFont(new java.awt.Font("Tahoma", 0, 48)); // NOI18N
jLabel109.setForeground(new java.awt.Color(207, 6, 46));
jLabel109.setText("NetBest");
jLabel110.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel110.setForeground(new java.awt.Color(207, 6, 46));
jLabel110.setText("ID produktu:");
jLabel111.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel111.setForeground(new java.awt.Color(207, 6, 46));
jLabel111.setText("Pesel klienta:");
jPanel48.setBackground(new java.awt.Color(255, 255, 255));
jPanel48.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel48.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel48MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel48MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel48MouseExited(evt);
}
});
jLabel112.setBackground(new java.awt.Color(255, 255, 255));
jLabel112.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel112.setForeground(new java.awt.Color(207, 6, 46));
jLabel112.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel112.setText("Edytuj zamówienie!");
jLabel112.setToolTipText("");
javax.swing.GroupLayout jPanel48Layout = new javax.swing.GroupLayout(jPanel48);
jPanel48.setLayout(jPanel48Layout);
jPanel48Layout.setHorizontalGroup(
jPanel48Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator83)
.addGroup(jPanel48Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel112)
.addContainerGap(33, Short.MAX_VALUE))
);
jPanel48Layout.setVerticalGroup(
jPanel48Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel48Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel112)
.addGap(18, 18, 18)
.addComponent(jSeparator83, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE))
);
ulText1.setBorder(null);
ulText1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ulText1ActionPerformed(evt);
}
});
jLabel113.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel113.setForeground(new java.awt.Color(207, 6, 46));
jLabel113.setText("Ulica:");
domText1.setBorder(null);
domText1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
domText1ActionPerformed(evt);
}
});
jLabel114.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel114.setForeground(new java.awt.Color(207, 6, 46));
jLabel114.setText("Numer domu:");
kodText1.setBorder(null);
kodText1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kodText1ActionPerformed(evt);
}
});
jLabel115.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel115.setForeground(new java.awt.Color(207, 6, 46));
jLabel115.setText("Kod pocztowy:");
miejscowoscText1.setBorder(null);
miejscowoscText1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miejscowoscText1ActionPerformed(evt);
}
});
jLabel116.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel116.setForeground(new java.awt.Color(207, 6, 46));
jLabel116.setText("Miejscowość:");
bladText4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
bladText4.setForeground(new java.awt.Color(207, 6, 46));
bladText4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
bladText4.setText("Niepoprawnie uzupełnione pola formularza!");
bladText4.setToolTipText("");
jComboBox3.setBorder(null);
peselText2.setBorder(null);
peselText2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
peselText2ActionPerformed(evt);
}
});
jComboBox4.setBorder(null);
jLabel117.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel117.setForeground(new java.awt.Color(207, 6, 46));
jLabel117.setText("Sprzedawca:");
javax.swing.GroupLayout jPanel47Layout = new javax.swing.GroupLayout(jPanel47);
jPanel47.setLayout(jPanel47Layout);
jPanel47Layout.setHorizontalGroup(
jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel47Layout.createSequentialGroup()
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel47Layout.createSequentialGroup()
.addGap(132, 132, 132)
.addComponent(jLabel109))
.addGroup(jPanel47Layout.createSequentialGroup()
.addGap(107, 107, 107)
.addComponent(jPanel48, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel47Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel47Layout.createSequentialGroup()
.addComponent(jLabel114)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator85, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(domText1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel47Layout.createSequentialGroup()
.addComponent(jLabel115)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator86, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(kodText1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel47Layout.createSequentialGroup()
.addComponent(jLabel116)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator87, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(miejscowoscText1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel47Layout.createSequentialGroup()
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel111, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel47Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel117)
.addComponent(jLabel110))))
.addComponent(jLabel113))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator84, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(ulText1)
.addComponent(jComboBox3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator88, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(peselText2, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(bladText4, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(120, Short.MAX_VALUE))
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator76, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
);
jPanel47Layout.setVerticalGroup(
jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel47Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel109)
.addGap(34, 34, 34)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel117)
.addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel110)
.addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel47Layout.createSequentialGroup()
.addComponent(jLabel111)
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel47Layout.createSequentialGroup()
.addComponent(peselText2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jSeparator88, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(7, 7, 7)))
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ulText1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel113))
.addGap(0, 0, 0)
.addComponent(jSeparator84, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel114)
.addGroup(jPanel47Layout.createSequentialGroup()
.addComponent(domText1)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator85, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel115)
.addGroup(jPanel47Layout.createSequentialGroup()
.addComponent(kodText1)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator86, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel116)
.addGroup(jPanel47Layout.createSequentialGroup()
.addComponent(miejscowoscText1)
.addGap(1, 1, 1)))
.addGap(0, 0, 0)
.addComponent(jSeparator87, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel48, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bladText4)
.addContainerGap(39, Short.MAX_VALUE))
.addGroup(jPanel47Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel47Layout.createSequentialGroup()
.addGap(79, 79, 79)
.addComponent(jSeparator76, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(456, Short.MAX_VALUE)))
);
javax.swing.GroupLayout updateOrderLayout = new javax.swing.GroupLayout(updateOrder.getContentPane());
updateOrder.getContentPane().setLayout(updateOrderLayout);
updateOrderLayout.setHorizontalGroup(
updateOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel47, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
updateOrderLayout.setVerticalGroup(
updateOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel47, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMaximumSize(new java.awt.Dimension(1000, 630));
setMinimumSize(new java.awt.Dimension(1000, 630));
setPreferredSize(new java.awt.Dimension(1000, 630));
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
NetBest.setFont(new java.awt.Font("Tahoma", 0, 48)); // NOI18N
NetBest.setForeground(new java.awt.Color(207, 6, 46));
NetBest.setText("NetBest");
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel2MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel2MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel2MouseExited(evt);
}
});
jLabel10.setForeground(new java.awt.Color(207, 6, 46));
jLabel10.setText("Dodaj");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jLabel10)
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel10)
.addContainerGap(45, Short.MAX_VALUE))
);
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jPanel3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel3MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel3MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel3MouseExited(evt);
}
});
jLabel11.setForeground(new java.awt.Color(207, 6, 46));
jLabel11.setText("Usuń");
jLabel11.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(jLabel11)
.addContainerGap(57, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel11)
.addContainerGap(45, Short.MAX_VALUE))
);
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel4MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel4MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel4MouseExited(evt);
}
});
jLabel12.setForeground(new java.awt.Color(207, 6, 46));
jLabel12.setText("Modyfikuj");
jLabel12.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(jLabel12)
.addContainerGap(35, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(42, 42, 42)
.addComponent(jLabel12)
.addContainerGap(44, Short.MAX_VALUE))
);
jPanel5.setBackground(new java.awt.Color(255, 255, 255));
jPanel5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jPanel5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPanel5MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel5MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jPanel5MouseExited(evt);
}
});
jLabel13.setForeground(new java.awt.Color(207, 6, 46));
jLabel13.setText("Drukuj");
jLabel13.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(46, 46, 46)
.addComponent(jLabel13)
.addContainerGap(52, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel13)
.addContainerGap(45, Short.MAX_VALUE))
);
userTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null}
},
new String [] {
"Numer zamówienia", "Sprzedawca", "Imie", "Naziwsko", "Adres", "Data zamówienia", "Nazwa produktu", "Cena"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
userTable.setGridColor(new java.awt.Color(255, 255, 255));
userTable.setMaximumSize(new java.awt.Dimension(375, 816));
userTable.setMinimumSize(new java.awt.Dimension(375, 816));
userTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
userTableMouseClicked(evt);
}
});
jScrollPane4.setViewportView(userTable);
if (userTable.getColumnModel().getColumnCount() > 0) {
userTable.getColumnModel().getColumn(4).setHeaderValue("Adres");
}
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addComponent(jSeparator2)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(329, 329, 329)
.addComponent(NetBest, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane4)))
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(162, 162, 162)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(NetBest)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(55, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jPanel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel2MouseClicked
try {
addOrder.setVisible(true);
bladText3.setVisible(false);
combo1();
combo2();
// TODO add your handling code here:
} catch (SQLException ex) {
Logger.getLogger(OrderWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jPanel2MouseClicked
private void jPanel2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel2MouseEntered
jPanel2.setBackground(Color.getHSBColor(0, 0, (float) 0.97));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel2MouseEntered
private void jPanel2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel2MouseExited
jPanel2.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel2MouseExited
private void jPanel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel3MouseClicked
if(login.equals("") || login.equals(" ")){
}
else{
jLabel1.setText((String) userTable.getValueAt(selectedRowIndex, 0));
czyUsun.setVisible(true);
}
}//GEN-LAST:event_jPanel3MouseClicked
private void jPanel3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel3MouseEntered
jPanel3.setBackground(Color.getHSBColor(0, 0, (float) 0.97));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel3MouseEntered
private void jPanel3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel3MouseExited
jPanel3.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel3MouseExited
private void jPanel4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel4MouseClicked
if(userTable.getValueAt(selectedRowIndex, 0).equals(" ")||login==null){
}else{
try {
updateOrder.setVisible(true);
bladText4.setVisible(false);
combo3();
combo4();
peselBox();
// TODO add your handling code here:
} catch (SQLException ex) {
Logger.getLogger(OrderWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
// TODO add your handling code here:
}//GEN-LAST:event_jPanel4MouseClicked
private void jPanel4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel4MouseEntered
jPanel4.setBackground(Color.getHSBColor(0, 0, (float) 0.97));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel4MouseEntered
private void jPanel4MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel4MouseExited
jPanel4.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel4MouseExited
private void jPanel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel5MouseClicked
try{
MessageFormat header;
header = new MessageFormat("Tabela zamówień");
MessageFormat footer;
footer = new MessageFormat("NetBest");
userTable.print(JTable.PrintMode.FIT_WIDTH, header, footer);
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
// TODO add your handling code here:
}//GEN-LAST:event_jPanel5MouseClicked
private void jPanel5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel5MouseEntered
jPanel5.setBackground(Color.getHSBColor(0, 0, (float) 0.97));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel5MouseEntered
private void jPanel5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel5MouseExited
jPanel5.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel5MouseExited
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
try {
odswiez();
// TODO add your handling code here:
} catch (SQLException ex) {
Logger.getLogger(OrderWindow.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(OrderWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_formWindowOpened
private void jPanel46MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel46MouseClicked
if(ulicaText1.getText().equals("")||ulText.getText().equals("")||domText.getText().equals("")||kodText.getText().equals("")||miejscowoscText.getText().equals("")||kodText.getText().indexOf("-")==-1){
bladText3.setVisible(true);
}
else{
if(sprawdz(ulicaText1.getText())==true){
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
stmt = conn.prepareStatement("SELECT COUNT(Pesel) FROM Clients WHERE pesel = ?");
stmt.setString(1, ulicaText1.getText());
stmt.executeQuery();
ResultSet rs;
rs = stmt.executeQuery( );
while(rs.next()){
istnieje = rs.getString(1).equals("1");
}
if(istnieje==true){
dodajOrder();
}
else{
bladText3.setVisible(true);
}
}
catch (SQLException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ClientsWindow.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
if (stmt != null) { stmt.close(); }
}
catch (Exception e) {
}
try {
if (conn != null) { conn.close(); }
}
catch (Exception e) {
}
}
}
else{
bladText3.setVisible(true);
}
}
// TODO add your handling code here:
}//GEN-LAST:event_jPanel46MouseClicked
private void jPanel46MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel46MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_jPanel46MouseEntered
private void jPanel46MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel46MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_jPanel46MouseExited
private void ulTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ulTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ulTextActionPerformed
private void domTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_domTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_domTextActionPerformed
private void kodTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kodTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_kodTextActionPerformed
private void miejscowoscTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miejscowoscTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_miejscowoscTextActionPerformed
private void ulicaText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ulicaText1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ulicaText1ActionPerformed
private void jPanel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel9MouseClicked
String deleteSQL = "DELETE FROM Orders WHERE ID_Order = ?";
PreparedStatement preparedStatement = null;
try {
preparedStatement = conn.prepareStatement(deleteSQL);
} catch (SQLException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
}
try {
preparedStatement.setString(1, login);
} catch (SQLException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
}
try {
// execute delete SQL stetement
preparedStatement.executeUpdate();
// TODO add your handling code here:
} catch (SQLException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
}
try {
odswiez();
czyUsun.setVisible(false);
// TODO add your handling code here:
} catch (SQLException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(UserPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jPanel9MouseClicked
private void jPanel9MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel9MouseEntered
jPanel9.setBackground(Color.getHSBColor(0, 0, (float) 0.98));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel9MouseEntered
private void jPanel9MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel9MouseExited
jPanel9.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel9MouseExited
private void jPanel10MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel10MouseEntered
jPanel10.setBackground(Color.getHSBColor(0, 0, (float) 0.98));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel10MouseEntered
private void jPanel10MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel10MouseExited
jPanel10.setBackground(Color.getHSBColor(0, 0, (float) 1));
// TODO add your handling code here:
}//GEN-LAST:event_jPanel10MouseExited
private void jPanel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel10MouseClicked
czyUsun.dispose();
// TODO add your handling code here:
}//GEN-LAST:event_jPanel10MouseClicked
private void userTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_userTableMouseClicked
DefaultTableModel model = (DefaultTableModel)userTable.getModel();
selectedRowIndex = userTable.getSelectedRow();
login = (String) userTable.getValueAt(selectedRowIndex, 0);
// TODO add your handling code here:
}//GEN-LAST:event_userTableMouseClicked
private void jPanel48MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel48MouseClicked
if(peselText2.getText().equals("")||ulText1.getText().equals("")||domText1.getText().equals("")||kodText1.getText().equals("")||miejscowoscText1.getText().equals("")){
bladText4.setVisible(true);
}
else{
try {
conn = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql2212964", "sql2212964", "tV5!yB5!");
String updateTableSQL = "UPDATE `sql2212964`.`Orders` SET `ID_User`=?, `ID_Product`=?, `ID_Client`=?, `Adres`=? WHERE `ID_Order`=?";
PreparedStatement preparedStatement = conn.prepareStatement(updateTableSQL);
preparedStatement.setString(3, peselText2.getText());
preparedStatement.setString(1, (String) jComboBox4.getSelectedItem());
preparedStatement.setString(2, (String) jComboBox3.getSelectedItem());
preparedStatement.setString(4, ulText1.getText()+" "+domText1.getText()+", "+kodText1.getText()+" "+miejscowoscText1.getText());
preparedStatement.setString(5, (String) userTable.getValueAt(selectedRowIndex, 0));
preparedStatement.executeUpdate();
try {
odswiez();
} catch (SQLException ex) {
Logger.getLogger(ClientsWindow.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ClientsWindow.class.getName()).log(Level.SEVERE, null, ex);
}
updateOrder.setVisible(false);
} catch (SQLException ex) {
Logger.getLogger(ClientsWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
// TODO add your handling code here:
}//GEN-LAST:event_jPanel48MouseClicked
private void jPanel48MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel48MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_jPanel48MouseEntered
private void jPanel48MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel48MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_jPanel48MouseExited
private void ulText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ulText1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ulText1ActionPerformed
private void domText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_domText1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_domText1ActionPerformed
private void kodText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kodText1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_kodText1ActionPerformed
private void miejscowoscText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miejscowoscText1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_miejscowoscText1ActionPerformed
private void peselText2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_peselText2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_peselText2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(OrderWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(OrderWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(OrderWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(OrderWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new OrderWindow().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel NetBest;
private javax.swing.JDialog addOrder;
private javax.swing.JLabel bladText3;
private javax.swing.JLabel bladText4;
private javax.swing.JDialog czyUsun;
private javax.swing.JTextField domText;
private javax.swing.JTextField domText1;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JComboBox<String> jComboBox2;
private javax.swing.JComboBox<String> jComboBox3;
private javax.swing.JComboBox<String> jComboBox4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel100;
private javax.swing.JLabel jLabel101;
private javax.swing.JLabel jLabel102;
private javax.swing.JLabel jLabel103;
private javax.swing.JLabel jLabel104;
private javax.swing.JLabel jLabel105;
private javax.swing.JLabel jLabel106;
private javax.swing.JLabel jLabel107;
private javax.swing.JLabel jLabel108;
private javax.swing.JLabel jLabel109;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel110;
private javax.swing.JLabel jLabel111;
private javax.swing.JLabel jLabel112;
private javax.swing.JLabel jLabel113;
private javax.swing.JLabel jLabel114;
private javax.swing.JLabel jLabel115;
private javax.swing.JLabel jLabel116;
private javax.swing.JLabel jLabel117;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel45;
private javax.swing.JPanel jPanel46;
private javax.swing.JPanel jPanel47;
private javax.swing.JPanel jPanel48;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator7;
private javax.swing.JSeparator jSeparator75;
private javax.swing.JSeparator jSeparator76;
private javax.swing.JSeparator jSeparator77;
private javax.swing.JSeparator jSeparator78;
private javax.swing.JSeparator jSeparator79;
private javax.swing.JSeparator jSeparator80;
private javax.swing.JSeparator jSeparator81;
private javax.swing.JSeparator jSeparator82;
private javax.swing.JSeparator jSeparator83;
private javax.swing.JSeparator jSeparator84;
private javax.swing.JSeparator jSeparator85;
private javax.swing.JSeparator jSeparator86;
private javax.swing.JSeparator jSeparator87;
private javax.swing.JSeparator jSeparator88;
private javax.swing.JTextField kodText;
private javax.swing.JTextField kodText1;
private javax.swing.JTextField miejscowoscText;
private javax.swing.JTextField miejscowoscText1;
private javax.swing.JTextField peselText2;
private javax.swing.JTextField ulText;
private javax.swing.JTextField ulText1;
private javax.swing.JTextField ulicaText1;
private javax.swing.JDialog updateOrder;
private javax.swing.JTable userTable;
// End of variables declaration//GEN-END:variables
}
| [
"32652648+xenox852@users.noreply.github.com"
] | 32652648+xenox852@users.noreply.github.com |
faedcf787ae9866f22f5927b02cfdb12efad18d6 | 0ba9272027ae6de7bd1b31d81dd2e4b63dfc0c7f | /src/Cart.java | ad5c10110188dd0395577969c97d265cb2bdc246 | [] | no_license | mlinea01/ShoppingCart | 06ad344a5c2bc1c1d3163ee6e9909f23a7e6feca | f2aad3ce35ebd61c1d6d6a092633646acda525cc | refs/heads/main | 2023-06-10T10:22:21.237966 | 2021-07-02T07:52:15 | 2021-07-02T07:52:15 | 380,669,061 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,729 | java | import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.CompoundBorder;
public class Cart
{
Scanner input = new Scanner(System.in);
private JFrame frame;
private JTextField itemName;
private JLabel itemList;
private JLabel alert;
private List<String> shoppingCart = new ArrayList<>();
/**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
Cart window = new Cart();
window.initialize();
window.frame.setVisible(true);
} catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Initialize the contents of the frame.
*/
private void initialize() throws IOException
{
//Creates frame.
frame = new JFrame();
frame.setBounds(100, 100, 513, 480);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.getContentPane().setLayout(null);
createLabels();
createTextfields();
createButtons();
addImage();
}
private void createLabels()
{
//Label used to set a title prompting the user to enter an item.
JLabel enterItemTitle = new JLabel("Enter an Item");
enterItemTitle.setFont(new Font("Times New Roman", Font.BOLD, 20));
enterItemTitle.setBounds(17, 36, 130, 14);
frame.getContentPane().add(enterItemTitle);
//Label that will be used to set the title of the shopping list where all items will appear.
JLabel shoppingList = new JLabel("Shopping List");
shoppingList.setHorizontalAlignment(SwingConstants.CENTER);
shoppingList.setFont(new Font("Times New Roman", Font.BOLD, 17));
shoppingList.setBounds(317, 3, 116, 30);
frame.getContentPane().add(shoppingList);
//Label that is used to print out the shopping list to the screen.
itemList = new JLabel("");
itemList.setOpaque(true);
itemList.setBackground(Color.WHITE);
itemList.setVerticalAlignment(SwingConstants.TOP);
itemList.setFont(new Font("Times New Roman", Font.BOLD, 15));
itemList.setBounds(259, 29, 228, 401);
JScrollPane itemListScrollbar = new JScrollPane(itemList);
itemListScrollbar.setBounds(259, 29, 228, 401);
frame.getContentPane().add(itemListScrollbar);
itemList.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.black),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
/*
* Label that will be used to print out alerts such as "You already added that item" if the item
* you want to add is already in the list.
*/
alert = new JLabel("");
alert.setForeground(Color.RED);
alert.setHorizontalAlignment(SwingConstants.CENTER);
alert.setFont(new Font("Times New Roman", Font.PLAIN, 16));
alert.setBounds(10, 199, 239, 36);
frame.getContentPane().add(alert);
}
private void createTextfields()
{
//Text field used to enter an item.
itemName = new JTextField();
itemName.setBounds(9, 75, 216, 20);
frame.getContentPane().add(itemName);
itemName.setColumns(10);
}
private void createButtons()
{
//Button that will be used to add an item into the list.
JButton addItem = new JButton("Add Item");
addItem.setBounds(17, 106, 99, 23);
frame.getContentPane().add(addItem);
//Button that will be used to delete an item from the list
JButton deleteItem = new JButton("Delete Item");
deleteItem.setBounds(126, 106, 99, 23);
frame.getContentPane().add(deleteItem);
//Button used to quit out of the application and close the window.
JButton quit = new JButton("Quit");
quit.setBounds(68, 153, 99, 23);
frame.getContentPane().add(quit);
/*
* Action listener that is called when the "add item" button is clicked to add an item to the shopping list.
* If the text field is empty and you click the "add item" button, it will alert the user to enter an item name.
* If you enter an item that is already in the list, it will alert the user that the item is already in the list.
*/
addItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0)
{
if(itemName.getText().isEmpty())
{
alert.setText("Please enter an item to add!");
itemName.requestFocus();
}
else if(!shoppingCart.contains(itemName.getText().trim().replaceAll("( )+", " ").toLowerCase()))
{
shoppingCart.add(itemName.getText().trim().replaceAll("( )+", " ").toLowerCase());
buildGroceryList();
resetText();
}
else
{
alert.setText("You already added that item!");
itemName.setText("");
itemName.requestFocus();
}
}
});
/*
* Action listener that is called when the "delete item" button is clicked to delete an item from the shopping list.
* If the text field is empty and you click the "delete item" button, it will alert the user to enter an item name.
* If you enter an item that is not in the list, it will alert the user that the item is not in the list.
*/
deleteItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0)
{
if(itemName.getText().isEmpty())
{
alert.setText("Please enter an item to delete!");
itemName.requestFocus();
}
else
{
if(!shoppingCart.contains(itemName.getText().trim().replaceAll("( )+", " ").toLowerCase()))
{
alert.setText("That item is not in your list.");
itemName.setText("");
itemName.requestFocus();
}
else
{
shoppingCart.remove(itemName.getText().trim().replaceAll("( )+", " ").toLowerCase());
buildGroceryList();
resetText();
}
}
}
});
//Action listener that is called when the "quit button" is clicked which will dispose of the frame, closing the window.
quit.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0)
{
frame.dispose();
}
});
}
//Method used to reset text fields after an item is added or deleted from the list.
private void resetText()
{
itemName.setText("");
alert.setText("");
itemName.requestFocus();
}
//Method used to build the StringBuilder that will be printed onto the screen after an item is added or deleted from the list.
private void buildGroceryList()
{
StringBuilder printList = new StringBuilder();
for(int i = 0; i < shoppingCart.size(); i++)
{
printList.append("<HTML>" + (i + 1) + ". "+ shoppingCart.get(i) + "<BR>");
}
itemList.setText(printList.toString());
}
private void addImage() throws IOException
{
/*
* Grabs the image from a specified file and stores it into a BufferedImage variable.
* This variable will then be used to add the image to a label to print the image out the screen.
*/
String path = "groceries.png";
File file = new File(path);
BufferedImage image = ImageIO.read(file);
//Label that is used to set an image in the frame.
JLabel groceryImage = new JLabel(new ImageIcon(image));
groceryImage.setBackground(Color.WHITE);
groceryImage.setBounds(10, 276, 239, 165);
frame.getContentPane().add(groceryImage);
}
}
| [
"33035299+mlinea01@users.noreply.github.com"
] | 33035299+mlinea01@users.noreply.github.com |
a6f356a9e17386bd637ebc2e8c9abba63d73ed70 | fa2bffd75be951ebc5f536f57b4dc9ffc32a2860 | /src/main/java/com/movie/service/AdminServiceImpl.java | 4ccbf0e67638d930ea355324503b2d3292883219 | [] | no_license | jeonjuyeong/Movie | acaad8040879f697e2a9580a891dae4a6f3bc708 | 06bda65ee0bdc24321ffd562dc5783200dbbaaa1 | refs/heads/master | 2020-04-28T07:58:27.932693 | 2019-03-27T05:52:12 | 2019-03-27T05:52:12 | 175,109,938 | 0 | 0 | null | 2019-03-27T05:11:01 | 2019-03-12T01:15:23 | PHP | UTF-8 | Java | false | false | 1,008 | java | package com.movie.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.movie.domain.GoodsVO;
import com.movie.domain.MemberVO;
import com.movie.domain.PayVO;
import com.movie.mapper.AdminMapper;
import com.movie.mapper.GoodsMapper;
import com.movie.mapper.MemberMapper;
import lombok.Setter;
@Service
public class AdminServiceImpl implements AdminService{
@Setter(onMethod_ = @Autowired)
private AdminMapper mapper;
@Override
public List<GoodsVO> goodsList() {
return mapper.goodsList();
}
@Override
public List<MemberVO> memberList() {
// TODO Auto-generated method stub
return mapper.memberList();
}
@Override
public List<PayVO> payList() {
// TODO Auto-generated method stub
return mapper.payList();
}
@Override
public void memberDelete(String id) {
mapper.memberDelete(id);
}
@Override
public void goodsDlelete(int num) {
mapper.goodsDelete(num);
}
}
| [
"junjy93@naver.com"
] | junjy93@naver.com |
61749629a88c44c1c80f1ac253a3e10d713c2230 | f50a7c0382ce6bef675b2be84980a33fb677ed41 | /springgboot-demo-mybatis/src/main/java/com/example/controller/StudentController.java | 54a6f3910c147d7f95199c00f87d8c0ff7118b61 | [] | no_license | cbeann/Demooo | fdad90069cd828c020493ebfbd4b5155e22eb1b8 | eea9d79dc2466db3c7b07f6ca6f5ee98c7cb7fbf | refs/heads/master | 2022-12-27T01:35:20.457033 | 2021-03-25T12:47:28 | 2021-03-25T12:47:28 | 241,686,742 | 0 | 7 | null | 2022-12-16T00:39:45 | 2020-02-19T17:57:40 | Java | UTF-8 | Java | false | false | 1,351 | java | package com.example.controller;
import com.example.entity.Student;
import com.example.service.StudentService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
/**
* (Student)表控制层
*
* @author makejava
* @since 2020-06-04 16:35:45
*/
@RestController
@RequestMapping("student")
public class StudentController {
/** 服务对象 */
@Resource private StudentService studentService;
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public String selectOne(Integer id) {
System.out.println("-------------");
Student student = this.studentService.queryById(id);
System.out.println(student);
return "success";
}
@GetMapping("hello")
public String hello() {
System.out.println("-------------");
return "hello";
}
@GetMapping("insert")
public String insert() {
System.out.println("-------------");
Student student = new Student();
student.setId(123);
student.setName("123");
student.setLocaldatetime(new Date());
studentService.insert(student);
System.out.println(student);
return "hello";
}
}
| [
"cbeann@163.com"
] | cbeann@163.com |
46a4faf8f44bad2c6842f6753dfc65c92c7294d7 | 0769fb21a0d9035edbfbfdd70ddcdc9d4451682c | /src/main/java/com/example/inventory_management/models/product/dict/BrandType.java | 0d96b61b8df92b086c31915e754f6ac91d53f963 | [] | no_license | axel-n/inventory_management | e35e8396283cbc6a7bed4b0de12165fb4051881e | 4daae7bdea9690b4f59d6da8c50e548422fe2e24 | refs/heads/master | 2020-07-11T05:18:19.134519 | 2019-08-26T21:10:15 | 2019-08-26T21:10:15 | 204,454,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.example.inventory_management.models.product.dict;
public enum BrandType {
COMPANY_A, COMPANY_B, COMPANY_C, COMPANY_D, COMPANY_E, COMPANY_F, COMPANY_G,
}
| [
"anoshkin.allex@gmail.com"
] | anoshkin.allex@gmail.com |
d3f50feb71d0b71366dd80cc913bd024ddfa4318 | c264f4f85dcd008ce65e9bd422fc1becbc7f50f6 | /src/main/java/summary/solution/SummarySolutionExercise2.java | 280695d28b2b61899f46242e0ac5c56c1942d328 | [] | no_license | anyulled/java-8-lambdas-intro | 6640bf56f3e973b9acf62697a5f7df7ae54fe0c4 | f91f0bc6fd0a07dc59aba5f530785a51b6d2bd15 | refs/heads/master | 2023-04-07T19:17:43.866964 | 2021-02-16T08:02:38 | 2021-02-16T08:02:38 | 80,712,512 | 2 | 1 | null | 2023-04-03T23:58:31 | 2017-02-02T09:55:46 | Java | UTF-8 | Java | false | false | 787 | java | package summary.solution;
import org.junit.Test;
import summary.Exercise;
import java.io.File;
import java.util.Arrays;
/**
* Using the list(FilenameFilter) method of the java.io.File class, write a
* method that returns all files in a given directory with a given extension.
* Use a lambda expression, not a FilenameFilter. Which variables from the
* enclosing scope does it capture?
*/
public class SummarySolutionExercise2 implements Exercise {
@Test
@Override
public void perform() {
String[] files = list(".", "md");
Arrays.asList(files).forEach(System.out::println);
}
private static String[] list(String inputDir, String ext) {
File dirFile = new File(inputDir);
return dirFile.list((File dir, String name) -> {
return name.endsWith(ext);
});
}
}
| [
"AOHZ@gft.com"
] | AOHZ@gft.com |
b5dc25d763f299b7633724d97de9e8cd2a5baaa0 | b8b5ff83bf34169f3e7c75dab3573de2bfa06a12 | /library/src/main/java/cn/wei/library/fragment/BaseGridViewFragment.java | d533dc4158025300242f33f70096c4484ebdd1a5 | [] | no_license | wanjingyan001/akm | c889963f2c5772db8368039f095815ca7b954750 | 7d84ccc61c98ae804806fad7445a11558d96c240 | refs/heads/master | 2021-01-10T01:37:57.911792 | 2016-03-26T03:07:57 | 2016-03-26T03:07:57 | 54,759,913 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,001 | java | package cn.wei.library.fragment;
import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.GridView;
import com.handmark.pulltorefresh.PullToRefreshBase;
import com.handmark.pulltorefresh.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.PullToRefreshGridView;
import java.util.ArrayList;
import cn.wei.library.R;
public abstract class BaseGridViewFragment extends BaseFragment implements OnItemClickListener, OnRefreshListener<GridView> {
protected PullToRefreshGridView mPullToRefreshGridView;
protected ListAdapter mAdapter;
protected ArrayList<Object> modules = new ArrayList<Object>();
@Override
protected void initializeView(View v) {
mPullToRefreshGridView = (PullToRefreshGridView) v.findViewById(R.id.generalPullToRefreshGridView);
if (mPullToRefreshGridView == null) {
throw new IllegalArgumentException("you contentView must contains id:generalPullToRefreshLsv");
}
mPullToRefreshGridView.setMode(Mode.PULL_FROM_START);
mPullToRefreshGridView.setPullToRefreshOverScrollEnabled(getPullToRefreshOverScrollEnabled());
mAdapter = new ListAdapter();
mPullToRefreshGridView.setOnRefreshListener(this);
mPullToRefreshGridView.getRefreshableView().setAdapter(mAdapter);
mPullToRefreshGridView.getRefreshableView().setOnItemClickListener(this);
}
public boolean getPullToRefreshOverScrollEnabled() {
return false;
}
@Override
public void onRefresh(PullToRefreshBase<GridView> refreshView) {
String label = DateUtils.formatDateTime(getActivity(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL);
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel("最近更新:" + label);
}
public class ListAdapter extends BaseAdapter {
@Override
public int getCount() {
return modules.size();
}
@Override
public Object getItem(int position) {
return modules.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getAdapterViewAtPosition(position, convertView, parent);
}
@Override
public int getViewTypeCount() {
return getAdapterViewTypeCount();
}
@Override
public int getItemViewType(int position) {
return getAdapterViewType(position);
}
}
public int getAdapterViewTypeCount() {
return 1;
}
public abstract View getAdapterViewAtPosition(int position, View convertView, ViewGroup parent);
public int getAdapterViewType(int position) {
return 0;
}
/**
* ItemView的点击事件
*
* @param parent
* @param view
* @param position
* @param id
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
}
| [
"670263921@qq.com"
] | 670263921@qq.com |
e7be38cd24120049093a94b0f07fc71f8994ebfe | d142c8b8a3aa73b52c3e02c6af9ac3016898cbdb | /Shirt.java | dca6ebb4060fbbb0a057f3a72d83fabeec7abce2 | [] | no_license | zepedak1/Java-Works | 1768b4c5c8672667365f96c4d065068eb8765edd | 0bf871e5444482d756b34ad48b74300379d01739 | refs/heads/master | 2020-08-29T16:55:53.300543 | 2019-10-30T17:41:20 | 2019-10-30T17:41:20 | 218,101,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | public class Shirt
{
public int size, sleeve;
public static String material = "cotton";
public void Construct(int size, int sleeve)
{
this.size = size;
this.sleeve = sleeve;
System.out.println("Shirt size: " + size);
System.out.println("Sleeve size: " + sleeve);
System.out.println("Material: " + this.material);
}
} | [
"noreply@github.com"
] | noreply@github.com |
71b0af0b8817185ead21014931b14984cbde24fe | 5c5670a266ef3b60b68a64cd9496019f8818d31f | /CannonShooter/core/src/com/mygdx/game/TouchController.java | fb35954a85bc0495f6de726b9b07f70885cd4cad | [] | no_license | nikolastojkoski/CannonShooter-Android | 45452495cd89ae9411e35070e7e20acc7b8613b3 | c134e42b7d0de96ab53cedc75374691e2c1c80aa | refs/heads/master | 2020-12-06T09:19:36.092993 | 2020-01-07T21:34:14 | 2020-01-07T21:34:14 | 232,421,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | package com.mygdx.game;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.input.GestureDetector;
import com.badlogic.gdx.math.Vector2;
public class TouchController implements GestureDetector.GestureListener{
private Cannon cannon;
private MyGdxGame game;
private final Texture blockTexture = new Texture("block.png");
public TouchController(Cannon cannon, MyGdxGame game){
super();
Gdx.app.setLogLevel(Application.LOG_DEBUG);
this.cannon = cannon;
this.game = game;
}
@Override
public boolean longPress(float x, float y) {
MyGdxGame.drawSprite = !MyGdxGame.drawSprite;
cannon.shoot();
return true;
}
@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
//cannon.rotate( 4*10^{-6}x^2-0.0038x+1 * distance(touch, cannon) * deltaY * 0.24f);
if(game.getGamePhase() == MyGdxGame.GamePhase.CANNON_WAITING){
Gdx.app.log("Touch-Pan", "x,y,dx,dy: " + x + ", " + y + ", " + deltaX + ", " +deltaY);
cannon.rotate(deltaY * 0.24f );
return true;
}else{
return false;
}
}
@Override
public boolean tap(float x, float y, int count, int button) {
if(game.getGamePhase() == MyGdxGame.GamePhase.GAME_OVER){
game.dispose();
game.initialize();
}
return true;
}
@Override
public boolean touchDown(float x, float y, int pointer, int button) {
return false;
}
@Override
public boolean fling(float velocityX, float velocityY, int button) { return false; }
@Override
public boolean panStop(float x, float y, int pointer, int button) {
return false;
}
@Override
public boolean zoom(float initialDistance, float distance) {
return false;
}
@Override
public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
return false;
}
@Override
public void pinchStop() {
}
}
| [
"nikolastojkoski3@gmail.com"
] | nikolastojkoski3@gmail.com |
a5573e74d07bbfd976d7ba5a1f2097b00e394a33 | 948fd9e4c2ce1b8483a800d7e3bf05e34735f743 | /src/prob3/Cat.java | 413a2aa295b42b1f837cae30b4991831807c1f53 | [] | no_license | alskflsjoon/practice05 | 8e686994227241594309d034bc0007c5da2e13e6 | cea9b0f9369466f351fc7d1c45ceedcdb617eaac | refs/heads/master | 2021-01-21T02:50:21.808579 | 2016-03-10T11:32:34 | 2016-03-10T11:32:34 | 53,556,515 | 0 | 0 | null | 2016-03-10T05:03:50 | 2016-03-10T05:03:50 | null | UTF-8 | Java | false | false | 122 | java | package prob3;
public class Cat implements Soundable {
@Override
public String sound() {
return "\"야옹\"";
}
}
| [
"alskflsjoon@naver.com"
] | alskflsjoon@naver.com |
740b0006e559b3c5a91a84c9003d95649ddc23d6 | 535cd91db6d15c02aa871181b85d37adcacc2607 | /app/src/test/java/com/zhonghua/sdw/takkyuu/ExampleUnitTest.java | 9192161be1e676d6de812051522ff2e71dca9b16 | [] | no_license | dileber/takkyuu | f8ecf889322bba1997a728983f1ee94898914f62 | 366b591a134410330a7d880e12f86791a7efc242 | refs/heads/master | 2020-12-24T11:17:29.002603 | 2016-11-07T04:31:44 | 2016-11-07T04:31:44 | 73,041,235 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.zhonghua.sdw.takkyuu;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"297165331@qq.com"
] | 297165331@qq.com |
0219a22993b5b3956f12a4f12801a4b0498bf824 | bc3a34a30a6cc21132f07d3c739ab7c76139d423 | /environment/src/main/java/jetbrains/exodus/env/TransactionImpl.java | 97af1afaa79ce4295cd679260f8d8490a8c442d3 | [
"Apache-2.0"
] | permissive | elaatifi/xodus | 68530c14659bea03c1c82b477935e0ae3b8a08ed | 9a736ccfc24051433c7e176c489b2bc58c4a89ce | refs/heads/master | 2021-01-18T01:12:35.679312 | 2015-07-03T17:16:58 | 2015-07-03T17:16:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,794 | java | /**
* Copyright 2010 - 2015 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 jetbrains.exodus.env;
import jetbrains.exodus.ExodusException;
import jetbrains.exodus.core.dataStructures.Pair;
import jetbrains.exodus.core.dataStructures.decorators.HashMapDecorator;
import jetbrains.exodus.core.dataStructures.hash.IntHashMap;
import jetbrains.exodus.core.dataStructures.hash.LongHashMap;
import jetbrains.exodus.log.Loggable;
import jetbrains.exodus.tree.ITree;
import jetbrains.exodus.tree.ITreeMutable;
import jetbrains.exodus.tree.TreeMetaInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
public class TransactionImpl implements Transaction {
@NotNull
private final EnvironmentImpl env;
@Nullable
private final Thread creatingThread;
@NotNull
private MetaTree metaTree;
@NotNull
private final IntHashMap<ITree> immutableTrees;
@NotNull
private final Map<Integer, ITreeMutable> mutableTrees;
@NotNull
private final LongHashMap<Pair<String, ITree>> removedStores;
@NotNull
private final Map<String, TreeMetaInfo> createdStores;
@Nullable
private Runnable beginHook;
@Nullable
private Runnable commitHook;
@Nullable
private final Throwable trace;
private long created;
TransactionImpl(@NotNull final EnvironmentImpl env, @Nullable final Thread creatingThread,
@Nullable final Runnable beginHook, final boolean cloneMeta) {
this.env = env;
this.creatingThread = creatingThread;
immutableTrees = new IntHashMap<>();
mutableTrees = new TreeMap<>();
removedStores = new LongHashMap<>();
createdStores = new HashMapDecorator<>();
this.beginHook = new Runnable() {
@Override
public void run() {
final MetaTree currentMetaTree = env.getMetaTreeUnsafe();
metaTree = cloneMeta ? currentMetaTree.getClone() : currentMetaTree;
env.registerTransaction(TransactionImpl.this);
if (beginHook != null) {
beginHook.run();
}
}
};
trace = env.transactionTimeout() > 0 ? new Throwable() : null;
invalidateCreated();
holdNewestSnapshot();
}
/**
* Constructor for creating new snapshot transaction.
*/
protected TransactionImpl(@NotNull final TransactionImpl origin) {
env = origin.env;
metaTree = origin.metaTree;
commitHook = origin.commitHook;
creatingThread = origin.creatingThread;
immutableTrees = new IntHashMap<>();
mutableTrees = new TreeMap<>();
removedStores = new LongHashMap<>();
createdStores = new HashMapDecorator<>();
trace = env.transactionTimeout() > 0 ? new Throwable() : null;
invalidateCreated();
env.registerTransaction(this);
}
public boolean isIdempotent() {
return mutableTrees.isEmpty() && removedStores.isEmpty() && createdStores.isEmpty();
}
@Override
public void abort() {
doRevert();
env.finishTransaction(this);
}
@Override
public boolean commit() {
return env.commitTransaction(this, false);
}
@Override
public boolean flush() {
final boolean result = env.flushTransaction(this, false);
if (result) {
invalidateCreated();
}
return result;
}
@Override
public void revert() {
doRevert();
final long oldRoot = metaTree.root;
holdNewestSnapshot();
if (!checkVersion(oldRoot)) {
env.runTransactionSafeTasks();
}
if (!env.isRegistered(this)) {
throw new ExodusException("Transaction should remain registered after revert");
}
invalidateCreated();
}
@Override
public Transaction getSnapshot() {
return new ReadonlyTransaction(this);
}
@Override
@NotNull
public Environment getEnvironment() {
return env;
}
@Override
public void setCommitHook(@Nullable final Runnable hook) {
commitHook = hook;
}
@Override
public long getCreated() {
return created;
}
@Override
public long getHighAddress() {
return metaTree.highAddress;
}
public boolean forceFlush() {
return env.flushTransaction(this, true);
}
@Nullable
public Throwable getTrace() {
return trace;
}
@NotNull
public StoreImpl openStoreByStructureId(final int structureId) {
final String storeName = metaTree.getStoreNameByStructureId(structureId, env);
return storeName == null ?
new TemporaryEmptyStore(env) :
env.openStoreImpl(storeName, StoreConfig.USE_EXISTING, this, env.getCurrentMetaInfo(storeName, this));
}
@NotNull
public ITree getTree(@NotNull final StoreImpl store) {
final ITreeMutable result = mutableTrees.get(store.getStructureId());
if (result == null) {
return getImmutableTree(store);
}
return result;
}
void storeRemoved(@NotNull final StoreImpl store) {
final int structureId = store.getStructureId();
final ITree tree = store.openImmutableTree(metaTree);
removedStores.put(structureId, new Pair<>(store.getName(), tree));
immutableTrees.remove(structureId);
mutableTrees.remove(structureId);
}
void storeCreated(@NotNull final StoreImpl store) {
getMutableTree(store);
createdStores.put(store.getName(), store.getMetaInfo());
}
/**
* Returns tree meta info by name of a newly created (in this transaction) store.
*/
@Nullable
TreeMetaInfo getNewStoreMetaInfo(@NotNull final String name) {
return createdStores.get(name);
}
boolean isStoreNew(@NotNull final String name) {
return createdStores.containsKey(name);
}
boolean checkVersion(final long root) {
return metaTree.root == root;
}
Iterable<Loggable>[] doCommit(@NotNull final MetaTree[] out) {
final Set<Map.Entry<Integer, ITreeMutable>> entries = mutableTrees.entrySet();
final Set<Map.Entry<Long, Pair<String, ITree>>> removedEntries = removedStores.entrySet();
final int size = entries.size() + removedEntries.size();
//noinspection unchecked
final Iterable<Loggable>[] expiredLoggables = new Iterable[size + 1];
int i = 0;
final ITreeMutable metaTreeMutable = metaTree.tree.getMutableCopy();
for (final Map.Entry<Long, Pair<String, ITree>> entry : removedEntries) {
final Pair<String, ITree> value = entry.getValue();
MetaTree.removeStore(metaTreeMutable, value.getFirst(), entry.getKey());
expiredLoggables[i++] = TreeMetaInfo.getTreeLoggables(value.getSecond());
}
removedStores.clear();
for (final Map.Entry<String, TreeMetaInfo> entry : createdStores.entrySet()) {
MetaTree.addStore(metaTreeMutable, entry.getKey(), entry.getValue());
}
createdStores.clear();
final Collection<Loggable> last;
for (final Map.Entry<Integer, ITreeMutable> entry : entries) {
final ITreeMutable treeMutable = entry.getValue();
expiredLoggables[i++] = treeMutable.getExpiredLoggables();
MetaTree.saveTree(metaTreeMutable, treeMutable);
}
immutableTrees.clear();
mutableTrees.clear();
expiredLoggables[i] = last = metaTreeMutable.getExpiredLoggables();
out[0] = MetaTree.saveMetaTree(metaTreeMutable, env, last);
return expiredLoggables;
}
void setMetaTree(@NotNull final MetaTree metaTree) {
this.metaTree = metaTree;
}
void executeCommitHook() {
if (commitHook != null) {
commitHook.run();
}
}
@NotNull
ITreeMutable getMutableTree(@NotNull final StoreImpl store) {
if (creatingThread != null && !creatingThread.equals(Thread.currentThread())) {
throw new ExodusException("Can't create mutable tree in a thread different from the one which transaction was created in.");
}
final int structureId = store.getStructureId();
ITreeMutable result = mutableTrees.get(structureId);
if (result == null) {
result = getImmutableTree(store).getMutableCopy();
mutableTrees.put(structureId, result);
}
return result;
}
/**
* @param store opened store.
* @return whether a mutable tree is created for specified store.
*/
boolean hasTreeMutable(@NotNull final StoreImpl store) {
return mutableTrees.containsKey(store.getStructureId());
}
void removeTreeMutable(@NotNull final StoreImpl store) {
mutableTrees.remove(store.getStructureId());
}
@Nullable
Thread getCreatingThread() {
return creatingThread;
}
@NotNull
MetaTree getMetaTree() {
return metaTree;
}
long getRoot() {
return metaTree.root;
}
List<String> getAllStoreNames() {
// TODO: optimize
List<String> result = metaTree.getAllStoreNames();
if (createdStores.isEmpty()) return result;
if (result.isEmpty()) {
result = new ArrayList<>();
}
result.addAll(createdStores.keySet());
Collections.sort(result);
return result;
}
private void invalidateCreated() {
created = System.currentTimeMillis();
}
private void holdNewestSnapshot() {
env.getMetaTree(beginHook);
}
@NotNull
private ITree getImmutableTree(@NotNull final StoreImpl store) {
final int structureId = store.getStructureId();
ITree result = immutableTrees.get(structureId);
if (result == null) {
result = store.openImmutableTree(metaTree);
immutableTrees.put(structureId, result);
}
return result;
}
private void doRevert() {
immutableTrees.clear();
mutableTrees.clear();
removedStores.clear();
createdStores.clear();
}
}
| [
"lvo@intellij.net"
] | lvo@intellij.net |
e49497e0780a1ce78a870b97ca9886128dca03b8 | dc18d16b4319eb7853aee9466cc98dddf65c12b2 | /ManejoInterfaces/src/datos/ImplementacionOracle.java | de5a46191505b831ffb37002d5b206777f88f90e | [] | no_license | emilianososa93/PractivaJAVA | bb287292d36faa8feff53488c27e8129ba86b9a3 | db039f35f27dc2d0b57a5e4f79fe7898e17da509 | refs/heads/master | 2020-04-11T01:18:14.745589 | 2019-04-10T21:59:04 | 2019-04-10T21:59:04 | 161,411,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | 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 datos;
/**
*
* @author Emiliano
*/
public class ImplementacionOracle implements AccesoDatos {
@Override
public void Insertar(){
System.out.println("Se esta insertando desde Oracle");
}
@Override
public void Listar(){
System.out.println("Se esta listando desde Oracle");
}
}
| [
"emiliano_sosa93@hotmail.com"
] | emiliano_sosa93@hotmail.com |
7616191c24dd186af2bf2b9cd743adec1493d1f1 | b05face5718be598430f509fb2de391a1dca1050 | /Chapter9/src/main/java/com/wjh/httpclient/cookies/MyCookiesForGet.java | 35bcf2dea121b8a680de2672b5ad9a02bfd44441 | [] | no_license | wjh-one/AutoTest | 0af8ed8699de3d0e6658bc1ae37b62a1a7f2e5c0 | f742c184e7ccd0d50cbbbc260f34a385cf35d214 | refs/heads/master | 2023-05-08T12:25:03.107336 | 2020-06-08T15:48:36 | 2020-06-08T15:48:36 | 262,040,353 | 0 | 0 | null | 2021-06-04T02:41:32 | 2020-05-07T12:10:18 | Java | UTF-8 | Java | false | false | 2,681 | java | package com.wjh.httpclient.cookies;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.CookieStore;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
public class MyCookiesForGet {
private String url;
//读取资源属性文件
private ResourceBundle bundle;
//用力存储cookies信息的变量
private CookieStore store;
@BeforeTest
public void beforeTest(){
bundle = ResourceBundle.getBundle("application", Locale.CHINA);
url = bundle.getString("test.url");
}
@Test
public void testGetCookies() throws IOException {
String result;
//从配置文件中获取测试的url
String uri = bundle.getString("getCookies.uri");
String testUrl = this.url+uri;
//测试逻辑代码书写
HttpGet get = new HttpGet(testUrl);
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "utf-8");
System.out.println(result);
//获取cookies信息
this.store = client.getCookieStore();
List<Cookie> cookieList = store.getCookies();
for (Cookie cookie : cookieList) {
String name = cookie.getName();
String value = cookie.getValue();
System.out.println("cookie name = " + name + ", cookies values = " + value);
}
}
@Test(dependsOnMethods = {"testGetCookies"})
public void testGetWithCookies() throws IOException {
String uri = bundle.getString("test.get.with.cookie");
String testUrl = this.url+uri;
HttpGet get = new HttpGet(testUrl);
DefaultHttpClient client = new DefaultHttpClient();
//设置cookies信息
client.setCookieStore(this.store);
HttpResponse response = client.execute(get);
//获取相应的状态码
int statusCode = response.getStatusLine().getStatusCode();
System.out.println("状态码为:" + statusCode);
if (statusCode == 200){
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity, "utf-8");
System.out.println(result);
}
}
}
| [
"wjh_dan@163.com"
] | wjh_dan@163.com |
32c286cde8b2a7c2786908855f5061437f34114b | 77e93f3f66ed37dc7b181f4a5412736fb673db3c | /src/test/java/financialConsultantProject/CalculationManagerTest.java | 190f6b4100bc6b02d5348a30bb2b6579ccf0395e | [] | no_license | Jeya2621/FinancialConsultantCode | c1c1825b1f9a37125a3d26a4ad8d599a3b70405d | c4077b7849d1d45e3b0a845245fa9d44854bf6d0 | refs/heads/master | 2023-04-28T14:30:11.750809 | 2021-05-06T10:37:42 | 2021-05-06T10:37:42 | 364,873,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,964 | java | package financialConsultantProject;
import static org.junit.Assert.*;
import org.junit.Test;
public class CalculationManagerTest {
/* For Interest Calculation Check */
@Test
public void test1HomeLoan() {
// int amount = 1000000;
int interest = Calculation.calculationOfHouseLoan(1000000);
assertEquals(-20000, interest);
}
@Test
public void test2HomeLoan() {
// int amount = 2500000;
int interest = Calculation.calculationOfHouseLoan(2500000);
assertEquals(75000, interest);
}
@Test
public void test3HouseLoan() {
// int amount = 5000000;
int interest = Calculation.calculationOfHouseLoan(5000000);
assertEquals(250000, interest);
}
@Test
public void testEducationLoan() {
// int amount = 200000;
int interest = Calculation.calculationOfEducationLoan(200000);
assertEquals(4000, interest);
}
@Test
public void testAgriLoan() {
// int amount = 7000;
// int acre = 22 ;
int interest = Calculation.calculationOfAgriLoan(22);
assertEquals(1540, interest);
}
@Test
public void testPersonalLoan() {
// int amount = 300000;
int interest = Calculation.calculationOfPersonalLoan(300000);
assertEquals(9000, interest);
}
@Test
public void test1GoldLoan() {
// String goldType = "22k";
// int gram = 22;
// int amount = 3000;
int interest = Calculation.calculationOfGoldLoan("22K", 22);
assertEquals(660, interest);
}
@Test
public void test2GoldLoan() {
int interest = Calculation.calculationOfGoldLoan("24K", 21);
assertEquals(735, interest);
}
@Test
public void test1VehicleLoan() {
int interest = Calculation.calculationOfVehicleLoan("twowheeler");
assertEquals(6000, interest);
}
@Test
public void test2VehicleLoan() {
int interest = Calculation.calculationOfVehicleLoan("fourwheeler");
assertEquals(15000, interest);
}
@Test
public void test3VehicleLoan() {
int interest = Calculation.calculationOfVehicleLoan("others");
assertEquals(21000, interest);
}
}
| [
"jeya2671@global.chainsys.com"
] | jeya2671@global.chainsys.com |
25b9e05ef3b5c128fb2c22b9bc32c13e6b499a83 | d97304e44932a844fab26a14ccb13f47143a18c3 | /AndroidStudioProjects/Alarm/app/src/androidTest/java/c/takito/alarm/ExampleInstrumentedTest.java | 728410269361a32f8ca55f9e6e9ae28b933e2dc3 | [] | no_license | Scyklone/Android_apps | 339a0b68c4ce58997d55c7f4adf0b4aed43564ff | ecf4f44193fc2c830647c4f07584648a3805c261 | refs/heads/master | 2022-12-09T22:53:47.227155 | 2020-09-08T03:10:28 | 2020-09-08T03:10:28 | 293,686,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package c.takito.alarm;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("c.takito.alarm", appContext.getPackageName());
}
}
| [
"31068412+Scyklone@users.noreply.github.com"
] | 31068412+Scyklone@users.noreply.github.com |
80108da84db0f6918d018b3d36045cd8a71c60d7 | a56e49172197a6724916162fa05fd22151ef9c51 | /MinimumGifts.java | 47d34ea044f81c991d51b88a4a34bdb7053c3b3a | [] | no_license | Aryan3712/CodeVita-Problems | aef44983bb9e5d0230c1fe1058cfe8fc40664bb1 | 100f60f1e7a47816e302d9774863611ae35a90ce | refs/heads/main | 2022-12-27T01:31:08.505901 | 2020-10-12T10:01:54 | 2020-10-12T10:01:54 | 303,148,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,315 | java | /* >>>Minimum Gifts<<<
A Company has decided to give some gifts to all of its employees.
For that, company has given some rank to each employee.
Based on that rank, company has made certain rules to distribute the gifts.
The rules for distributing the gifts are:
Each employee must receive at least one gift.
Employees having higher ranking get a greater number of gifts than their neighbours.
What is the minimum number of gifts required by company?
Constraints
1 < T < 10
1 < N < 100000
1 < Rank < 10^9
Input
First line contains integer T, denoting the number of test cases.
For each test case:
First line contains integer N, denoting the number of employees.
Second line contains N space separated integers, denoting the rank of each employee.
Output
For each test case print the number of minimum gifts required on new line.
Example 1
Input
2
5
1 2 1 5 2
2
1 2
Output
7
3
Explanation
For testcase 1, adhering to rules mentioned above,
Employee # 1 whose rank is 1 gets one gift
Employee # 2 whose rank is 2 gets two gifts
Employee # 3 whose rank is 1 gets one gift
Employee # 4 whose rank is 5 gets two gifts
Employee # 5 whose rank is 2 gets one gift
Therefore, total gifts required is 1 + 2 + 1 + 2 + 1 = 7
Similarly, for testcase 2, adhering to rules mentioned above,
Employee # 1 whose rank is 1 gets one gift
Employee # 2 whose rank is 2 gets two gifts
Therefore, total gifts required is 1 + 2 = 3*/
import java.util.Scanner;
public class MinimumGifts
{
private static int minimumGifts(int num,int[] arr)
{
int count=num;
for(int i=0;i<num-1;i++)
{
for(int j=i+1;j<num;j++)
{
if(arr[i]<arr[j])
{
count++;
}
break;
}
}
return count;
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int testcases = sc.nextInt();
while(testcases>0)
{
int num = sc.nextInt();
int arr[] = new int[num];
for(int i=0; i<num; i++)
arr[i] = sc.nextInt();
System.out.println(minimumGifts(num, arr));
testcases--;
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
0a6bdfc151c94cc81d07d2c3aeefe8f10bc9cd3d | cdb6e54427d56d5cb497ccd01d9a45fc8c45e2fd | /src/designpatterns/factory/cities/NYStyleCheesePizza.java | d7ad618fb53a89d460292c120c8dd8775a3539a3 | [] | no_license | jamesmarva/MyThinkingInJava | 07bf2b14c9235c5f0bb71a55b0dfca2bc7f7face | 3b1f841c4f8b3e86b386a1436e7d50a6359dd8f9 | refs/heads/master | 2020-03-30T12:18:53.597664 | 2018-11-01T12:15:28 | 2018-11-01T12:15:28 | 151,218,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package designpatterns.factory.cities;
/**
* @author james reall008@163.com 10/14/2018
*/
public class NYStyleCheesePizza extends Pizza {
public NYStyleCheesePizza() {
name = "NY Style Sauce and Cheese Pizza";
dough = "Thin Crust Dough";
sauce = "Marinara Sauce";
toppings.add("Grated Reggiano Cheese");
}
} | [
"jamesmarva@163.com"
] | jamesmarva@163.com |
cfd51189ef995b3cdc6956c2a95a499104fd927b | 634e3328d7373df19443d5bfa3ed4d1460e40184 | /back-end/src/main/java/com/syouketu/modules/project/mapper/TableConfigMapper.java | ce231775ef48155b569399e089cfcd9dddbe3f11 | [
"Apache-2.0"
] | permissive | syouketu/code-generator | c4ba0a7f64a3edf4ba53295464a2a702bba53412 | fabe0da50aedff607602f215ee009a487e3a62ca | refs/heads/main | 2023-07-15T07:03:24.798104 | 2021-08-27T02:30:23 | 2021-08-27T02:30:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package com.syouketu.modules.project.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.syouketu.modules.project.dto.input.TableConfigQueryPara;
import com.syouketu.modules.project.entity.TableConfig;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 项目数据表配置信息表 Mapper 接口
* </p>
*
* @author xiaojie
* @since 2019-07-08
*/
public interface TableConfigMapper extends BaseMapper<TableConfig> {
/**
* 列表分页
*
* @param page
* @param filter
* @return
*/
List<TableConfig> selectTableConfigs(Pagination page, @Param("filter") TableConfigQueryPara filter);
/**
* 列表
*
* @param filter
* @return
*/
List<TableConfig> selectTableConfigs(@Param("filter") TableConfigQueryPara filter);
} | [
"xiaojie@coicplat.com"
] | xiaojie@coicplat.com |
9d84d3215edb37d7189632dc7b3624b24ec62d53 | 48dbed5207adeb5e74e94db517231a73ab012271 | /QuickParse/src/quickparse/semantics/interpreters/typed/exception/TokenMethodParameterException.java | a5c9b06752ca48947b72f7141760187c540105c9 | [
"Apache-2.0"
] | permissive | sv-giampa/QuickParse | 31fa9f3beb31c8461cc3625dc5265c3aaba3afa0 | b1df8a081f200769f824c6008e0892fa5e964197 | refs/heads/master | 2023-02-06T08:48:51.477345 | 2020-12-31T16:33:27 | 2020-12-31T16:33:27 | 325,297,053 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | /*
* Copyright 2020 Salvatore Giampa'
*
* 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 quickparse.semantics.interpreters.typed.exception;
import quickparse.grammar.symbol.TokenSymbol;
import java.lang.reflect.Method;
public class TokenMethodParameterException extends InterpreterException {
public final TokenSymbol tokenSymbol;
public final Method method;
private static String getMessage(TokenSymbol tokenSymbol, Method method){
return "";
}
public TokenMethodParameterException(TokenSymbol tokenSymbol, Method method) {
super(getMessage(tokenSymbol, method));
this.tokenSymbol = tokenSymbol;
this.method = method;
}
}
| [
"sv.giampa@gmail.com"
] | sv.giampa@gmail.com |
78e0c9c734e6a9cd3a3767ec9cadbcd44f253b4e | 5779a9412cc026224fb389d8c2698def1473532d | /109356003_OOP_Lab09/src/Supervisor.java | 3505acb62c21262c32afdebe7cebdfa9ba72388f | [] | no_license | AlstonYang/Java_Tutorial | 1273ec43da835049ae99f2ea67f5bd3582187698 | 423cf1793a4036f6867ac2f0ed114ebb0c97d186 | refs/heads/main | 2023-04-13T12:12:18.207352 | 2021-05-02T07:44:53 | 2021-05-02T07:44:53 | 346,251,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | import java.util.ArrayList;
public class Supervisor extends Employee {
private ArrayList <Employee> subordinates;
public Supervisor(int ID, String name, BankAccount account, String department, int baseSalary, ArrayList<Employee> subordinates, int sales) {
super(ID, name, account, department, baseSalary, sales);
this.subordinates = subordinates;
int totalSales = sales;
for (Employee employee:this.subordinates) {
totalSales+= employee.getSales();
}
this.setSales(totalSales);
}
}
| [
"alston@100.76.49.45"
] | alston@100.76.49.45 |
12159e57d97fe9fdadc0633ea38a4a5cbb5f3e08 | 2ae242ec38434bd8dd86f1bc89cd287851155df5 | /src/main/java/com/atmecs/yatra/utils/ReadDataFromExcel.java | 560d14472fb0dbd7da56eec77276d93983a1b36b | [] | no_license | Alfin-xavier/Assessment-3 | 6c1047e3cda91369cfcd7d8f7c6ce5cb5ef74dba | 9795f106baeb4323a1ddbc92371773edfac634a0 | refs/heads/master | 2023-02-04T13:58:53.622317 | 2020-12-18T07:41:19 | 2020-12-18T07:41:19 | 321,307,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | package com.atmecs.yatra.utils;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.atmecs.yatra.constants.FilePathConstants;
public class ReadDataFromExcel
{
public static XSSFWorkbook workbook;
public static XSSFSheet sheet;
public static XSSFCell cell;
public static Object[][] data;
public static Object[][] readExcelData(String sheetname)
{
FileInputStream finput = null;
try
{
finput = new FileInputStream(FilePathConstants.TESTDATAS);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
try
{
workbook = new XSSFWorkbook(finput);
}
catch (IOException e)
{
e.printStackTrace();
}
sheet= workbook.getSheet(sheetname);
data = new Object[sheet.getLastRowNum()][sheet.getRow(0).getLastCellNum()];
for(int i=0; i<sheet.getLastRowNum(); i++)
{
for(int j=0; j<sheet.getRow(0).getLastCellNum(); j++)
{
data[i][j] = sheet.getRow(i+1).getCell(j).toString();
}
}
return data;
}
}
| [
"alfin.anthonyraj@atmecs.com"
] | alfin.anthonyraj@atmecs.com |
88c4de8f2b71f391fa2dc7a2a30149378d102f38 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/a9fc276a3ec849bb94fbe22e4039c4c3128ccef4/before/CustomBoostFactorQueryParser.java | 4fc5714f5f65c651797e4866ba541fbb0de61141 | [] | 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 | 3,275 | java | /*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.index.query.xcontent;
import org.apache.lucene.search.Query;
import org.elasticsearch.index.AbstractIndexComponent;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.query.QueryParsingException;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.util.Strings;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.lucene.search.CustomBoostFactorQuery;
import org.elasticsearch.util.settings.Settings;
import org.elasticsearch.util.xcontent.XContentParser;
import java.io.IOException;
/**
* @author kimchy (shay.banon)
*/
public class CustomBoostFactorQueryParser extends AbstractIndexComponent implements XContentQueryParser {
public static final String NAME = "custom_boost_factor";
@Inject public CustomBoostFactorQueryParser(Index index, @IndexSettings Settings settings) {
super(index, settings);
}
@Override public String[] names() {
return new String[]{NAME, Strings.toCamelCase(NAME)};
}
@Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = null;
float boost = 1.0f;
float boostFactor = 1.0f;
String currentFieldName = null;
XContentParser.Token token;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_OBJECT) {
if ("query".equals(currentFieldName)) {
query = parseContext.parseInnerQuery();
}
} else if (token.isValue()) {
if ("boost_factor".equals(currentFieldName) || "boostFactor".equals(currentFieldName)) {
boostFactor = parser.floatValue();
} else if ("boost".equals(currentFieldName)) {
boost = parser.floatValue();
}
}
}
if (query == null) {
throw new QueryParsingException(index, "[constant_factor_query] requires 'query' element");
}
CustomBoostFactorQuery customBoostFactorQuery = new CustomBoostFactorQuery(query, boostFactor);
customBoostFactorQuery.setBoost(boost);
return customBoostFactorQuery;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
2646c7cc7bcc86c73ed454832552bba76a787cd9 | d081449dbd6c8cf72a8ddd0798473382c0226211 | /src/main/java/com/toolkit2/client/frame/free/FreeRootMenu.java | d219fb1096f2df50348984109c217634ff585585 | [] | no_license | songworld/sec4j-toolkit | be2f320b24f29d4f86ad3b8a77298c4e1c7df443 | 32dd1049e717b6039f3d9ec428c8d8801b25c9f0 | refs/heads/master | 2023-04-29T14:18:39.727818 | 2014-10-31T18:16:03 | 2014-10-31T18:16:03 | 26,025,900 | 0 | 1 | null | 2023-04-17T05:22:16 | 2014-10-31T17:24:19 | Java | UTF-8 | Java | false | false | 1,231 | java | package com.toolkit2.client.frame.free;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.TexturePaint;
import javax.swing.BorderFactory;
import javax.swing.JMenu;
import javax.swing.border.Border;
public class FreeRootMenu extends JMenu
{
private Color foregroundColor = FreeUtil.DEFAULT_TEXT_COLOR;
private String selectedBackgroundImageURL = FreeUtil.getImageURL("menubar_background_selected.png");
private TexturePaint paint = FreeUtil.createTexturePaint(this.selectedBackgroundImageURL);
private Border border = BorderFactory.createEmptyBorder(0, 5, 0, 4);
public FreeRootMenu() {
init();
}
public FreeRootMenu(String text) {
super(text);
init();
}
private void init() {
setFont(FreeUtil.FONT_14_BOLD);
setBorder(this.border);
setForeground(this.foregroundColor);
}
protected void paintComponent(Graphics g)
{
if (isSelected()) {
Graphics2D g2d = (Graphics2D)g;
g2d.setPaint(this.paint);
g2d.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(g);
} else {
super.paintComponent(g);
}
}
}
| [
"songworld@gmail.com"
] | songworld@gmail.com |
1e36b4995c57d9854b622c79c26998e03e7e45b7 | 6c273830a1c0a974a3acc6e1021f67af0adc8886 | /PopularMoviesApp/app/src/main/java/com/example/android/popularmoviesapp/sync/VideoAdapter.java | 661ebaa2a8a5fc9d13e4e9550ddc30a25f19a06a | [] | no_license | jomeno/PopularMoviesApp | c18ed7646bb14368a8afaa7730632c5d086bfa99 | 14312261e3d716fe7c27b2d82429f7710ba38841 | refs/heads/master | 2020-06-04T09:00:27.204837 | 2015-09-12T19:03:34 | 2015-09-12T19:03:34 | 38,914,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,931 | java | package com.example.android.popularmoviesapp.sync;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;
import com.example.android.popularmoviesapp.R;
import com.example.android.popularmoviesapp.data.contract.VideosContract;
import com.example.android.popularmoviesapp.model.MovieAsset;
/**
* Created by Jomeno on 9/8/2015.
*/
public class VideoAdapter extends CursorAdapter {
private static final int VIEW_TYPE_COUNT = 3;
private static final int VIEW_TYPE_SECTION_HEADER = 0;
private static final int VIEW_TYPE_TRAILER_ITEM = 1;
private static final int VIEW_TYPE_REVIEW_ITEM = 2;
MovieAsset movieAsset;
private int cursorViewType = 0;
public VideoAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
}
/*@Override
public int getViewTypeCount() {
return VIEW_TYPE_COUNT;
}*/
/*@Override
public int getItemViewType(int position) {
switch (movieAsset.VIEW_TYPE) {
case VIEW_TYPE_TRAILER_ITEM:
return VIEW_TYPE_TRAILER_ITEM;
case VIEW_TYPE_REVIEW_ITEM:
return VIEW_TYPE_REVIEW_ITEM;
default:
return VIEW_TYPE_SECTION_HEADER;
}
}*/
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
//movieAsset = ((MovieAsset)cursor);
/*int viewType = cursor.getInt(cursor.getColumnIndex("VIEW_TYPE"));//getItemViewType(cursor.getPosition());
int layout = -1;
switch(viewType){
case VIEW_TYPE_SECTION_HEADER:
layout = R.layout.item_movie_detail_section_header;
break;
case VIEW_TYPE_TRAILER_ITEM:
layout = R.layout.item_movie_detail_trailer;
break;
case VIEW_TYPE_REVIEW_ITEM:
layout = R.layout.item_movie_detail_review;
break;
}*/
//LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View view = LayoutInflater.from(context).inflate(R.layout.item_movie_detail_trailer, parent, false);
ViewHolder viewHolder = new ViewHolder(view);
view.setTag(viewHolder);
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
ViewHolder viewHolder = (ViewHolder) view.getTag();
viewHolder.itemTextView.setText(cursor.getString(cursor.getColumnIndex(VideosContract.Columns.NAME)));
}
public static class ViewHolder {
public final TextView itemTextView;
public ViewHolder(View view) {
itemTextView = (TextView) view.findViewById(R.id.item_section_text);
}
}
}
| [
"jomeno.vona@gmail.com"
] | jomeno.vona@gmail.com |
95e6ea9f99dbf84415bf4d14b00d81627b2feacf | 5c7d8b229d21ee9b9e6284f1eab04e1c6b0bf0c6 | /code/backend/tester/src/main/java/it/polito/thermostat/tester/configuration/CustomDateDeserializer.java | 5ab836c0ca724146189ed1fcabf35f3acb80a028 | [] | no_license | unupingu/Thermostat | 15aa1246c33a4abb7c3bd756a8e5da77b4640896 | e02bc78509ab2a0d9b1b086546e76b497a88b55f | refs/heads/master | 2021-02-14T05:39:16.019508 | 2020-02-04T12:22:22 | 2020-02-04T12:22:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package it.polito.thermostat.tester.configuration;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
public class CustomDateDeserializer extends StdDeserializer<LocalTime> {
private String pattern = "HH:mm";
private DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
public CustomDateDeserializer() {
this(null);
}
@Override
public LocalTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
String time = jsonParser.getText();
if (time.length() > 5)
time.substring(0,time.length() - 3);
return LocalTime.parse(time, dateTimeFormatter);
}
public CustomDateDeserializer(Class<?> vc) {
super(vc);
}
} | [
"florian.marco@live.com"
] | florian.marco@live.com |
c5354d1db82f30db5f02ecd934e194d8d4a7343f | f96c9ef7368303f713cdca59e73d8e2886cd7025 | /src/java/Modelos/Conexion.java | df1af6117cd729d8890156fb8e4a3815fd47a055 | [] | no_license | josecarlo123/Proyectoweb | c7c9c7998b3b2bb2e0dbadf734ecce9188e5b70c | f251966cb82fc7156c19243615c495a69c4ed4ac | refs/heads/main | 2022-12-29T23:12:22.203265 | 2020-10-19T04:04:12 | 2020-10-19T04:04:12 | 300,123,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,626 | 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 Modelos;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
*
* @author paiz2
*/
public class Conexion {
public Connection conexionBD;
//jdbc:mysql://localhost:3306/db_empresa
private final String puerto= "3306";
private final String bd= "dbempresa";
private final String urlConexion = String.format("jdbc:mysql://localhost:%s/%s?serverTimezone=UTC",puerto, bd);
private final String usuario = "user_dbempresa";
private final String contra = "Nomerecuerdo12@";
private final String jdbc ="com.mysql.cj.jdbc.Driver";
public void abrir_conexion(){
try{
Class.forName(jdbc);
conexionBD = DriverManager.getConnection(urlConexion,usuario,contra);
// System.out.println("Conexion Exitosa");
}catch(ClassNotFoundException | SQLException ex){
System.out.println("Error: " + ex.getMessage());
}
}
public void cerrar_conexion(){
try{
conexionBD.close();
}catch(SQLException ex){
System.out.println("Error: " + ex.getMessage());
}
}
PreparedStatement prepareStatement(String insert) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"jose.carlos.j3c45.jc@gmail.com"
] | jose.carlos.j3c45.jc@gmail.com |
13d1db0c3357f0fdcff481cdc05188b03221c2c4 | 0bae9d1c8e4b079721e9cbbf44f87ea93abb113d | /src/main/java/lol/cicco/ioc/core/module/binder/BinderPropertyChangeListener.java | 77d75200baa0451a9fe298db9c8e58f628a73426 | [] | no_license | CodingZx/cicco-ioc | 5afdf5d168c284273ff00f55710d2778c7075a4a | 7ef4e2becfd1c3b13acd4cbb1dc546d29be599e3 | refs/heads/master | 2022-01-26T22:00:19.973680 | 2020-05-11T14:03:08 | 2020-05-11T14:03:08 | 249,131,020 | 5 | 1 | null | 2022-01-21T23:41:17 | 2020-03-22T07:04:37 | Java | UTF-8 | Java | false | false | 2,352 | java | package lol.cicco.ioc.core.module.binder;
import lol.cicco.ioc.core.module.property.PropertyChangeListener;
import lol.cicco.ioc.core.module.property.PropertyRegistry;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
@Slf4j
class BinderPropertyChangeListener implements PropertyChangeListener {
private final boolean noValueToNull;
private final Class<?> fieldType;
private final Field field;
private final String listenerPropertyName;
private final String defaultValue;
private final String listenerSign;
@Getter
private final WeakReference<Object> binderReference;
private final PropertyRegistry registry;
BinderPropertyChangeListener(boolean noValueToNull, Object target, Field field, String propertyName, String defValue, PropertyRegistry registry) {
this.noValueToNull = noValueToNull;
this.fieldType = field.getType();
this.field = field;
this.listenerPropertyName = propertyName;
this.listenerSign = propertyName + "-" + target.toString();
this.binderReference = new WeakReference<>(target);
this.defaultValue = defValue;
this.registry = registry;
}
@Override
public String propertyName() {
return listenerPropertyName;
}
@Override
public String listenerSign() {
return listenerSign;
}
@Override
public void onChange() {
Object object = binderReference.get();
if (object == null) {
// 对象已经被垃圾回收.. 移除属性监听器...
removeListener();
return;
}
if (!field.canAccess(object)) {
field.setAccessible(true);
}
Object propertyValue = registry.convertValue(listenerPropertyName, defaultValue, fieldType);
try {
if (propertyValue == null && !noValueToNull) {
log.warn("Property [{}] 属性值为Null", propertyName());
} else {
field.set(object, propertyValue);
}
} catch (Exception e) {
log.warn("RefreshProperty出现异常, 异常信息:{}", e.getMessage(), e);
}
}
public void removeListener() {
registry.removePropertyListener(propertyName(), listenerSign());
}
}
| [
"codingzx@outlook.com"
] | codingzx@outlook.com |
fdf8930bd0bdb8f488e93f24b422a892b7717cb0 | 70c40a81f6d81637c76661678cdf9ecce2ee15c5 | /Axel VERDU/schtime/src/schtime/Schtime.java | 513f492dd7cdfaa9c80deb421a110e06a696913b | [] | no_license | Soniiou/OPS100V_Class | 42a9f1385e0c4aabc9cd8904d20137abbecafdb9 | 2959784f02788cc5921d8317b93e58af8db777f2 | refs/heads/master | 2021-08-31T08:20:25.243043 | 2017-12-20T19:06:36 | 2017-12-20T19:06:36 | 110,668,909 | 0 | 0 | null | 2017-11-14T09:25:40 | 2017-11-14T09:25:40 | null | UTF-8 | Java | false | false | 17,997 | java | package schtime;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Schtime {
int select_process(int s[][], int ct, int q, int d)
{
int m = 2000;
int ind = -1;
for(int i = 0; i < d; i ++){
if(s[i][0]<= ct && s[i][2]!=0){
if(m>s[i][2]){
m = s[i][2];
ind = i;
}
}
}
return ind;
}
void STRN(int ind, int s[][], int ct, int q)
{
if(q>s[ind][2]){
s[ind][2]-=q;
ct+=q;
}
else{
ct+=s[ind][2];
s[ind][2]= 0;
}
if(s[ind][2] == 0){
s[i][3] = ct;
}
}
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int choice;
boolean b = true;
while (b)
{
System.out.println("\nChoose your scheduling algorithm ? \n\n1)FCFS (First come, First Served)\n2) SJF (Shortest Job First\n3)SRTF ()\n4)RR()\n");
choice = in.nextInt();
switch (choice)
{
case 1:
int a;
System.out.println("CPU Scheduling Algorithm - First Come First Served");
System.out.println("Enter the number of processes : ");
a = in.nextInt();
//int[]tab = new int[a];
int[]burstTimes = new int[a];
int[]arrivalTimes = new int[a];
int[] processes = new int[a];
int[] exitTimes = new int[a];
int[] TurnAroundTimes = new int[a];
int[] waitingTimes = new int[a];
//read Arrival times
for (int i = 0; i < a; i++){
System.out.print("Enter Process " + (i + 1) + "'s Arrival Time : ");
arrivalTimes[i] = in.nextInt();
processes[i] = i;
}
System.out.println();
//read burst times
for (int i = 0; i < a; i++){
System.out.print("Enter Process " + (i + 1) + "'s Burst Time : ");
burstTimes[i] = in.nextInt();
}
Arrays.sort(arrivalTimes);
// calculate exit times
exitTimes[0] = burstTimes[0];
for (int i = 1; i < a; i++){
exitTimes[i] = exitTimes[i - 1] + burstTimes[i];
}
//calculate turnaround times for each process
for (int i = 0; i < a; i++){
TurnAroundTimes[i]= exitTimes[i] - arrivalTimes[i];
}
//calculate waiting times for each process
for (int i = 0; i < a; i++){
waitingTimes[i]= TurnAroundTimes[i] - burstTimes[i];
}
// Displaying Arrival, Burst, Exit, TurnAround and Waiting times :
System.out.println("\nArrival Times:");
for (int i = 0; i < a; i++){
System.out.print(arrivalTimes[i] + " | ");
}
System.out.println("\nBurst Times:");
for (int i = 0; i < a; i++){
System.out.print(burstTimes[i] + " | ");
}
System.out.println("\nExit Times:");
for (int i = 0; i < a; i++){
System.out.print(exitTimes[i] + " | ");
}
System.out.println("\nTurnAround Times:");
for (int i = 0; i < a; i++) {
System.out.print(TurnAroundTimes[i] + " | ");
}
System.out.println("\nWaiting Times:");
for (int i = 0; i < a; i++){
System.out.print(waitingTimes[i] + " | ");
}
//Printing the average WT & TT
float wt = 0,tt = 0;
for(int i = 0; i < a; i++){
wt+= waitingTimes[i];
tt+= TurnAroundTimes[i];
}
wt /= a;
tt /= a;
System.out.println("The Average WT is: " + wt);
System.out.println("The Average TT is: " + tt);
break;
case 2:
System.out.println("You chose the SRF Process ! \n Enter the number of processes : ");
int c = in.nextInt();
int[]burstTimes1 = new int[c];
int[]arrivalTimes1 = new int[c];
int[] processes1 = new int[c];
int[] exitTimes1 = new int[c];
int[] TurnAroundTimes1 = new int[c];
int[] waitingTimes1 = new int[c];
//read Arrival times
for (int i = 0; i < c; i++){
System.out.print("Enter Process " + (i + 1) + "'s Arrival Time : ");
arrivalTimes1[i] = in.nextInt();
processes1[i] = i;
}
System.out.println();
//read burst times
for (int i = 0; i < c; i++){
System.out.print("Enter Process " + (i + 1) + "'s Burst Time : ");
burstTimes1[i] = in.nextInt();
}
//ExitTimes
for (int i = 0; i < c; i++){
for (int j = 0; j < c; j++)
if (arrivalTimes1[i] < arrivalTimes1[j])
{
// swap in arrival times
int tempAr = arrivalTimes1[i];
arrivalTimes1[i] = arrivalTimes1[j];
arrivalTimes1[j] = tempAr;
//swap in burst times too
int tempBr = burstTimes1[i];
burstTimes1[i] = burstTimes1[j];
burstTimes1[j] = tempBr;
}
}
for (int i = 1; i < c; i++){
for (int j = 1; j <c; j++)
if (burstTimes1[i] < burstTimes1[j])
{
// swap in arrival times
int tempAr = arrivalTimes1[i];
arrivalTimes1[i] = arrivalTimes1[j];
arrivalTimes1[j] = tempAr;
//swap in burst times too
int tempBr = burstTimes1[i];
burstTimes1[i] = burstTimes1[j];
burstTimes1[j] = tempBr;
}
}
//exit time
exitTimes1[0] = burstTimes1[0];
for(int i =1; i < c; i++){
exitTimes1[i] = exitTimes1[i-1] + burstTimes1[i];
}
//calculate turnaround times for each process
for (int i = 0; i < c; i++){
TurnAroundTimes1[i]= exitTimes1[i] - arrivalTimes1[i];
}
//calculate waiting times for each process
for (int i = 0; i < c; i++){
waitingTimes1[i]= TurnAroundTimes1[i] - burstTimes1[i];
if(waitingTimes1[i]<0) waitingTimes1[i] = 0;
}
System.out.println("\nArrival Times:");
for (int i = 0; i < c; i++){
System.out.print(arrivalTimes1[i] + " | ");
}
System.out.println("\nBurst Times:");
for (int i = 0; i < c; i++){
System.out.print(burstTimes1[i] + " | ");
}
System.out.println("\nExit times:");
for (int i = 0; i < c; i++){
System.out.print(exitTimes1[i]+ " | ");
}
System.out.println("\nTurnAround Times:");
for (int i = 0; i < c; i++) {
System.out.print(TurnAroundTimes1[i] + " | ");
}
System.out.println("\nWaiting Times:");
for (int i = 0; i < c; i++){
System.out.print(waitingTimes1[i] + " | ");
}
//Printing the average WT & TT
float wt2 = 0,tt2 = 0;
for(int i = 0; i < c; i++)
{
wt2 += waitingTimes1[i];
tt2 += TurnAroundTimes1[i];
}
wt2 /= c;
tt2 /= c;
System.out.println("The Average WT is: " + wt2);
System.out.println("The Average TT is: " + tt2 );
break;
case 3:
System.out.println("You chose the SRTF Process ! \n Enter the number of processes : ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n;
System.out.println("Please enter the number of Processes: ");
n = Integer.parseInt(br.readLine());
int proc[][] = new int[n + 1][4];//proc[][0] is the AT array,[][1] - RT,[][2] - WT,[][3] - TT
for(int i = 1; i <= n; i++)
{
System.out.println("Please enter the Arrival Time for Process " + i + ": ");
proc[i][0] = Integer.parseInt(br.readLine());
System.out.println("Please enter the Burst Time for Process " + i + ": ");
proc[i][1] = Integer.parseInt(br.readLine());
}
System.out.println();
//Calculation of Total Time and Initialization of Time Chart array
int total_time = 0;
for(int i = 1; i <= n; i++)
{
total_time += proc[i][1];
}
int time_chart[] = new int[total_time];
for(int i = 0; i < total_time; i++)
{
//Selection of shortest process which has arrived
int sel_proc = 0;
int min = 99999;
for(int j = 1; j <= n; j++)
{
if(proc[j][0] <= i)//Condition to check if Process has arrived
{
if(proc[j][1] < min && proc[j][1] != 0)
{
min = proc[j][1];
sel_proc = j;
}
}
}
//Assign selected process to current time in the Chart
time_chart[i] = sel_proc;
//Decrement Remaining Time of selected process by 1 since it has been assigned the CPU for 1 unit of time
proc[sel_proc][1]--;
//WT and TT Calculation
for(int j = 1; j <= n; j++)
{
if(proc[j][0] <= i)
{
if(proc[j][1] != 0)
{
proc[j][3]++;//If process has arrived and it has not already completed execution its TT is incremented by 1
if(j != sel_proc)//If the process has not been currently assigned the CPU and has arrived its WT is incremented by 1
proc[j][2]++;
}
else if(j == sel_proc)//This is a special case in which the process has been assigned CPU and has completed its execution
proc[j][3]++;
}
}
//Printing the Time Chart
if(i != 0)
{
if(sel_proc != time_chart[i - 1])
//If the CPU has been assigned to a different Process we need to print the current value of time and the name of
//the new Process
{
System.out.print("--" + i + "--P" + sel_proc);
}
}
else//If the current time is 0 i.e the printing has just started we need to print the name of the First selected Process
System.out.print(i + "--P" + sel_proc);
if(i == total_time - 1)//All the process names have been printed now we have to print the time at which execution ends
System.out.print("--" + (i + 1));
}
System.out.println();
System.out.println();
//Printing the WT and TT for each Process
System.out.println("P\t WT \t TT ");
for(int i = 1; i <= n; i++)
{
System.out.printf("%d\t%2dms\t%2dms",i,proc[i][2],proc[i][3]);
System.out.println();
}
System.out.println();
//Printing the average WT & TT
float WT = 0,TT = 0;
for(int i = 1; i <= n; i++)
{
WT += proc[i][2];
TT += proc[i][3];
}
WT /= n;
TT /= n;
System.out.println("The Average WT is: " + WT + "ms");
System.out.println("The Average TT is: " + TT + "ms");
break;
case 4 :
System.out.println("You chose the RR Process ! \n Enter the number of processes : ");
BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the Time Quantum: ");
int q = Integer.parseInt(br2.readLine());
System.out.println("Please enter the number of Processes: ");
int n2 = Integer.parseInt(br2.readLine());
int proc2[][] = new int[n2 + 1][4];//proc[][0] is the AT array,[][1] - RT,[][2] - WT,[][3] - TT
for(int i = 1; i <= n2; i++)
{
System.out.println("Please enter the Burst Time for Process " + i + ": ");
proc2[i][1] = Integer.parseInt(br2.readLine());
}
System.out.println();
//Calculation of Total Time and Initialization of Time Chart array
int total_time2 = 0;
for(int i = 1; i <= n2; i++)
{
total_time2 += proc2[i][1];
}
int time_chart2[] = new int[total_time2];
int sel_proc = 1;
int current_q = 0;
for(int i = 0; i < total_time2; i++)
{
//Assign selected process to current time in the Chart
time_chart2[i] = sel_proc;
//Decrement Remaining Time of selected process by 1 since it has been assigned the CPU for 1 unit of time
proc2[sel_proc][1]--;
//WT and TT Calculation
for(int j = 1; j <= n2; j++)
{
if(proc2[j][1] != 0)
{
proc2[j][3]++;//If process has not completed execution its TT is incremented by 1
if(j != sel_proc)//If the process has not been currently assigned the CPU its WT is incremented by 1
proc2[j][2]++;
}
else if(j == sel_proc)//This is a special case in which the process has been assigned CPU and has completed its execution
proc2[j][3]++;
}
//Printing the Time Chart
if(i != 0)
{
if(sel_proc != time_chart2[i - 1])
//If the CPU has been assigned to a different Process we need to print the current value of time and the name of
//the new Process
{
System.out.print("--" + i + "--P" + sel_proc);
}
}
else//If the current time is 0 i.e the printing has just started we need to print the name of the First selected Process
System.out.print(i + "--P" + sel_proc);
if(i == total_time2 - 1)//All the process names have been printed now we have to print the time at which execution ends
System.out.print("--" + (i + 1));
//Updating value of sel_proc for next iteration
current_q++;
if(current_q == q || proc2[sel_proc][1] == 0)//If Time slice has expired or the current process has completed execution
{
current_q = 0;
//This will select the next valid value for sel_proc
for(int j = 1; j <= n2; j++)
{
sel_proc++;
if(sel_proc == (n2 + 1))
sel_proc = 1;
if(proc2[sel_proc][1] != 0)
break;
}
}
}
System.out.println();
System.out.println();
//Printing the WT and TT for each Process
System.out.println("P\t WT \t TT ");
for(int i = 1; i <= n2; i++)
{
System.out.printf("%d\t%3dms\t%3dms",i,proc2[i][2],proc2[i][3]);
System.out.println();
}
System.out.println();
//Printing the average WT & TT
float WT2 = 0,TT2 = 0;
for(int i = 1; i <= n2; i++)
{
WT2 += proc2[i][2];
TT2 += proc2[i][3];
}
WT2 /= n2;
TT2 /= n2;
System.out.println("The Average WT is: " + WT2);
System.out.println("The Average TT is: " + TT2 );
break;
default:
System.out.println("Which Process Would You Run ?");
break;
}
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
ece9526d63856e0ac397cf1510c21ff5564a3128 | 847b4f1a7f66bac35f410ef3b3d27bea67cf5ae2 | /Isaev/4/com/niit/isaev/battleOfMage/spells/Healing.java | ec66f5a72b8ca76e5c8958ef6bcd817aad129964 | [] | no_license | npu4/niit_se_2020 | 33efcdab3473c961bc71eeae01b7e905da0f4a68 | 66b4a239d5951ce1ca618d91753d9fa447b47702 | refs/heads/master | 2022-12-25T13:08:52.099779 | 2020-10-07T19:39:41 | 2020-10-07T19:39:41 | 293,466,457 | 0 | 0 | null | 2020-09-07T08:23:51 | 2020-09-07T08:23:50 | null | UTF-8 | Java | false | false | 1,042 | java | package com.niit.isaev.battleOfMage.spells;
import com.niit.isaev.battleOfMage.characters.Character;
import java.util.List;
public class Healing extends Spell {
private final static int HEAL = 30;
public Healing() {
super("Исцеление");
}
@Override
public void cast(List<Character> allNotDead, Character executor, List<Character> allEnemies, List<Character> allNeighbour) {
if (executor.getHealth() == executor.getDEFAULT_HEALTH()) {
System.out.println("Здоровье персонажа " + executor.getName() + " полное.");
} else {
if (executor.getHealth() + HEAL > executor.getDEFAULT_HEALTH()) {
executor.setHealth(100);
} else {
executor.setHealth(executor.getHealth() + HEAL);
}
System.out.println("Персонаж - " + executor.getName() + " вылечился на " + HEAL + ". Теперь его здоровье равно:" + executor.getHealth());
}
}
}
| [
"Alexander.095.Isaev@gmail.com"
] | Alexander.095.Isaev@gmail.com |
f6da62c4ff226982acf3a1ec95d7e843247c1059 | f0d66b6ec77eca2ca7edba287aa7cc42389f13d0 | /IWtoASkyBlockConverter/src/pl/islandworld/entity/MyLocation.java | d47b75c78f9be5a9686fdea270ace4e20a025175 | [] | no_license | tastybento/blockconvert | 3d9598f116826c37c6b6c9cb7b0e089410ca029f | 0a787bda3da68d413e298d5e2aa4014ce111078e | refs/heads/master | 2021-01-01T19:10:18.748370 | 2014-11-02T22:34:49 | 2014-11-02T22:34:49 | 24,575,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,475 | java | package pl.islandworld.entity;
import java.io.Serializable;
import org.bukkit.Location;
import org.bukkit.util.NumberConversions;
public class MyLocation implements Serializable
{
private static final long serialVersionUID = 1L;
private double x;
private double y;
private double z;
private float pitch;
private float yaw;
public MyLocation(Location loc)
{
this(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
}
public MyLocation(final double x, final double y, final double z, final float yaw, final float pitch)
{
this.x = x;
this.y = y;
this.z = z;
this.pitch = pitch;
this.yaw = yaw;
}
public void setX(double x)
{
this.x = x;
}
public double getX()
{
return x;
}
public int getBlockX()
{
return locToBlock(x);
}
public void setY(double y)
{
this.y = y;
}
public double getY()
{
return y;
}
public int getBlockY()
{
return locToBlock(y);
}
public void setZ(double z)
{
this.z = z;
}
public double getZ()
{
return z;
}
public int getBlockZ()
{
return locToBlock(z);
}
public void setYaw(float yaw)
{
this.yaw = yaw;
}
public float getYaw()
{
return yaw;
}
public void setPitch(float pitch)
{
this.pitch = pitch;
}
public float getPitch()
{
return pitch;
}
public static int locToBlock(double loc)
{
return NumberConversions.floor(loc);
}
}
| [
"bengibbs@comcast.net"
] | bengibbs@comcast.net |
610dce41377c26b15b4334d164a62708c3d5582a | d0dbfbdde36f5372aa6682e9dedf2910b6d0b05c | /app/src/main/java/pe/gob/munihuacho/munimovil/model/Detalle.java | 8a9b81cfc0c7a817959b6d7f65716286c3cadcb6 | [] | no_license | SITE-ENTERPRICE/MuniMovil | 8b8a45203781d52b757b10e52188810ef88e9e85 | 9464bd54f7e69045a205ce4ac5136fe6d1a67854 | refs/heads/master | 2021-01-16T18:55:06.716572 | 2017-08-05T14:52:56 | 2017-08-05T14:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java | package pe.gob.munihuacho.munimovil.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
/**
* Created by alexisholyoak on 6/06/2017.
*/
public class Detalle implements Serializable{
private String id;
private String tributo;
private String trides;
private String aini;
private String peini;
private String periodo;
private Double insoluto;
private Double sobretasas;
private Double pagos;
private Double saldo;
private Integer secid;
public Detalle(){
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTributo() {
return tributo;
}
public void setTributo(String tributo) {
this.tributo = tributo;
}
public String getTrides() {
return trides;
}
public void setTrides(String trides) {
this.trides = trides;
}
public String getAini() {
return aini;
}
public void setAini(String aini) {
this.aini = aini;
}
public String getPeini() {
return peini;
}
public void setPeini(String peini) {
this.peini = peini;
}
public String getPeriodo() {
return periodo;
}
public void setPeriodo(String periodo) {
this.periodo = periodo;
}
public Double getInsoluto() {
return insoluto;
}
public void setInsoluto(Double insoluto) {
this.insoluto = insoluto;
}
public Double getSobretasas() {
return sobretasas;
}
public void setSobretasas(Double sobretasas) {
this.sobretasas = sobretasas;
}
public Double getPagos() {
return pagos;
}
public void setPagos(Double pagos) {
this.pagos = pagos;
}
public Double getSaldo() {
return saldo;
}
public void setSaldo(Double saldo) {
this.saldo = saldo;
}
public Integer getSecid() {
return secid;
}
public void setSecid(Integer secid) {
this.secid = secid;
}
}
| [
"peraltaholyoak.aj@gmail.com"
] | peraltaholyoak.aj@gmail.com |
0dd13e16e7416ee0e42f58fb7313186e0308b850 | 9488a1c92f86aaa8d04d8d72671fed0cb553d27c | /src/main/java/com/beans/ko/java/kafka/AVROProducer.java | cb08e06d6379ecdfcc4011d0344170441a24d241 | [] | no_license | LU-N/java-training | fd82a2e3eb51a44a30f68626daaf9cc4c91b9264 | 9a9bc7af0ac6301cad29a3dae8a5d2cd20ab3d35 | refs/heads/master | 2020-07-05T20:07:05.614981 | 2019-06-19T03:07:22 | 2019-06-19T03:07:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package com.beans.ko.java.kafka;
import java.util.Properties;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.generic.GenericRecordBuilder;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.ByteArraySerializer;
import org.apache.kafka.common.serialization.StringSerializer;
import com.beans.ko.java.kafka.util.JsonUtil;
import com.beans.ko.java.kafka.util.AvroUtil;
public class AVROProducer {
public static void main(String[] args) {
String bootstrapServer = "10.16.238.101:8092,10.16.238.102:8092";
String topicName = "test_avro";
Runnable r = new Runnable(){
@Override
public void run() {
AVROProducer avroProducer = new AVROProducer();
avroProducer.produceAVROMessage(topicName, bootstrapServer);
}};
new Thread(r).start();
}
/**
* 生产AVRO格式的数据
* @param topicName
* @param bootstrapServer
*/
public void produceAVROMessage(String topicName,String bootstrapServer){
Properties props = new Properties();
props.put("bootstrap.servers", bootstrapServer);
props.put("acks", "all");
props.put("retries", 0);
props.put("batch.size", 16384);
props.put("linger.ms", 1);
props.put("buffer.memory", 33554432);
props.put("key.serializer", StringSerializer.class);
props.put("value.serializer", ByteArraySerializer.class);
try(Producer<String, byte[]> producer = new KafkaProducer<String, byte[]>(props)){
GenericRecord genericRecord = new GenericRecordBuilder(AvroUtil.getSchema(KafKaConstant.AVRO_SCHEMA))
.set("date", System.currentTimeMillis()+"").set("message", JsonUtil.generationJsonMessage().toJSONString()).build();
ProducerRecord<String, byte[]> producerRecord = new ProducerRecord<String, byte[]>(topicName,
AvroUtil.serialize(genericRecord, AvroUtil.getSchema(KafKaConstant.AVRO_SCHEMA)));
producer.send(producerRecord);
}
}
}
| [
"fl76@newegg.com"
] | fl76@newegg.com |
6a92010371869321043d1becabc00c8791b3cdd1 | 4c313c2df430abc96186e7443c552554de6a2e4b | /src/main/java/org/vhmml/service/RemoteServiceUtil.java | e0883d49970acebbd2fbe7616f664f12dbee37a0 | [] | no_license | Williamstraub/vhmml | 1be8f5748087a356e250ed5d64e44b63a9681952 | 2d8721456680b37a59b58d1c9ca6fee64f794f38 | refs/heads/master | 2021-01-11T12:30:49.390505 | 2017-02-24T16:54:44 | 2017-02-24T16:54:44 | 76,292,036 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,026 | java | package org.vhmml.service;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.vhmml.service.ApplicationConfigService.Property;
@Component
public class RemoteServiceUtil {
private static final Logger LOG = Logger.getLogger(RemoteServiceUtil.class);
@Autowired
private ApplicationConfigService configService;
public HttpClient getHttpClient(boolean proxy) {
HttpClient httpClient = new HttpClient();
HttpClientParams params = httpClient.getParams();
params.setParameter(HttpMethodParams.USER_AGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36");
String activeProfile = System.getProperty("spring.profiles.active");
if(proxy && StringUtils.isNotEmpty(activeProfile) && !"local".equalsIgnoreCase(activeProfile)) {
String webServiceProxyServer = configService.getValue(Property.WEB_SERVICE_PROXY_SERVER);
Integer webServiceProxyPort = configService.getIntValue(Property.WEB_SERVICE_PROXY_PORT);
if(StringUtils.isNotEmpty(webServiceProxyServer) && webServiceProxyPort != null) {
httpClient.getHostConfiguration().setProxy(webServiceProxyServer, webServiceProxyPort);
}
}
return httpClient;
}
public String executeGet(String url, boolean proxyRequest) throws IOException {
return executeGet(url, null, proxyRequest);
}
public String executeGet(String url, Map<String, String> headers, boolean proxyRequest) throws IOException {
String responseString = null;
HttpClient httpClient = getHttpClient(proxyRequest);
GetMethod get = new GetMethod(url);
if(MapUtils.isNotEmpty(headers)) {
for(String header : headers.keySet()) {
get.setRequestHeader(header, headers.get(header));
}
}
try {
httpClient.executeMethod(get);
int responseCode = get.getStatusCode();
InputStream response = get.getResponseBodyAsStream();
LOG.info("response code from get request " + responseCode + ", content length = " + get.getResponseContentLength());
printHeaders(get);
if (responseCode != HttpStatus.SC_OK) {
String message = "Wrong response attempting to execute get at URL [" + url + "], expected " + HttpStatus.SC_OK + " but received " + responseCode;
LOG.error(message);
throw new RuntimeException(message);
} else {
BufferedInputStream inputStream = new BufferedInputStream(response);
responseString = IOUtils.toString(inputStream, "utf-8");
inputStream.close();
}
} finally {
get.releaseConnection();
}
return responseString;
}
public String executeGet(String host, String port, String url, boolean proxyRequest) throws IOException {
return executeGet("http://" + host + ":" + port + url, null, proxyRequest);
}
public byte[] executeGetImage(String host, String port, String url) throws IOException {
byte[] imageBytes = null;
// we don't proxy image requests because they're on the same domain
HttpClient httpClient = getHttpClient(false);
String imageUrl = "http://" + host + ":" + port + "/" + url;
LOG.info("retriving image from image server at url " + imageUrl);
GetMethod get = new GetMethod(imageUrl);
try {
httpClient.executeMethod(get);
int responseCode = get.getStatusCode();
imageBytes = get.getResponseBody();
LOG.info("response code from get image request " + responseCode + ", content length = " + get.getResponseContentLength());
printHeaders(get);
if (responseCode != HttpStatus.SC_OK) {
String message = "Wrong response attempting to retrieve image from image server at URL [" + imageUrl + "], expected " + HttpStatus.SC_OK + " but received " + responseCode;
LOG.warn(message);
throw new RuntimeException(message);
}
} finally {
get.releaseConnection();
}
return imageBytes;
}
public HttpClient getHttpClient() {
return getHttpClient(true);
}
public void printHeaders(HttpMethodBase requestMethod) {
printHeaders("=== REQUEST HEADERS ===", requestMethod.getRequestHeaders());
printHeaders("=== RESPONSE HEADERS ===", requestMethod.getResponseHeaders());
}
private void printHeaders(String label, Header[] headers) {
LOG.info(label);
for(Header header : headers) {
LOG.info(header.getName() + " = " + header.getValue());
}
}
}
| [
"herman_schmigitz@yahoo.com"
] | herman_schmigitz@yahoo.com |
54ee40cf3c1faf07ccfcf0b774f7a1107ba48b29 | 0e10a750bb02c8ac265d6775416ca6220f06943e | /src/main/java/com/maxkucher/treezproblem/exceptions/NotSufficientItemsException.java | 16452e6b26c4d191cbafb77556c4418dc77b8881 | [] | no_license | maxkucher/orders-api | c840735a01222e452e14d170540d2d22a68ea522 | c338d5d2acaafdc67e71f2b700107cb8629a4060 | refs/heads/master | 2020-12-27T11:04:18.780423 | 2020-02-03T03:48:36 | 2020-02-03T03:48:36 | 237,879,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.maxkucher.treezproblem.exceptions;
import org.springframework.http.HttpStatus;
public class NotSufficientItemsException extends TreezProblemException {
private static final String MESSAGE = "Not sufficient items: %d";
public NotSufficientItemsException(long id) {
super(String.format(MESSAGE, id), HttpStatus.BAD_REQUEST);
}
}
| [
"the.stewk@gmail.com"
] | the.stewk@gmail.com |
1e3ec98745497036c463cd0f88097ca3b2de415d | 2be34d47600854fd13b003bca430c97feaa340a8 | /big-data/hadoop/hadoop-demo/src/main/java/com/zql/demo/max/MaxDriver.java | 716792ba1d0e8ff4802f047fafd80c69711e9833 | [] | no_license | zuql/demo | 1a99b58bb86cd8c4b6ec72d84644cb02bbaf1ac5 | c06ad8cb8647609b790eaf31af66accd6efdf11b | refs/heads/master | 2020-05-05T09:58:10.567402 | 2019-05-21T15:25:10 | 2019-05-21T15:25:10 | 179,924,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.zql.demo.max;
import com.zql.util.StaticResource;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class MaxDriver {
public static void main(String[] args) throws Exception {
Configuration conf=new Configuration();
Job job= Job.getInstance(conf);
job.setJarByClass(MaxDriver.class);
job.setMapperClass(MaxMapper.class);
job.setReducerClass(MaxReducer.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.setInputPaths(job,
new Path("hdfs://"+ StaticResource.getIp()+":9000/max"));
FileOutputFormat.setOutputPath(job,
new Path("hdfs://"+ StaticResource.getIp()+":9000/max/result"));
job.waitForCompletion(true);
}
}
| [
"17712743419@163.com"
] | 17712743419@163.com |
d1946a7a4db8a80c142632c3578c1d9a38fa3652 | ad3995b81f868a32f37633126e85950a5c78ecde | /src/main/java/com/cheny/web/bean/Container.java | a64f6e99be0012a5a25c055b617c4f28ad9b6bc6 | [] | no_license | cr6588/test | 137fb68787c7ec57072a571cb63b58a404cc7dee | 67c4834773309b6bebb5b83bc242e1d26475c0e4 | refs/heads/master | 2022-07-13T22:51:24.298274 | 2022-07-12T13:33:56 | 2022-07-12T13:33:56 | 41,086,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.cheny.web.bean;
public class Container {
private String no;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
}
| [
"cr6588@vip.qq.com"
] | cr6588@vip.qq.com |
287b0144ff6ebf3c5e051e7d006b06ebe90a69dd | db43379ba52ba48a39d260c532acfb5aa7aabb13 | /app/src/main/java/net/rmj/android/controlsdinamic/network/RequestReadSimpleQuake.java | aeb8774e33f3b666344fbd3e41e61888733108f9 | [] | no_license | rmjohn08/ControlsDynamic | 21c6ab154d1d2a5fa0db33c603f9b9e01ee77059 | 6b009729d2271a8cabf2bf2866580ae25d59eef3 | refs/heads/master | 2021-04-26T16:49:27.728428 | 2014-12-15T14:44:32 | 2014-12-15T14:44:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,440 | java | package net.rmj.android.controlsdinamic.network;
import android.util.Log;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonObjectRequest;
import net.rmj.android.controlsdinamic.MainApplication;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by Ronaldo on 9/8/2014.
*/
public class RequestReadSimpleQuake {
public final String URL = "http://comcat.cr.usgs.gov/fdsnws/event/1/query?starttime=_startdate&minmagnitude=4.5&format=geojson";
public static final String DETAIL_URL = "http://comcat.cr.usgs.gov/earthquakes/eventpage";
private JSONArray features=null;
private List<String> quakes;
private SimpleDateFormat startdateFormat; //2014-09-10
private String timePart = "T0:00:00";
public JsonObjectRequest makeReadSimpleQuake(final QuakesHandler handler)
{
startdateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date today = new Date();
String startDate = startdateFormat.format(today)+timePart;
String u = URL;
u = u.replace("_startdate",startDate);
String url = u;
return new JsonObjectRequest(url,null,
new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response) {
try {
MainApplication.getInstance().hideSpinner();
VolleyLog.v("Response got from: %s",URL);
features = response.getJSONArray("features");
if (features !=null)
Log.i("SimpleQuakeResponse","Features count :: "+ features.length());
quakes = new ArrayList<String>();
for(int i = 0; i<features.length(); i++)
{
try {
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:SS");
JSONObject jsonObject = features.getJSONObject(i);
JSONObject properties = jsonObject.getJSONObject("properties");
Date time = new Date(properties.getLong("time"));
String eventId = jsonObject.getString("id");
String detail = "Magnitude:"+properties.getString("mag") + " Title: " + properties.getString("title") + " " + df.format(time) +
" Event:" + eventId;
Log.i("SimpleQuakeResponse",detail);
quakes.add(detail);
} catch (Exception ee){
Log.i("SimpleQuakeResponse","Couldn't parse the time");
}
}
handler.handleQuakes(quakes);
} catch(JSONException ex) {
ex.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("Error ", error.getMessage());
}
});
}
}
| [
"rjohnson@clientresourcesinc.com"
] | rjohnson@clientresourcesinc.com |
eac55221e2c261200b3df67a40d64859de44267d | 66c2125beafaac2c76969ace233c20cd59b59297 | /kMeans/src/KMeans.java | ab3648936d581be6dc977f9e5f885a690c0939ea | [] | no_license | pavanprakash-g/MachineLearning | 5ccceab543f2a007cb2ec2631ca7279406fa5dbc | 0b7abec39d720da383da170a54f66b9ab865ce04 | refs/heads/master | 2021-01-23T03:53:04.057640 | 2017-04-18T21:02:41 | 2017-04-18T21:02:41 | 86,129,710 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,046 | java | import java.io.*;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by pavan on 4/14/17.
*/
public class KMeans {
private ArrayList<Clusters> clustersList = new ArrayList<>();
private ArrayList<Data> dataList = new ArrayList<>();
public void getData(String fileName) throws Exception{
String line="";
BufferedReader br = new BufferedReader(new FileReader(fileName));
while ((line = br.readLine()) != null) {
String[] values = line.split("\t");
if("id".equals(values[0])){
continue;
}else {
Data data = new Data();
data.id = Integer.parseInt(values[0]);
data.x = Float.parseFloat(values[1]);
data.y = Float.parseFloat(values[2]);
dataList.add(data);
}
}
br.close();
}
public float generateRandomValue(){
float minX = 0.0f;
float maxX = 1.0f;
Random rand = new Random();
//return rand.nextFloat() * (maxX - minX) + minX;
return 0;
}
public void generateRandomCenters(int k){
while (k>0){
Data data = new Data();
Clusters cluster = new Clusters();
data.x = generateRandomValue();
data.y = generateRandomValue();
cluster.center = data;
cluster.id = k;
clustersList.add(cluster);
k--;
}
}
private float findDistance(Data point1, Data point2){
return (float)Math.sqrt(Math.pow(point1.x-point2.x,2)+Math.pow(point1.y-point2.y,2));
}
private void assignmentStep(){
float distance;
float minDistance = 100;
Clusters finalCluster = new Clusters();
for(Clusters cluster : clustersList){
cluster.clusterData.clear();
}
for(Data data : dataList){
for(Clusters cluster : clustersList){
distance = findDistance(data,cluster.center);
if(distance < minDistance){
minDistance = distance;
finalCluster = cluster;
}
}
finalCluster.clusterData.add(data);
minDistance = 100;
}
}
private boolean updateStep(){
float sumX;
float sumY;
float newX;
float newY;
boolean centersChanged = false;
for(Clusters cluster : clustersList){
sumX = 0;
sumY = 0;
newX = 0;
newY = 0;
for(Data data : cluster.clusterData){
sumX += data.x;
sumY += data.y;
}
if(cluster.clusterData.size() > 0) {
newX = sumX /cluster.clusterData.size();
newY = sumY / cluster.clusterData.size();
}
if(cluster.center.x != newX || cluster.center.y != newY) {
cluster.center.x = sumX / cluster.clusterData.size();
cluster.center.y = sumY / cluster.clusterData.size();
if(!centersChanged){
centersChanged = true;
}
}
}
return centersChanged;
}
public void applyKMeans(){
boolean centersChanged = true;
while (centersChanged){
assignmentStep();
centersChanged = updateStep();
}
}
public float calculateSSE(){
float totalSSE = 0;
float clusterSSE;
for(Clusters clusters : clustersList){
clusterSSE = 0;
for(Data data : clusters.clusterData){
clusterSSE += Math.pow(findDistance(data,clusters.center),2);
}
totalSSE+=clusterSSE;
}
return totalSSE;
}
public void writeOutput(String outputPath, float SSE){
BufferedWriter bw = null;
FileWriter fw = null;
try {
String content = "ClusterId \tId of the Point \n";
content +="-------------------------------------------------------------\n";
fw = new FileWriter(outputPath);
bw = new BufferedWriter(fw);
for(Clusters cluster : clustersList){
content += cluster.id+"\t\t";
for(Data data : cluster.clusterData){
content += data.id+",";
}
content = content.substring(0,content.lastIndexOf(",")) + "\n\n";
}
content +="\n-------------------------------------------------------------\n";
content += "SSE = "+SSE;
bw.write(content);
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
| [
"pavanprakash94@gmail.com"
] | pavanprakash94@gmail.com |
7d88ee7fe0fc2cbac572a67bb46ec2f07aa07edb | 9092916820f550c4b3a7f87bcb1d7ab8add33424 | /app/src/main/java/com/example/mm/gdgcairo/MainActivity.java | 1bf779b68faa6eb795d5bcaa420c77a11c58f8b4 | [] | no_license | ledia8/GDG_Cairo | 1d057470ca5c7562d8f2ed1ae84bc065a6ccf143 | ea65f3a72f079fbab889bc377e192c68462340b9 | refs/heads/master | 2020-03-26T14:10:35.919614 | 2018-08-16T11:00:30 | 2018-08-16T11:00:30 | 144,975,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,649 | java | package com.example.mm.gdgcairo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.text.NumberFormat;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button subOrder;
private EditText EdT_Name;
private TextView TV_numOfOrder;
private TextView TV_Price;
private CheckBox chB1;
private CheckBox chB2;
private int order = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
subOrder = (Button)findViewById(R.id.But_order);
EdT_Name = (EditText) findViewById(R.id.ET_name);
TV_numOfOrder = (TextView) findViewById(R.id.TV_num);
TV_Price = (TextView) findViewById(R.id.TV_Price);
chB1 = (CheckBox) findViewById(R.id.CB_Whipped);
chB2 = (CheckBox) findViewById(R.id.CB_Choocolate);
chB1.setOnClickListener((View.OnClickListener) this);
chB2.setOnClickListener((View.OnClickListener) this);
}
@Override
public void onClick(View view) {
reCal(view);
}
public void increase(View view){
order = Integer.parseInt(TV_numOfOrder.getText().toString());
order +=1;
TV_numOfOrder.setText("" + order);
calPrice(view);
}
public void decrease (View view){
order = Integer.parseInt(TV_numOfOrder.getText().toString());
if(order > 0) {
order -= 1;
}
else{
Toast.makeText(this,"IT is the minimum number of order!",Toast.LENGTH_LONG).show();
}
TV_numOfOrder.setText("" + order);
calPrice(view);
}
public void calPrice(View view){
int price = 10;
int custPrice = order * price;
boolean cb1 = chB1.isChecked();
boolean cb2 = chB2.isChecked();
if(cb1){
custPrice += 2;
}
if(cb2){
custPrice += 1;
}
TV_Price.setText("$ " + custPrice);
}
public void reCal(View view){
switch (view.getId()) {
case R.id.CB_Choocolate:
case R.id.CB_Whipped:
calPrice(view);
break;
}
}
public void submitOrder(View view){
calPrice(view);
String text = "Successfully :)" + EdT_Name.getText();
Toast.makeText(this,text,Toast.LENGTH_LONG).show();
}
}
| [
"32582491+ledia8@users.noreply.github.com"
] | 32582491+ledia8@users.noreply.github.com |
a1b101e2e1747c89399ce4249b091a7e55157035 | 973dc27c56926f1345622a1867a1a6cd93d79b84 | /LUT/Rl_check_q_terminal.java | 42b78a076e5943bd5e2a52df74a992ef13874fc2 | [] | no_license | kevinbdsouza/Reinforcement-Learning-with-NN | c6ad69180bb0fd0e58e7d966a67541cf3d702afb | f60f32d60f95eedd72c710816faf951998dab3bd | refs/heads/master | 2021-05-06T21:29:04.893673 | 2017-11-30T18:55:21 | 2017-11-30T18:55:21 | 112,581,250 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,447 | java | package sample.Kevin.Try2.LUT; //change it into your package name
import static robocode.util.Utils.normalRelativeAngleDegrees;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import com.sun.javafx.geom.Point2D;
import robocode.AdvancedRobot;
import robocode.BattleEndedEvent;
import robocode.BulletHitEvent;
import robocode.DeathEvent;
import robocode.HitByBulletEvent;
import robocode.HitRobotEvent;
import robocode.HitWallEvent;
import robocode.RobocodeFileOutputStream;
import robocode.RoundEndedEvent;
import robocode.ScannedRobotEvent;
import robocode.WinEvent;
import java.util.ArrayList;
import java.util.Random;
@SuppressWarnings("unused")
public class Rl_check_q_terminal extends AdvancedRobot {
// declare variables
final double alpha = 0.1;
final double gamma = 0.9;
final double epsilon = 0;
//LUT table initialization
int[] action=new int[4];
int[] total_states_actions=new int[8*6*4*4*action.length];
int[] total_actions=new int[4];
String[][] LUT=new String[total_states_actions.length][2];
String[][] CUM=new String[10][2];
double[][] LUT_double=new double[total_states_actions.length][2];
//standard robocode parameters
double absbearing=0;
double distance=0;
double gunTurnAmt;
double bearing;
int rlaction;
private double getVelocity;
private double getBearing;
//quantized parameters
int qrl_x=0;
int qrl_y=0;
int qenemy_x=0;
int qenemy_y=0;
int qdistancetoenemy=0;
int q_absbearing=0;
//initialize reward related variables
double reward=0;
String state_action_combi=null;
int sa_combi_inLUT=0;
String q_present=null;
double q_present_double=0;
int random_action=0;
int chosenAction = 0;
String state_action_combi_next=null;
int sa_combi_inLUT_next=0;
String q_next=null;
double q_next_double=0;
int Qmax_action=0;
int[] actions_indices=new int[total_actions.length];
double[] q_possible=new double[total_actions.length];
//counting variables
int count = 0;
int count_battles;
int winsCount = 0;
static int [] winsRate = new int[10000];
public void run(){
if(getRoundNum() == 0){
//initialize LUT
/*initialiseLUT();
save();*/
try {
load();
}
catch (IOException e) {
e.printStackTrace();
}
save();
}
count+=1;
try {
load();
}
catch (IOException e) {
e.printStackTrace();
}
//set colour
setColors(null, new Color(200,0,192), new Color(0,192,192), Color.black, new Color(0, 0, 0));
setBodyColor(new java.awt.Color(192,100,100,100));
while(true){
Random rand = new Random();
double epsilonCheck = rand.nextDouble();
//save();
try {
load();
}
catch (IOException e) {
e.printStackTrace();
}
//predict current state:
turnGunRight(360);
if (epsilonCheck <= epsilon) {
random_action=randInt(1,total_actions.length);
state_action_combi=qrl_x+""+qrl_y+""+qdistancetoenemy+""+q_absbearing+""+random_action;
}
else if (epsilonCheck > epsilon) {
state_action_combi = Qpolicy();
} // back outside
/*--------------common code--------------*/
for(int i=0;i<LUT.length;i++){
if(LUT[i][0].equals(state_action_combi))
{
sa_combi_inLUT=i;
break;
}
}
q_present = LUT[sa_combi_inLUT][1];
q_present_double=Double.parseDouble(q_present);
reward=0;
/*---------common code ends------------*/
if (epsilonCheck <= epsilon) {
rl_action(random_action);
chosenAction = random_action;
}
else if (epsilonCheck > epsilon) {
rl_action(Qmax_action);
chosenAction = Qmax_action;
}
/*----------------common code----------------*/
turnGunRight(360);
//state_action_combi_next =qrl_x+""+qrl_y+""+qdistancetoenemy+""+q_absbearing+""+chosenAction;
state_action_combi_next = Qpolicy();
for(int i=0;i<LUT.length;i++){
if(LUT[i][0].equals(state_action_combi_next))
{
sa_combi_inLUT_next=i;
break;
}
}
q_next = LUT[sa_combi_inLUT_next][1];
q_next_double=Double.parseDouble(q_next);
//performing update
q_present_double=q_present_double+alpha*(reward+gamma*q_next_double-q_present_double);
//System.out.println(sa_combi_inLUT);
//System.out.println(q_present_double);
LUT[sa_combi_inLUT][1]=Double.toString(q_present_double);
save();
}//while loop ends
}//run function ends
public String Qpolicy()
{
// finding action that produces maximum Q value
for(int j=1;j<=total_actions.length;j++)
{
state_action_combi=qrl_x+""+qrl_y+""+qdistancetoenemy+""+q_absbearing+""+j;
for(int i=0;i<LUT.length;i++){
if(LUT[i][0].equals(state_action_combi))
{
actions_indices[j-1]=i;
break;
}
}
}
//converting table to double
for(int i=0;i<total_states_actions.length;i++){
for(int j=0;j<2;j++){
LUT_double[i][j]= Double.valueOf(LUT[i][j]).doubleValue();
}
}
//converting table to double
for(int k=0;k<total_actions.length;k++){
q_possible[k]=LUT_double[actions_indices[k]][1];
}
//finding action that produces maximum q
Qmax_action=getMax(q_possible)+1;
state_action_combi=qrl_x+""+qrl_y+""+qdistancetoenemy+""+q_absbearing+""+Qmax_action;
return state_action_combi;
}
//function definitions for RL robot:
public void onScannedRobot(ScannedRobotEvent e)
{
double getVelocity=e.getVelocity();
this.getVelocity=getVelocity;
double getBearing=e.getBearing();
this.getBearing=getBearing;
this.gunTurnAmt = normalRelativeAngleDegrees(e.getBearing() + getHeading() - getGunHeading() -15);
//distance to enemy
distance = e.getDistance(); //distance to the enemy
qdistancetoenemy=quantize_distance(distance); //distance to enemy state number 3
//fire
if(qdistancetoenemy==1){fire(3);}
if(qdistancetoenemy==2){fire(2);}
if(qdistancetoenemy==3){fire(1);}
//your robot
qrl_x=quantize_position(getX()); //your x position -state number 1
qrl_y=quantize_position(getY()); //your y position -state number 2
//Calculate the coordinates of the robot
double angleToEnemy = e.getBearing();
double angle = Math.toRadians((getHeading() + angleToEnemy % 360));
double enemyX = (getX() + Math.sin(angle) * e.getDistance());
double enemyY = (getY() + Math.cos(angle) * e.getDistance());
qenemy_x=quantize_position(enemyX); //enemy x-position
qenemy_y=quantize_position(enemyY); //enemy y-position
//absolute angle to enemy
absbearing=absoluteBearing((float) getX(),(float) getY(),(float) enemyX,(float) enemyY);
q_absbearing=quantize_angle(absbearing); //state number 4
}
public double normalizeBearing(double angle) {
while (angle > 180) angle -= 360;
while (angle < -180) angle += 360;
return angle;
}
//reward functions:
//public void onHitRobot(HitRobotEvent event){reward-=2;} //our robot hit by enemy robot
//public void onBulletHit(BulletHitEvent event){reward+=3;} //one of our bullet hits enemy robot
//public void onHitByBullet(HitByBulletEvent event){reward-=3;} //when our robot is hit by a bullet
//public void BulletMissedEvent(Bullet bullet){reward-=3;}
private int quantize_angle(double absbearing2) {
if((absbearing2 > 0) && (absbearing2<=90)){
q_absbearing=1;
}
else if((absbearing2 > 90) && (absbearing2<=180)){
q_absbearing=2;
}
else if((absbearing2 > 180) && (absbearing2<=270)){
q_absbearing=3;
}
else if((absbearing2 > 270) && (absbearing2<=360)){
q_absbearing=4;
}
return q_absbearing;
}
private int quantize_distance(double distance2) {
if((distance2 > 0) && (distance2<=250)){
qdistancetoenemy=1;
}
else if((distance2 > 250) && (distance2<=500)){
qdistancetoenemy=2;
}
else if((distance2 > 500) && (distance2<=750)){
qdistancetoenemy=3;
}
else if((distance2 > 750) && (distance2<=1000)){
qdistancetoenemy=4;
}
return qdistancetoenemy;
}
//absolute bearing
double absoluteBearing(float x1, float y1, float x2, float y2) {
double xo = x2-x1;
double yo = y2-y1;
double hyp = Point2D.distance(x1, y1, x2, y2);
double arcSin = Math.toDegrees(Math.asin(xo / hyp));
double bearing = 0;
if (xo > 0 && yo > 0) { // both pos: lower-Left
bearing = arcSin;
} else if (xo < 0 && yo > 0) { // x neg, y pos: lower-right
bearing = 360 + arcSin; // arcsin is negative here, actuall 360 - ang
} else if (xo > 0 && yo < 0) { // x pos, y neg: upper-left
bearing = 180 - arcSin;
} else if (xo < 0 && yo < 0) { // both neg: upper-right
bearing = 180 - arcSin; // arcsin is negative here, actually 180 + ang
}
return bearing;
}
private int quantize_position(double rl_x2) {
if((rl_x2 > 0) && (rl_x2<=100)){
qrl_x=1;
}
else if((rl_x2 > 100) && (rl_x2<=200)){
qrl_x=2;
}
else if((rl_x2 > 200) && (rl_x2<=300)){
qrl_x=3;
}
else if((rl_x2 > 300) && (rl_x2<=400)){
qrl_x=4;
}
else if((rl_x2 > 400) && (rl_x2<=500)){
qrl_x=5;
}
else if((rl_x2 > 500) && (rl_x2<=600)){
qrl_x=6;
}
else if((rl_x2 > 600) && (rl_x2<=700)){
qrl_x=7;
}
else if((rl_x2 > 700) && (rl_x2<=800)){
qrl_x=8;
}
return qrl_x;
}
public void rl_action(int x)
{
switch(x){
case 1: //action 1 of the RL robot
int moveDirection=+1; //moves in anticlockwise direction
// circle our enemy
setTurnRight(getBearing + 90);
setAhead(150 * moveDirection);
break;
case 2: //action 2 of the RL robot
int moveDirection1=-1; //moves in clockwise direction
// circle our enemy
setTurnRight(getBearing + 90);
setAhead(150 * moveDirection1);
break;
case 3: //action 3 of the RL robot
setTurnGunRight(gunTurnAmt);
turnRight(getBearing-25);
ahead(150);
break;
case 4: //action 4 of the RL robot
setTurnGunRight(gunTurnAmt);
turnRight(getBearing-25);
back(150);
break;
}
}//rl_action()
//randomint
public static int randInt(int min, int max) {
Random rand = new Random();
// nextInt is normally exclusive of the top value, so add 1 to make it inclusive
int randomNum = rand.nextInt((max - min) + 1) + min;
return randomNum;
}
//Look up table (lut) initialization:
public void initialiseLUT() {
int[] total_states_actions=new int[8*6*4*4*action.length];
LUT=new String[total_states_actions.length][2];
int z=0;
for(int i=1;i<=8;i++){
for(int j=1;j<=6;j++){
for(int k=1;k<=4;k++){
for(int l=1;l<=4;l++){
for(int m=1;m<=action.length;m++){
LUT[z][0]=i+""+j+""+k+""+l+""+m;
LUT[z][1]="0";
z=z+1;
}
}
}
}
}
} //Initialize LUT
public void save() {
PrintStream w = null;
try {
w = new PrintStream(new RobocodeFileOutputStream(getDataFile("LookUpTable.txt")));
for (int i=0;i<LUT.length;i++) {
w.println(LUT[i][0]+" "+LUT[i][1]);
}
} catch (IOException e) {
e.printStackTrace();
}finally {
w.flush();
w.close();
}
}//save
public void load() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(getDataFile("LookUpTable.txt")));
String line = reader.readLine();
try {
int zz=0;
while (line != null) {
String splitLine[] = line.split(" ");
LUT[zz][0]=splitLine[0];
LUT[zz][1]=splitLine[1];
zz=zz+1;
line= reader.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}finally {
reader.close();
}
}//load
//get max (Max function)
public static int getMax(double[] array){
double largest = array[0];int index = 0;
for (int i = 1; i < array.length; i++) {
if ( array[i] >= largest ) {
largest = array[i];
index = i;
}
}
return index;
}//end of getMax
public void onRoundEnded(RoundEndedEvent e) {
//cum_reward_array[getRoundNum()]=cum_reward_while;
//index1=index1+1;
}
// save win rate
public void saveWinRate()
{
PrintStream w = null;
try
{
w = new PrintStream(new RobocodeFileOutputStream(getDataFile("winsRate.txt")));
for(int i=0; i<winsRate.length; i++)
w.println(winsRate[i]);
}
catch (IOException e) {
e.printStackTrace();
}finally {
w.flush();
w.close();
}
}
public void onBattleEnded(BattleEndedEvent e) {
saveWinRate();
save();
}
public void onDeath(DeathEvent event)
{
reward += -5;
winsRate[getRoundNum()] = 0;
}
public void onWin(WinEvent event)
{
reward += 5;
winsRate[getRoundNum()] = 1;
}
}//Rl_check class
| [
"kdsouza1496@gmail.com"
] | kdsouza1496@gmail.com |
27270a60b4a51c66c207c56694a718e295498ba0 | 3245183422f7f308d8f3b059f4620761b5b5fac3 | /src/main/java/com/marcello/course/entities/pk/OrderItemPK.java | da756fe89b2781340f44393e036f841d20581fdb | [] | no_license | marcello222/spring-boot-com-java11 | 10f4c180f3702b4061e0f2369f929eeb37cb0ea5 | f6a8a7e375666c40305dd8762bfca882cfd33318 | refs/heads/master | 2023-06-16T18:29:32.880449 | 2021-07-16T15:08:39 | 2021-07-16T15:08:39 | 386,010,778 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package com.marcello.course.entities.pk;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.marcello.course.entities.Order;
import com.marcello.course.entities.Product;
@Embeddable
public class OrderItemPK implements Serializable{
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "order_id")
private Order order;
@ManyToOne
@JoinColumn(name = "product_id")
private Product product;
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
@Override
public int hashCode() {
return Objects.hash(order, product);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OrderItemPK other = (OrderItemPK) obj;
return Objects.equals(order, other.order) && Objects.equals(product, other.product);
}
}
| [
"marcelloeduardo222@gmail.com"
] | marcelloeduardo222@gmail.com |
4feff0311bf4745614cb3a382d095eec97cb4d76 | b52677d5adc3cb537787cebbd914ac5420095502 | /src/test/java/week06d01/ListSelectorTest.java | c1322abf2477a05a1e3e15082035d3a2cc874b83 | [] | no_license | n0rb1v/training-solutions | 2823310467b2b3f58bb63032fb0076a21f039b1d | 7dc328d960f83cd936bb8e3faa9e2d78d0118152 | refs/heads/master | 2023-04-01T18:19:20.778498 | 2021-04-12T16:41:10 | 2021-04-12T16:41:10 | 308,018,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package week06d01;
import org.junit.jupiter.api.Test;
import stringscanner.StringScanner;
import week05d03.ListCounter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ListSelectorTest {
@Test
public void testList() {
List<String> test = Arrays.asList("abc","bela","aladar","geza","ALADDIN","Jani","arra");
ListSelector ls = new ListSelector();
assertEquals("[abc,aladar,ALADDIN,arra]", ls.filterList(test));
}
@Test
public void nullList() {
List<String> test = new ArrayList<>();
ListSelector ls = new ListSelector();
assertEquals("", ls.filterList(test));
}
@Test
public void incorrectParameterShouldThrowException() throws IllegalArgumentException {
Exception ex = assertThrows(IllegalArgumentException.class, () -> new ListSelector().filterList(null));
assertEquals("null lista", ex.getMessage());
}
}
| [
"n0rb1v@gmail.com"
] | n0rb1v@gmail.com |
5e48e446b2de81f3c35865f386cbeb80bdfc3ae6 | d142e8b43810880aca483ff3c9ea7c7258587cb8 | /io.janusproject.kernel/src/test/java/io/janusproject/testutils/AbstractDependentServiceTest.java | 9b3a3edb640290c363b30c85527df111711c5ba0 | [
"Apache-2.0"
] | permissive | julianstone/janusproject | c7d109f6a7a5c11af874d183e9ae19f63b68405e | fc6cc5ce6f0fd4bdd7cf214ed69be31a1d111e16 | refs/heads/master | 2021-01-18T04:14:05.522952 | 2015-02-23T10:24:47 | 2015-02-23T10:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,454 | java | /*
* $Id$
*
* Janus platform is an open-source multiagent platform.
* More details on http://www.janusproject.io
*
* Copyright (C) 2014 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.janusproject.testutils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import io.janusproject.services.DependentService;
import org.junit.Assume;
import org.junit.Test;
import com.google.common.util.concurrent.Service;
/** Abstract class that permits to test the
* implementation of a service.
*
* @param <S> - the type of the service.
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@SuppressWarnings("all")
public abstract class AbstractDependentServiceTest<S extends DependentService> extends AbstractServiceTest<S> {
/** Type of the testing service.
*/
protected final Class<? super S> serviceType;
/**
* @param type - the type of the service to test.
*/
public AbstractDependentServiceTest(Class<? super S> type) {
Assume.assumeNotNull(type);
this.serviceType = type;
}
@AvoidServiceStartForTest
@Test
public void getServiceType() {
assertNotNull(this.service);
Class<? extends Service> servType = this.service.getServiceType();
assertNotNull(servType);
assertTrue(servType.isInterface());
assertEquals(this.serviceType, servType);
}
/**
* Test the dependencies.
*
* The weak dependencies are defined in {@link DependentService#getServiceDependencies()}.
*/
@AvoidServiceStartForTest
@Test
public abstract void getServiceDependencies();
/**
* Test the weak dependencies.
*
* The weak dependencies are defined in {@link DependentService#getServiceWeakDependencies()}.
*/
@AvoidServiceStartForTest
@Test
public abstract void getServiceWeakDependencies();
}
| [
"galland@arakhne.org"
] | galland@arakhne.org |
30d9e894dffe3e0ae12ac0f1003c82338057e25e | a38aab792af9f0cc0fd1a92c163fdaea991f10f5 | /backend/web/src/main/java/com/woon/web/entities/WoonJoinGroup.java | fd159d5ae77634a9ba413814a16ef94f67ae725f | [] | no_license | kyahn23/ProjectWoon | 0e47db5116725d40a7e8dbe94d48e120c0b4b6e5 | 615bd7de32b2acebe2b8147682f3bf1f5ccfe198 | refs/heads/master | 2020-06-29T20:25:42.159470 | 2019-08-03T06:56:09 | 2019-08-03T06:56:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,085 | java | package com.woon.web.entities;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.ColumnDefault;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* WoonJoinGroup
*/
@NoArgsConstructor(access = AccessLevel.PUBLIC)
@Entity
@Getter
@Setter
@ToString
@Table(name = "tbl_joingroups")
public class WoonJoinGroup implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long jgrno;
@Column(name = "group_leader")
private String groupLeader;
@ManyToOne
@JoinColumn(name="groupno")
private WoonGroup WoonGroups;
@ManyToOne
@JoinColumn(name="uno")
private WoonUser woonUsers;
} | [
"laevus.j@gmail.com"
] | laevus.j@gmail.com |
a98cac46bd7ebb75bc0ac40009799f9833acb196 | fc03f96a78effe66a23c000a8608d23bbbb7e689 | /storage/mysql/src/main/java/project/pfairplay/storage/mysql/repository/TeamReviewCounterRepository.java | 69f1f0660c35ed0b5ac3087e28bb642270a7d45e | [] | no_license | dgryoo/pfairplayService | 3376dd939d3e8032079470564ff4c0bb23bffd11 | d6f39fd7b9f4b3c8c9210149bdb13b24dc5be6c1 | refs/heads/main | 2023-07-15T11:15:51.894725 | 2021-09-01T18:41:52 | 2021-09-01T18:41:52 | 319,003,493 | 2 | 0 | null | 2021-09-01T18:41:53 | 2020-12-06T10:13:39 | Java | UTF-8 | Java | false | false | 1,956 | java | package project.pfairplay.storage.mysql.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import project.pfairplay.storage.mysql.model.MatchEntity;
import project.pfairplay.storage.mysql.model.TeamReviewCounterEntity;
import javax.transaction.Transactional;
import java.util.List;
@Repository
public interface TeamReviewCounterRepository extends JpaRepository<TeamReviewCounterEntity, String> {
@Modifying
@Transactional
@Query(value = "UPDATE team_review_counter trc set trc.thumbs_up_count = trc.thumbs_up_count + 1 where trc.review_id = :reviewId", nativeQuery = true)
void increaseThumbsUpByReviewId(@Param("reviewId") String reviewId);
@Modifying
@Transactional
@Query(value = "UPDATE team_review_counter trc set trc.thumbs_up_count = trc.thumbs_up_count - 1 where trc.review_id = :reviewId", nativeQuery = true)
void decreaseThumbsUpByReviewId(@Param("reviewId") String reviewId);
@Modifying
@Transactional
@Query(value = "UPDATE team_review_counter trc set trc.thumbs_down_count = trc.thumbs_down_count + 1 where trc.review_id = :reviewId", nativeQuery = true)
void increaseThumbsDownByReviewId(@Param("reviewId") String reviewId);
@Modifying
@Transactional
@Query(value = "UPDATE team_review_counter trc set trc.thumbs_down_count = trc.thumbs_down_count - 1 where trc.review_id = :reviewId", nativeQuery = true)
void decreaseThumbsDownByReviewId(@Param("reviewId") String reviewId);
@Query(value = "SELECT * FROM team_review_counter trc where trc.review_id in (:reviewIdCondition)", nativeQuery = true)
List<TeamReviewCounterEntity> findTeamReviewByReviewIdList(@Param("reviewIdCondition") List<String> reviewIdCondition);
}
| [
"dgryoo95@gmail.com"
] | dgryoo95@gmail.com |
77efb5dad71e37d3ff2d234d3f0dfb42408580ce | cbb00e8c9668ecebb15a79cd67b80e3d2f19a8c0 | /src/main/java/com/xyzcorp/models/Employee.java | 45a479576bc84fc1e5475c81d2cea0fcc7951c8d | [
"MIT"
] | permissive | java4fun/java8-extension-libraries | 64688519b910003c9c54a508cf96d4b29534d95b | 611ed84ef3a92e4a02998908460df7a26bc8921b | refs/heads/master | 2022-12-26T22:18:36.093937 | 2020-02-24T23:11:58 | 2020-02-24T23:11:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,331 | java | package com.xyzcorp.models;
import java.util.Objects;
import java.util.StringJoiner;
public class Employee {
private String firstName;
private String lastName;
private int salary;
public Employee(String firstName, String lastName, int salary) {
this.firstName = firstName;
this.lastName = lastName;
this.salary = salary;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getSalary() {
return salary;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employee employee = (Employee) o;
return salary == employee.salary &&
Objects.equals(firstName, employee.firstName) &&
Objects.equals(lastName, employee.lastName);
}
@Override
public int hashCode() {
return Objects.hash(firstName, lastName, salary);
}
@Override
public String toString() {
return new StringJoiner(", ", Employee.class.getSimpleName() + "[", "]")
.add("firstName='" + firstName + "'")
.add("lastName='" + lastName + "'")
.add("salary=" + salary)
.toString();
}
}
| [
"dhinojosa@evolutionnext.com"
] | dhinojosa@evolutionnext.com |
1412af5f8f3a0331075e5223d8a807add5202d78 | d01aa0646fe94000d9caadc755ba148d7657d634 | /src/Modelo/Jugador2.java | 26df0c47697f55f011e1a4c906db0f285f9dfd54 | [] | no_license | pardovip/MiProyecto | 688af0adbba43dcea359cb1d693aab36df264848 | 769fa7ad96923d4ee886fefde0fc5bca5c3e948a | refs/heads/master | 2021-09-08T03:36:31.392477 | 2018-03-06T22:38:27 | 2018-03-06T22:38:27 | 124,146,293 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java |
package Modelo;
import java.util.ArrayList;
public class Jugador2 extends JugadorBuilder{
@Override
public void agregarNombre(String nombre) {
this.jugador.setNombre(nombre);
}
@Override
public void agregarFicha(Ficha ficha) {
this.jugador.setFicha(ficha);
}
/* @Override
public void agregarJugada(ArrayList <Jugada> jugadas) {
this.jugador.setJugadas(jugadas);
}*/
}
| [
"ADMINIST@LAB09-PC02"
] | ADMINIST@LAB09-PC02 |
850e86fc9684b4d0090c86fd59b77fd7d839978c | d777684d0bfbc8c94751a6a5bf0ef31cb8b769d6 | /Source/src/org/trident/world/content/combat/weapons/specials/impl/DragonLongSwordSpecialAttack.java | 2b6b8f63fd49cd20c569f17e490a61a4823c64f8 | [] | no_license | Rune-Status/Squ3D-Trident_MMO | 886e389f98caf376f35b1d3bb55322aac513d440 | 77a13b1135c9e12077e83669968674e6edaacba5 | refs/heads/master | 2020-03-07T20:19:27.464479 | 2019-09-30T19:18:38 | 2019-09-30T19:18:38 | 127,694,502 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package org.trident.world.content.combat.weapons.specials.impl;
import org.trident.model.Animation;
import org.trident.model.Graphic;
import org.trident.model.GraphicHeight;
import org.trident.world.content.combat.weapons.specials.SpecialAttack;
public class DragonLongSwordSpecialAttack extends SpecialAttack {
@Override
public Animation getAnimation() {
return ANIMATION;
}
@Override
public Graphic getGraphic() {
return GRAPHIC;
}
@Override
public boolean selfGraphic() {
return true;
}
@Override
public double getSpecialAmount() {
return 2.5;
}
@Override
public double getAccuracy() {
return 1.1;
}
@Override
public double getMultiplier() {
return 1.20;
}
@Override
public boolean isDoubleHit() {
return false;
}
private static final Animation ANIMATION = new Animation(12033);
private static final Graphic GRAPHIC = new Graphic(2117, GraphicHeight.HIGH);
}
| [
"37388224+NaimoSec@users.noreply.github.com"
] | 37388224+NaimoSec@users.noreply.github.com |
02460234d810536c6e93a60d603239a573c0c908 | 95e701004a0c2c3f24f4273dc0c4a439f2e358c2 | /aula24/ClasseOO/src/Classes/Exercicios/Exercicio04.java | 3fa4c04bd3aa91006f212aa29d8a0a05031a0869 | [] | no_license | gabriel121souza/JavaExerciciosModulo1 | bf98826791885bb67e6bfdce37cc695f1492eb3f | 161ed4d3e31e05e6d1473f1c357a05a66667a983 | refs/heads/master | 2022-12-05T06:19:37.479027 | 2020-09-03T04:58:44 | 2020-09-03T04:58:44 | 292,470,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package Classes.Exercicios;
import java.util.Date;
public class Exercicio04 {
public static void main(String[] args){
LivroBiblioteca livro = new LivroBiblioteca();
livro.nome = "The Joker";
livro.autor = "Gabriel S Rodrigues";
livro.qtdPaginas=200;
livro.anoLancamento=2008;
livro.dataEntrega = new Date();
livro.emprestado = true;
livro.emprestadoA = "Daniel Raflas";
System.out.println(livro.nome);
System.out.println(livro.autor);
System.out.println(livro.anoLancamento);
System.out.println(livro.qtdPaginas);
System.out.println(livro.dataEntrega);
System.out.println(livro.emprestado);
System.out.println(livro.emprestadoA);
}
}
| [
"gabriel121souza@gmail.com"
] | gabriel121souza@gmail.com |
65cf7d2e4e85c12e92f055c0966adefae0cba27c | 9672f79c1a6d6062fc5fce4256bc9ea441640e92 | /firebase-firestore/src/test/java/com/google/firebase/firestore/SnapshotMetadataTest.java | 90019ce73dff975bb3190a5b3016dbcac1d2abc1 | [
"Apache-2.0"
] | permissive | firebase/firebase-android-sdk | 6fa0dee652bbb12377d3db2d1ff1ec827c8ee923 | 6349a09155a82cead690230aa37578b3175b820d | refs/heads/master | 2023-09-01T08:56:49.035047 | 2023-08-31T18:10:46 | 2023-08-31T18:10:46 | 146,941,185 | 2,274 | 620 | Apache-2.0 | 2023-09-14T20:15:27 | 2018-08-31T20:50:43 | Java | UTF-8 | Java | false | false | 1,604 | java | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.firebase.firestore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class SnapshotMetadataTest {
@Test
public void testEquals() {
SnapshotMetadata foo = new SnapshotMetadata(true, true);
SnapshotMetadata fooDup = new SnapshotMetadata(true, true);
SnapshotMetadata bar = new SnapshotMetadata(true, false);
SnapshotMetadata baz = new SnapshotMetadata(false, true);
assertEquals(foo, fooDup);
assertNotEquals(foo, bar);
assertNotEquals(foo, baz);
assertNotEquals(bar, baz);
assertEquals(foo.hashCode(), fooDup.hashCode());
assertNotEquals(foo.hashCode(), bar.hashCode());
assertNotEquals(foo.hashCode(), baz.hashCode());
assertNotEquals(bar.hashCode(), baz.hashCode());
}
}
| [
"vkryachko@google.com"
] | vkryachko@google.com |
2bb67416b9275fee4d3c8540a7aa4496152ee411 | 8dafeafa983b7643a711e6822cdc8c4d971691aa | /src/com/thelambdacomplex/renn/RuntimeError.java | a999bb6ff3e8a5e339c1bf83f2467188226eb574 | [] | no_license | joshb99559/RennLanguage | 6d8b227e210d965b27d4e79113d8622c1aa8c9e7 | 6a6cd112896d4d9b669cc5d303a4a7e1a4adf52d | refs/heads/master | 2020-03-23T06:01:15.784507 | 2018-08-03T19:55:59 | 2018-08-03T19:55:59 | 141,183,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package com.thelambdacomplex.renn;
public class RuntimeError extends RuntimeException {
final Token token;
RuntimeError(Token token, String message) {
super(message);
this.token = token;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ea85c54f7519ef2e1ddb080e7e8fa9dbeccf459c | d8ad9be1a8ac1b053063eb759a0a1bfe884f0737 | /hw4/MyArrayList.java | 59fc858decfcee47937630ecb1325aea70b3b794 | [] | no_license | bilichenCOM/ma | 9a82193842edd6a0c119528a378ec2eba25c63fe | af678c46f5398b5ce6c1f20332962f62ec0b1ebb | refs/heads/master | 2020-04-30T12:21:20.318015 | 2019-05-24T12:01:14 | 2019-05-24T12:01:14 | 176,824,275 | 0 | 0 | null | 2019-05-24T12:06:23 | 2019-03-20T22:05:18 | Java | UTF-8 | Java | false | false | 2,242 | java | package hw4;
import java.util.Arrays;
public class MyArrayList<T> implements List<T> {
private Object[] array;
private int size = 0;
private static final int DEFAULT_CAPACITY = 21;
public MyArrayList(int capacity) {
array = new Object[capacity];
}
public MyArrayList() {
this(DEFAULT_CAPACITY);
}
public void add(T value) {
add(value, size);
}
public void add(T value, int index) {
checkIndex(index);
if (size + 1 > array.length) {
expandArray();
}
insertElementInArray(value, index);
}
private void insertElementInArray(T value, int validIndex) {
if (validIndex == size) {
array[size] = value;
} else {
Object[] lastElements = Arrays.copyOfRange(array, validIndex, size);
array[validIndex++] = value;
for (int i = 0; i < lastElements.length; i++) {
array[i + validIndex] = lastElements[i];
}
}
size++;
}
private void expandArray() {
int newLength = array.length + (array.length >> 1);
array = Arrays.copyOf(array, newLength);
}
public void addAll(List<T> list) {
if (this == list) {
throw new IllegalArgumentException("the same collection will not be duplicated");
}
for (int i = 0; i < list.size(); i++) {
add(list.get(i));
}
}
@SuppressWarnings("unchecked")
public T get(int index) {
checkIndex(index);
return (T) array[index];
}
public void set(T value, int index) {
checkIndex(index);
array[index] = value;
}
@SuppressWarnings("unchecked")
public T remove(int index) {
checkIndex(index);
T element = (T) array[index];
shiftLeft(index);
return element;
}
public T remove(T t) {
return remove(indexOf(t));
}
private void shiftLeft(int validIndex) {
for (int arrayIndex = validIndex; arrayIndex < size - 1; arrayIndex++) {
array[arrayIndex] = array[arrayIndex + 1];
}
array[size-- - 1] = null;
}
public int size() {
return this.size;
}
public boolean isEmpty() {
return size == 0;
}
private void checkIndex(int index) {
if (index < 0 || index > size) {
throw new ArrayIndexOutOfBoundsException("Size" + size + " but index: " + index);
}
}
public int indexOf(T element) {
for (int i = 0; i < size; i++) {
if (array[i].equals(element)) {
return i;
}
}
return -1;
}
}
| [
"bilichenko.mykhailo@gmail.com"
] | bilichenko.mykhailo@gmail.com |
d8a8a868b3c96d92f605c3abfe61e380dc7b9de6 | 582ae17b9406b07d81f3b1eacc8b4d8ee06d9080 | /src/Assignment.java | 377aa2cf1c02e46f6b818573b96981627765f963 | [] | no_license | Murtaza-Ali-2990/Hello_World | f67854bbb7787ac9d03ed38f93b316b591ea34c8 | 7298ac62cd8747e6316dd5552f1a043312cffac3 | refs/heads/master | 2020-07-10T18:25:35.544988 | 2019-08-25T18:37:56 | 2019-08-25T18:37:56 | 204,335,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | import java.util.Arrays;
import java.util.Scanner;
public class Assignment {
public static int [] smoothSignal(int[] arr) {
int[] res = new int[arr.length];
for(int i = 0; i < arr.length; i++) {
if(i == 0)
res[i] = (arr[i] + arr[i + 1])/2;
else if(i == arr.length - 1)
res[i] = (arr[i] + arr[i - 1])/2;
else
res[i] = (arr[i] + arr[i + 1] + arr[i - 1])/3;
}
return res;
}
public static void main(String [] args) {
Scanner scan = new Scanner(System.in);
int size = scan.nextInt();
int[] a = new int[size];
for(int i = 0; i < size; i++) {
a[i] = scan.nextInt();
}
int[] result = smoothSignal(a);
System.out.println(Arrays.toString(result));
}
}
| [
"muzareali@gmail.com"
] | muzareali@gmail.com |
f0a2671087679e239b8b5e0db9383a46a62c9b78 | 0546aac3cfedd9846589dd09405f8c165209bb1c | /app/src/fi/aalto/powerconsumptor/UIUtils.java | 076e1ce1096cc47963e46a625a0db1581832124f | [] | no_license | reidliujun/Android_power_project | 0dd11c28a8bead91ae55b346414ef3fcf602b030 | 706fb8e88cbebc1c30fc4c050635088a2e0147f4 | refs/heads/master | 2021-01-22T06:33:11.134557 | 2014-01-18T22:06:09 | 2014-01-18T22:06:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,810 | java | package fi.aalto.powerconsumptor;
import java.io.IOException;
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Locale;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
public class UIUtils {
private static final Handler uiHandler = new Handler(Looper.getMainLooper());
public static void runOnUiThread(Runnable r) {
uiHandler.post(r);
}
public static AlertDialog showOkDialog(Activity context, String title, String message) {
return showOkDialog(context, title, message, null);
}
public static AlertDialog showOkDialog(Activity context, String title, String message, final DialogInterface.OnDismissListener afterDismiss) {
try {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message).setCancelable(false);
if (title != null) {
builder.setTitle(title);
}
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
if (afterDismiss != null) {
afterDismiss.onDismiss(dialog);
}
}
});
if (!context.isFinishing()) {
AlertDialog alert = builder.create();
if (title == null) {
alert.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
alert.show();
try {
((TextView)alert.findViewById(android.R.id.message)).setGravity(Gravity.CENTER);
} catch (Exception ex) {}
return alert;
}
} catch (Exception e) {
e.printStackTrace();
//ignore
}
return null;
}
// private float getDip(float pix) {
//
// float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, pix, getResources().getDisplayMetrics());
// return px;
// }
/**
* Returns an array of localized weekday names starting from Monday.
* @param locale - Represents needed language and area codes. E.g. new Locale('fr')
* passing null uses default system locale
* @return an array containing translated week days' names
*/
public static String[] getLocalizedWeekdays(Locale locale, boolean shortStr) {
DateFormatSymbols dfSymbols;
if (locale != null) {
dfSymbols = new DateFormatSymbols(locale);
} else {
dfSymbols = new DateFormatSymbols();
}
String[] wDays = shortStr ? dfSymbols.getShortWeekdays() : dfSymbols.getWeekdays();
int[] days = {Calendar.MONDAY, Calendar.TUESDAY, //order of days to appear in final array
Calendar.WEDNESDAY, Calendar.THURSDAY,
Calendar.FRIDAY, Calendar.SATURDAY, Calendar.SUNDAY};
String[] weekDays = new String[days.length];
for (int i = 0; i < days.length; i++) { //map results
weekDays[i] = wDays[days[i]];
}
return weekDays;
}
/**
* Returns an array of localized months' names starting from January.
* @param languageCode - Represents needed language and area codes. E.g. new Locale('fr')
* passing null uses default system locale
* @return an array containing translated months' names
*/
public static String[] getLocalizedMonths(Locale locale, boolean shortStr) {
DateFormatSymbols dfSymbols;
if (locale != null) {
dfSymbols = new DateFormatSymbols(locale);
} else {
dfSymbols = new DateFormatSymbols();
}
String[] allMonths = shortStr ? dfSymbols.getShortMonths() : dfSymbols.getMonths();
int[] months = {Calendar.JANUARY, Calendar.FEBRUARY, Calendar.MARCH,
Calendar.APRIL, Calendar.MAY, Calendar.JUNE,
Calendar.JULY, Calendar.AUGUST, Calendar.SEPTEMBER,
Calendar.OCTOBER, Calendar.NOVEMBER, Calendar.DECEMBER};
String[] retMonths = new String[months.length];
for (int i = 0; i < months.length; i++) {
retMonths[i] = allMonths[months[i]];
}
return retMonths;
}
public static int dpToPx(float dp, Context c) {
return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, c.getResources().getDisplayMetrics());
}
public static int getRecursiveTop(View anchor) {
int top = anchor.getTop();
ViewGroup parent = (ViewGroup)anchor.getParent();
while (parent.getParent() != null && parent.getParent() instanceof ViewGroup) {
parent = (ViewGroup)parent.getParent();
top += parent.getTop();
}
return top;
}
public static int getRecursiveLeft(View anchor) {
int top = anchor.getLeft();
ViewGroup parent = (ViewGroup)anchor.getParent();
while (parent.getParent() != null && parent.getParent() instanceof ViewGroup) {
parent = (ViewGroup)parent.getParent();
top += parent.getLeft();
}
return top;
}
public static void hideSoftKeyboard(Context context, View keyboardTrigger) {
InputMethodManager imm = (InputMethodManager)context.getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(keyboardTrigger.getWindowToken(),
0);
}
public static String makeFragmentName(int viewId, int index) {
return "android:switcher:" + viewId + ":" + index;
}
public static Bitmap getFlagBitmap(Context c, String shortCode) {
try {
return BitmapFactory.decodeStream(c.getAssets().open("flags/" + shortCode.toLowerCase() + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static void removeFromParent(View view) {
if (view != null && view.getParent() != null) {
((ViewGroup)view.getParent()).removeView(view);
}
}
public static void setLocale(String langCode, Context context) {
Resources res = context.getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.locale = localeFromStr(langCode);
res.updateConfiguration(conf, dm);
}
public static Locale localeFromStr(String str) {
Locale locale = new Locale("en");
if (str.length() == 2) { //e.g. "en"
locale = new Locale(str.toLowerCase());
} else if(str.length() == 6) { //e.g. "nl-rBE"
locale = new Locale(str.substring(0, 2), str.substring(4));
}
return locale;
}
// public static ViewGroup getRootView(View child) {
// ViewGroup root;
// if (child instanceof ViewGroup) {
// root = (ViewGroup) child;
// } else {
// root = (ViewGroup) child.getParent();
// }
// while (root.getParent() != null && root.getParent() instanceof ViewGroup) {
// root = (ViewGroup)root.getParent();
// }
// return root;
// }
}
| [
"liuj2@niksula.hut.fi"
] | liuj2@niksula.hut.fi |
a76d4d8006e2f225227d2891424140328202a742 | dac930784bb147e72c185722c60f47704d503244 | /src/day16_switch_ternary/CapuccinoBuyer.java | 057ba200dde6b7efe3e6a183cdfadc6b96c6fee6 | [] | no_license | DannyOtgon/java-programming | 191b85d120ad23a5011c3362360d46fccb3a1133 | 88021c9c6854c463bc31cbd385d92f7379f97348 | refs/heads/master | 2023-07-18T17:23:38.382091 | 2021-09-15T14:04:42 | 2021-09-15T14:04:42 | 368,566,691 | 0 | 0 | null | 2021-06-11T02:59:40 | 2021-05-18T14:46:38 | Java | UTF-8 | Java | false | false | 1,020 | java | package day16_switch_ternary;
public class CapuccinoBuyer {
public static void main(String[] args) {
String size = "venti";
double price = 0.0;
int calories = 0;
switch (size){
case "tall":
System.out.println("Tall cappucino please");
price = 3.69;
calories = 90;
break;
case "grande":
System.out.println("Grande cappucino please");
price = 3.99;
calories = 120;
break;
case "venti":
System.out.println("Venti cappucino please");
price = 4.29;
calories = 150;
break;
default:
System.out.println("We don't have that size " +size+(" Cappucino"));
break;
}
System.out.println("Total Price: $" + price );
System.out.println("You will consume " + calories + " cals of energy");
}
}
| [
"dannyotgon@gmail.com"
] | dannyotgon@gmail.com |
4c1e392fc4144fc4afd08c8efe82293781cbb934 | e1450a329c75a55cf6ccd0ce2d2f3517b3ee51c5 | /src/main/java/home/javarush/javaCore/task11/task1119/Solution.java | 9d579f5d9394a7be77202b2d74b75632a1657c4e | [] | no_license | nikolaydmukha/netology-java-base-java-core | afcf0dd190f4c912c5feb2ca8897bc17c09a9ec1 | eea55c27bbbab3b317c3ca5b0719b78db7d27375 | refs/heads/master | 2023-03-18T13:33:24.659489 | 2021-03-25T17:31:52 | 2021-03-25T17:31:52 | 326,259,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package home.javarush.javaCore.task11.task1119;
/*
Четвертая правильная «цепочка наследования»
*/
public class Solution {
public static void main(String[] args) {
}
public class House {
}
public class Cat {
}
public class Car {
}
public class Dog {
}
} | [
"dmukha@mail.ru"
] | dmukha@mail.ru |
60cd433c0e85340da859f2da167c9df90bc22f7b | cd3d6e3b59c1abe14d978befab5f205c34652ccb | /src/main/java/com/wellxiao/springboot/demo/wellxiao/WellxiaoApplication.java | f7c883e5b01a1565d81a5490f66674a97021ecdf | [] | no_license | wellxiao/java-spring-boot | 96230dfdc70d3ae59b49edf33d8a345c6de9f1f8 | 8e0e40090d09ee1a4430b886a4f234ac9dad99d2 | refs/heads/master | 2022-07-15T00:09:26.844605 | 2019-09-17T06:49:29 | 2019-09-17T06:49:29 | 208,692,916 | 0 | 0 | null | 2022-06-21T01:52:30 | 2019-09-16T02:28:58 | Java | UTF-8 | Java | false | false | 346 | java | package com.wellxiao.springboot.demo.wellxiao;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WellxiaoApplication {
public static void main(String[] args) {
SpringApplication.run(WellxiaoApplication.class, args);
}
}
| [
"xiaowei504@icloud.com"
] | xiaowei504@icloud.com |
6dbc44a1d20b1f75cdb523cfb3689b9b6432da95 | a348820931ee0651a79ac8bbcbb8790bf2347b16 | /src/gutizia/util/overlay/AbstractOverlay.java | f6d21fbd4ccd2c55c285a8203e64c4cc0b88f712 | [] | no_license | gutizia/PowBot | c2a5a07654add4875027453a2ca7ad19a2005955 | ee07151d1d07694eb95af49dc0048ed6240f3d83 | refs/heads/master | 2023-02-27T08:37:35.982516 | 2021-02-04T03:46:00 | 2021-02-04T03:46:00 | 307,511,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package gutizia.util.overlay;
import java.awt.*;
import java.awt.image.BufferedImage;
public class AbstractOverlay {
private BufferedImage overlayImage;
AbstractOverlay(BufferedImage overlayImage) {
this.overlayImage = overlayImage;
}
AbstractOverlay() {
}
public void drawImage(Graphics2D g) {
g.drawImage(overlayImage,0,338,null);
}
}
| [
"gutizia@outlook.com"
] | gutizia@outlook.com |
14161a1e7589792950cda12c45f71639686d1927 | 15f1f5e3cfb59912895a5f5b7da9c4bee7a37b88 | /src/Task3/common/Semaphore.java | e589700d12d0b3a10b957314b00cc2e3c43faa82 | [] | no_license | vishalsene/346-a2 | 3326b15c05c9ca4ffd5cf06b311eeff19f3f8f49 | 6b24028ddc04aa7fd2f30f16dfd5f7b8b0244f50 | refs/heads/master | 2020-06-26T18:57:25.653154 | 2019-07-30T20:40:48 | 2019-07-30T20:40:48 | 199,722,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | package Task3.common;
/**
* Class Semaphore
* Implements artificial semaphore built on top of Java's sync primitives.
*
* $Revision: 1.4 $
* $Last Revision Date: 2019/07/02 $
*
* @author Serguei A. Mokhov, mokhov@cs.concordia.ca; Inspired by previous code by Prof. D. Probst
*/
public class Semaphore
{
/**
* Current semaphore's value
*/
private int iValue;
/*
* ------------
* Constructors
* ------------
*/
/**
* With value parameter.
*
* NOTE: There is no check made whether the value is positive or negative.
* This implementation allows initialization of a semaphore to a negative
* value because it's the only way it can become so. Wait() does not do
* that for us. The semantic of that could be that how many threads are
* _anticipated_ to be waiting on that semaphore.
*
* @param piValue Initial value of the semaphore to set.
*/
public Semaphore(int piValue)
{
this.iValue = piValue;
}
/**
* Default. Equivalent to Semaphore(0)
*/
public Semaphore()
{
this(0);
}
/**
* Returns true if locking condition is true.
* Usually used in PA3-4.
*/
public synchronized boolean isLocked()
{
return (this.iValue <= 0);
}
/*
* -----------------------------
* Standard semaphore operations
* -----------------------------
*/
/**
* Puts thread asleep if semamphore's values is less than or equal to zero.
*
* NOTE: This implementation as-is does not allow semaphore's value
* to become negative.
*/
public synchronized void Wait()
{
try
{
while(this.iValue <= 0)
{
wait();
}
this.iValue--;
}
catch(InterruptedException e)
{
System.out.println
(
"Semaphore::Wait() - caught InterruptedException: " +
e.getMessage()
);
e.printStackTrace();
}
}
/**
* Increments semaphore's value and notifies another (single) thread of the change.
*
* NOTES: By waking up any arbitrary thread using notify() and not notify
* all are simply being a little more efficient: we don't really care which
* thread is this, any would do just fine.
*/
public synchronized void Signal()
{
++this.iValue;
notify();
}
/**
* Proberen. An alias for Wait().
*/
public synchronized void P()
{
this.Wait();
}
/**
* Verhogen. An alias for Signal()
*/
public synchronized void V()
{
this.Signal();
}
}
// EOF
| [
"vishal.sene@hotmail.com"
] | vishal.sene@hotmail.com |
0eecad7c07a6f6f33b2ff630374536d0a58ddccb | f933c2a3826cf6e14f994a6c80e82c1b20c54d67 | /src/main/java/com/example/consumers/topic/TopicConsumer3.java | ea44462bf46ad4d6f9e211acf270138f2f46452a | [] | no_license | YousefKhaled0/Spring-AMQP-practice | cb27c31c2a02c16681d05433c9f2969d99f4abc1 | 5655cd52978a27abf0e2a0f5536f2018077f2cb0 | refs/heads/master | 2023-02-12T02:39:12.264702 | 2021-01-14T01:09:06 | 2021-01-14T01:09:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.consumers.topic;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
@RabbitListener(queues = "tq3")
public class TopicConsumer3 {
@RabbitHandler
private void messageHandler(String msg) {
System.out.println(TopicConsumer3.class + " " + msg);
}
}
| [
"yousef.eid.ext@orange.com"
] | yousef.eid.ext@orange.com |
a492ac88b151b44f8a03e6fd4fd15e6c16cebf68 | f8ff6f16a2b3179f203a8c00715b7b06d009116e | /WebSocketGame/src/com/websocketgame/shared/Unit.java | 233a2be0c935f128bc8dd64f28dee193b0b2d399 | [] | no_license | R-Simpson/board-game | 3ecf2d9e847610625d6d747ea5f7a5bb52390d2f | c54d9f1045bb60298e7fe4a23f7a1b833fe1e887 | refs/heads/master | 2021-01-19T18:08:12.951908 | 2014-12-31T22:52:17 | 2014-12-31T22:52:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,128 | java | package com.websocketgame.shared;
import java.io.IOException;
import java.io.Serializable;
import javafx.scene.paint.Color;
import javafx.scene.shape.Shape;
import com.websocketgame.gamePieces.GamePieceFootman;
import com.websocketgame.gamePieces.GamePieceKnight;
public class Unit implements Serializable {
private static final long serialVersionUID = 0;
private int owner;
private int type;
private Land land;
private transient Shape shape;
public Unit(int owner, int type, Land land)
{
this.owner = owner;
this.type = type;
this.land = land;
setUpShape(owner, type, land);
}
private void setUpShape(int owner, int type, Land land)
{
if (type==1) // Footman, weaker unit type, represented by a circle
{
this.shape = new GamePieceFootman(this);
}
else if (type==2) // Knight, stronger unit typ, represented by a square
{
this.shape = new GamePieceKnight(this);
}
switch (owner)
{
case 0: this.shape.setFill(Color.WHITE); break;
case 1: this.shape.setFill(Color.BLUE); break;
case 2: this.shape.setFill(Color.RED); break;
case 3: this.shape.setFill(Color.YELLOW); break;
case 4: this.shape.setFill(Color.PURPLE); break;
case 5: this.shape.setFill(Color.GREEN); break;
case 6: this.shape.setFill(Color.DARKORANGE); break;
}
}
public Unit getUnit()
{
return this;
}
public int getType()
{
return type;
}
public int getOwner()
{
return owner;
}
public Land getLand()
{
return land;
}
public Shape getShape() {
return shape;
}
private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
stream.writeInt(owner);
stream.writeInt(type);
stream.writeObject(land);
System.out.println("Writing unit with owner " + owner + ", type " + type);
}
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
this.owner = stream.readInt();
this.type = stream.readInt();
this.land = (Land) stream.readObject();
setUpShape(owner, type, land);
}
}
| [
"AngryPuppeh@gmail.com"
] | AngryPuppeh@gmail.com |
ddfeba91951d4b426fc83c3ee40a3bc39fdfc892 | 509b0429be343daeafdef5e337408bee7f85c496 | /Elevator/src/sda/Elevator.java | c529871f94fb31b9ce167fba3411c6f31e4b0e7b | [] | no_license | filip1333/Elevator | b63b4805f98ee17ce569db45dcc861a7fa870260 | 062be59cb309b5b21e5f9bbfab80d94979eb79c9 | refs/heads/master | 2020-06-13T04:45:42.636196 | 2019-07-06T16:32:19 | 2019-07-06T16:32:19 | 194,539,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,515 | java | package sda;
import java.util.ArrayList;
import java.util.List;
public class Elevator {
private List<Passenger> InElevator = new ArrayList<>();
private Direction direction;
private Floor actualOnFloor;
Elevator(Floor startFloor) {
actualOnFloor = startFloor;
direction = Direction.Stop;
}
public boolean isItEmpty() {
return InElevator.isEmpty();
}
public boolean someoneWantOut() {
return InElevator.stream().anyMatch(passenger -> passenger.doWantOutOnThisFloor(actualOnFloor));
}
public boolean putPassenger() {
boolean orPutPassenger = false;
for(int indexPassenger = InElevator.size() - 1; indexPassenger >= 0; indexPassenger--) {
Passenger passenger = InElevator.get(indexPassenger);
if(passenger.doWantOutOnThisFloor(actualOnFloor)) {
InElevator.remove(indexPassenger);
orPutPassenger = true;
}
}
return orPutPassenger;
}
public Floor giveActualFloor() {
return actualOnFloor;
}
public void putPassenger(List<Passenger> toElevator) {
InElevator.addAll(toElevator);
}
public void setActualFloor(Floor nextFloor) {
actualOnFloor = nextFloor;
}
public Direction giveDirection() {
return direction;
}
public void setDirection(Direction direction) {
this.direction = direction;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b2fcd2cedfa5d96c25d0c32cc8fab8e27b2fd0b9 | aaa57577b6e07c7f42bcf5f90bda19ce5c4cd7a1 | /kirjainreaktio/src/main/java/me/tl0/jlab/gui/package-info.java | 34e1629b9a2624a8e0ccb9ddab06fdf4ac69df66 | [] | no_license | tl0/jlab | cc6e6addfe93e73370baf241252665eac2a81358 | 9029555311bbe265b723d731c20158a2f28d663c | refs/heads/master | 2020-06-05T08:54:51.779800 | 2014-02-28T21:05:47 | 2014-02-28T21:05:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | /**
* GUI package - Holds everything that is responsible for Graphical User
* Interface (GUI) and theirs Listeners
*/
package me.tl0.jlab.gui;
| [
"tl0@users.noreply.github.com"
] | tl0@users.noreply.github.com |
d009baa3d85c6b0e5ecc19f54f2792ff84c0c894 | 83fabd9c6467874d75b3fa42dac26983b09f1452 | /src/gameObjects/Platform.java | 641c079d009b103e168392267d701f9e11172874 | [] | no_license | TimWoosh/BlockBlaster | b9678119cde767323ea2b721b2d178c5b815e4c0 | 1ea2c865f345968e4c9424250313e2a4f780ba2f | refs/heads/master | 2021-01-01T15:44:33.751085 | 2013-04-29T19:25:14 | 2013-04-29T19:25:14 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,717 | java | package gameObjects;
import android.gameengine.icadroids.input.TouchInput;
import bb.main.GameEngineXT;
/**
* Player controlled platform game object for directing the balls.
* @author Tim Wöstemeier
* @version $Revision: 1.0 $
*/
public class Platform extends MoveableGameObjectXT {
private double halfWidth;
private String sprite = "platform";
/**
* Constructor for Platform.
* @param game GameEngineXT
*/
public Platform(GameEngineXT game) {
super(game);
this.setSprite(sprite);
// TODO Auto-generated constructor stub
halfWidth = this.getFrameWidth()/2;
}
@Override
public void update()
{
super.update();
this.updateBoundingBox();
if(TouchInput.onPress)
{
double x = TouchInput.xPos;
if(x < (game.getBoundingBox().left + halfWidth))
{
x = (game.getBoundingBox().left + halfWidth);
}
else if (x > (game.getBoundingBox().right - halfWidth))
{
x = (game.getBoundingBox().right - halfWidth);
}
this.setX(x - halfWidth);
System.out.println("Pressed on the Screen: (" +TouchInput.xPos+","+TouchInput.yPos+")");
}
}
/**
* Method getAngleModifier.
* @param hitLoc double
* @param angle double
* @return double */
public double getAngleModifier(double hitLoc, double angle)
{
double modAngle = 0;
double width = this.getFrameWidth();
double center = width/2;
double distFromCenter = 0;
distFromCenter = hitLoc - center;
double locPart = (distFromCenter/center);
modAngle = 70 * locPart;
double newAngle = (modAngle + angle)%360;
if(newAngle < 290 && newAngle >= 180)
{
newAngle = 290;
}
else if (newAngle > 70 && newAngle < 180)
{
newAngle = 70;
}
return newAngle;
}
}
| [
"github@wooley-inc.mine.nu"
] | github@wooley-inc.mine.nu |
7ffa76bec32b89b40df96a728dd0bce0191a8861 | 0e20718d46846519ffa42986e731da21cb32b1d7 | /src/test/java/com/niks/springcloud/springcloudconfigserver/SpringCloudConfigServerApplicationTests.java | fdff6c154f8b212e7216c01133b40eb9470e1f41 | [] | no_license | nikhil-imcs/spring-cloud-config-server | ce99790627b081865b09caa1929e3b30f764d86c | 66b965d184cecf9fa86fc923e1eddf579cb8566b | refs/heads/master | 2021-04-09T14:54:37.289565 | 2018-03-16T17:45:55 | 2018-03-16T17:46:09 | 125,550,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.niks.springcloud.springcloudconfigserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringCloudConfigServerApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"nikhil.shende2018@gmail.com"
] | nikhil.shende2018@gmail.com |
3e8ed1f896d509886f70b61381877ca0f1bd46de | 81f842dca2b7f549c831a74cc23875c5df9538db | /src/main/java/net/kilger/mockins/util/MockinsContext.java | bf9bd12ed129ee7f866cbea1583c683c17974c15 | [
"Apache-2.0"
] | permissive | kilgerm/mockins | d4eb9176da401969fde9725b946e5f8d8fc7a889 | ca436b0de0cf97489d0fe3082fdeb79d3f78d88d | refs/heads/master | 2021-06-28T05:55:14.722185 | 2012-09-19T06:27:50 | 2012-09-21T06:31:20 | 5,139,846 | 0 | 0 | Apache-2.0 | 2020-10-13T07:03:31 | 2012-07-22T07:19:44 | Java | UTF-8 | Java | false | false | 4,629 | java | package net.kilger.mockins.util;
import net.kilger.mockins.analysis.DefaultExceptionAnalyzer;
import net.kilger.mockins.analysis.ExceptionAnalyzer;
import net.kilger.mockins.util.impl.SimpleClassNamer;
import net.kilger.mockins.util.impl.SimpleLocalVarNamer;
import net.kilger.mockins.util.mocking.MockHelper;
import net.kilger.mockins.util.mocking.impl.EasyMockHelper;
import net.kilger.mockins.util.mocking.impl.MockitoHelper;
/**
* Context information for mockins.
* Exists only as singleton and holds various global elements,
* e.g. the MockHelper.
*/
public enum MockinsContext {
/** the singleton instance */ INSTANCE;
private MockHelper mockHelper;
private ClassNamer classNamer;
private LocalVarNamer localVarNamer;
private ExceptionAnalyzer exceptionAnalyzer;
/** the timeout for each invocation of the test method in milliseconds*/
private int invocationTimeoutMillis;
private static final int DEFAULT_INVOCATION_TIMEOUT_MILLIS = 500;
/**
* Reset the Mockins context to default values.
*/
public void resetToDefault() {
mockHelper = null;
classNamer = defaultClassNamer();
localVarNamer = defaultLocalVarNamer();
exceptionAnalyzer = defaultExceptionAnalyzer();
invocationTimeoutMillis = DEFAULT_INVOCATION_TIMEOUT_MILLIS;
}
private MockinsContext() {
resetToDefault();
}
/**
* Returns the current mockhelper, autodetecting which one to use
* if none was explicitely configured.
*/
/*
* Note: This method is not synchronized, since even
* if you ran your tests in parallel,
* having multiple MockHelper instances should not
* create any problems.
*/
public MockHelper getMockHelper() {
if (INSTANCE.mockHelper == null) {
INSTANCE.mockHelper = autodetectedMockHelper();
}
return INSTANCE.mockHelper;
}
public void setMockHelper(MockHelper mockHelper) {
INSTANCE.mockHelper = mockHelper;
}
private static MockHelper autodetectedMockHelper() {
boolean hasMockito = isClassPresent("org.mockito.Mockito");
boolean hasEasyMock = isClassPresent("org.easymock.EasyMock");
if (hasMockito && hasEasyMock) {
// logger.warn("multiple mocking frameworks detected - this is generally not desirable");
}
/*
* In case there are both mocking framework available, EasyMock
* is preferred for the simple reason it was the framework already
* in use in the project I first used Mockins for.
* This is not a statement about which mocking framework is better.
*/
if (hasEasyMock) {
return new EasyMockHelper();
}
if (hasMockito) {
return new MockitoHelper();
}
// this is fatal
throw new Error("No mocking framework has been detected. " +
"Please add a supported mocking framework to the test classpath. " +
"Consider the main documentation for supported mocking frameworks and versions.");
}
private static ClassNamer defaultClassNamer() {
return new SimpleClassNamer();
}
private static LocalVarNamer defaultLocalVarNamer() {
return new SimpleLocalVarNamer();
}
private static ExceptionAnalyzer defaultExceptionAnalyzer() {
return new DefaultExceptionAnalyzer();
}
private static boolean isClassPresent(String qualifiedClassName) {
boolean found;
try {
Class.forName(qualifiedClassName);
found = true;
} catch (ClassNotFoundException e) {
found = false;
}
return found;
}
public ClassNamer getClassNamer() {
return classNamer;
}
public void setClassNamer(ClassNamer classNamer) {
INSTANCE.classNamer = classNamer;
}
public LocalVarNamer getLocalVarNamer() {
return localVarNamer;
}
public void setLocalVarNamer(LocalVarNamer localVarNamer) {
INSTANCE.localVarNamer = localVarNamer;
}
public int getInvocationTimeoutMillis() {
return invocationTimeoutMillis;
}
public void setInvocationTimeoutMillis(int invocationTimeoutMillis) {
this.invocationTimeoutMillis = invocationTimeoutMillis;
}
public ExceptionAnalyzer getExceptionAnalyzer() {
return exceptionAnalyzer;
}
public void setExceptionAnalyzer(ExceptionAnalyzer exceptionAnalyzer) {
this.exceptionAnalyzer = exceptionAnalyzer;
}
}
| [
"mk1@m-kilger.de"
] | mk1@m-kilger.de |
b0234c1919b34edf240a3e50ec8a032c67b00469 | 8e9b1b5ae9a80eb7c91273b058ec1060004af366 | /src/Arifmeticoperation/Main.java | ee52d2a195becd0bb8e70b478e2efeb9a98b5c93 | [] | no_license | McLine12345/homework10 | 55de2659f859e907ed1c92d2b9aa11f84760b628 | 24eaf006669b91ffd47c74614d2d6b6c959f1b96 | refs/heads/master | 2020-07-17T14:08:53.275426 | 2019-09-05T11:01:22 | 2019-09-05T11:01:22 | 206,033,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package Arifmeticoperation;
public class Main {
public static void main(String[] args) {
int x=15;
int y=7;
double z=5.5;
String text = "Hello,World";
System.out.println(x);
}
}
| [
"Radkevich@SCH3.LOCAL"
] | Radkevich@SCH3.LOCAL |
b99ee96580d7fa829af3be3537fc0db9d2efcf37 | b6656205c591729f6d7a851d44f60d5fd242f931 | /orm/AlumnoDetachedCriteria.java | 77c4a0e388cf5148c2213f4f85f22f233f302cf8 | [] | no_license | BaPablo/Proyecto-PA | f6784ba9bf8034816eaddbfa453f1fd5d6d02f67 | 514eb1d680c623137b3b56d7b499c2ab5a436275 | refs/heads/master | 2020-03-22T07:49:04.323341 | 2018-07-11T14:18:27 | 2018-07-11T14:18:27 | 139,726,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,158 | java | /**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: Universidad de La Frontera
* License Type: Academic
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class AlumnoDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression idAlumno;
public final StringExpression rutAlumno;
public final StringExpression primerNombre;
public final StringExpression segundoNombre;
public final StringExpression primerApellido;
public final StringExpression segundoApellido;
public final DateExpression fechaNacimiento;
public final StringExpression sexo;
public final StringExpression telefonoFijo;
public final StringExpression telefonoMovil;
public final StringExpression email;
public final StringExpression nacionalidad;
public final StringExpression estadoCivil;
public final ByteExpression planificaEstudio;
public final ByteExpression utilizaBibliografiaRecomendada;
public final IntegerExpression apoderado_idApoderadoId;
public final AssociationExpression apoderado_idApoderado;
public final IntegerExpression direccion_idDireccionId;
public final AssociationExpression direccion_idDireccion;
public final CollectionExpression agrupacion_idAgrup;
public final CollectionExpression condicionSalud_idCondicionSalud;
public final CollectionExpression intereses_idIntereses;
public final CollectionExpression ramaDeportiva_idRamaDeportiva;
public final CollectionExpression asistencia;
public AlumnoDetachedCriteria() {
super(orm.Alumno.class, orm.AlumnoCriteria.class);
idAlumno = new IntegerExpression("idAlumno", this.getDetachedCriteria());
rutAlumno = new StringExpression("rutAlumno", this.getDetachedCriteria());
primerNombre = new StringExpression("primerNombre", this.getDetachedCriteria());
segundoNombre = new StringExpression("segundoNombre", this.getDetachedCriteria());
primerApellido = new StringExpression("primerApellido", this.getDetachedCriteria());
segundoApellido = new StringExpression("segundoApellido", this.getDetachedCriteria());
fechaNacimiento = new DateExpression("fechaNacimiento", this.getDetachedCriteria());
sexo = new StringExpression("sexo", this.getDetachedCriteria());
telefonoFijo = new StringExpression("telefonoFijo", this.getDetachedCriteria());
telefonoMovil = new StringExpression("telefonoMovil", this.getDetachedCriteria());
email = new StringExpression("email", this.getDetachedCriteria());
nacionalidad = new StringExpression("nacionalidad", this.getDetachedCriteria());
estadoCivil = new StringExpression("estadoCivil", this.getDetachedCriteria());
planificaEstudio = new ByteExpression("planificaEstudio", this.getDetachedCriteria());
utilizaBibliografiaRecomendada = new ByteExpression("utilizaBibliografiaRecomendada", this.getDetachedCriteria());
apoderado_idApoderadoId = new IntegerExpression("apoderado_idApoderado.idApoderado", this.getDetachedCriteria());
apoderado_idApoderado = new AssociationExpression("apoderado_idApoderado", this.getDetachedCriteria());
direccion_idDireccionId = new IntegerExpression("direccion_idDireccion.idDireccion", this.getDetachedCriteria());
direccion_idDireccion = new AssociationExpression("direccion_idDireccion", this.getDetachedCriteria());
agrupacion_idAgrup = new CollectionExpression("ORM_Agrupacion_idAgrup", this.getDetachedCriteria());
condicionSalud_idCondicionSalud = new CollectionExpression("ORM_CondicionSalud_idCondicionSalud", this.getDetachedCriteria());
intereses_idIntereses = new CollectionExpression("ORM_Intereses_idIntereses", this.getDetachedCriteria());
ramaDeportiva_idRamaDeportiva = new CollectionExpression("ORM_RamaDeportiva_idRamaDeportiva", this.getDetachedCriteria());
asistencia = new CollectionExpression("ORM_Asistencia", this.getDetachedCriteria());
}
public AlumnoDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.AlumnoCriteria.class);
idAlumno = new IntegerExpression("idAlumno", this.getDetachedCriteria());
rutAlumno = new StringExpression("rutAlumno", this.getDetachedCriteria());
primerNombre = new StringExpression("primerNombre", this.getDetachedCriteria());
segundoNombre = new StringExpression("segundoNombre", this.getDetachedCriteria());
primerApellido = new StringExpression("primerApellido", this.getDetachedCriteria());
segundoApellido = new StringExpression("segundoApellido", this.getDetachedCriteria());
fechaNacimiento = new DateExpression("fechaNacimiento", this.getDetachedCriteria());
sexo = new StringExpression("sexo", this.getDetachedCriteria());
telefonoFijo = new StringExpression("telefonoFijo", this.getDetachedCriteria());
telefonoMovil = new StringExpression("telefonoMovil", this.getDetachedCriteria());
email = new StringExpression("email", this.getDetachedCriteria());
nacionalidad = new StringExpression("nacionalidad", this.getDetachedCriteria());
estadoCivil = new StringExpression("estadoCivil", this.getDetachedCriteria());
planificaEstudio = new ByteExpression("planificaEstudio", this.getDetachedCriteria());
utilizaBibliografiaRecomendada = new ByteExpression("utilizaBibliografiaRecomendada", this.getDetachedCriteria());
apoderado_idApoderadoId = new IntegerExpression("apoderado_idApoderado.idApoderado", this.getDetachedCriteria());
apoderado_idApoderado = new AssociationExpression("apoderado_idApoderado", this.getDetachedCriteria());
direccion_idDireccionId = new IntegerExpression("direccion_idDireccion.idDireccion", this.getDetachedCriteria());
direccion_idDireccion = new AssociationExpression("direccion_idDireccion", this.getDetachedCriteria());
agrupacion_idAgrup = new CollectionExpression("ORM_Agrupacion_idAgrup", this.getDetachedCriteria());
condicionSalud_idCondicionSalud = new CollectionExpression("ORM_CondicionSalud_idCondicionSalud", this.getDetachedCriteria());
intereses_idIntereses = new CollectionExpression("ORM_Intereses_idIntereses", this.getDetachedCriteria());
ramaDeportiva_idRamaDeportiva = new CollectionExpression("ORM_RamaDeportiva_idRamaDeportiva", this.getDetachedCriteria());
asistencia = new CollectionExpression("ORM_Asistencia", this.getDetachedCriteria());
}
public ApoderadoDetachedCriteria createApoderado_idApoderadoCriteria() {
return new ApoderadoDetachedCriteria(createCriteria("apoderado_idApoderado"));
}
public DireccionDetachedCriteria createDireccion_idDireccionCriteria() {
return new DireccionDetachedCriteria(createCriteria("direccion_idDireccion"));
}
public orm.AgrupacionDetachedCriteria createAgrupacion_idAgrupCriteria() {
return new orm.AgrupacionDetachedCriteria(createCriteria("ORM_Agrupacion_idAgrup"));
}
public orm.CondicionsaludDetachedCriteria createCondicionSalud_idCondicionSaludCriteria() {
return new orm.CondicionsaludDetachedCriteria(createCriteria("ORM_CondicionSalud_idCondicionSalud"));
}
public orm.InteresesDetachedCriteria createIntereses_idInteresesCriteria() {
return new orm.InteresesDetachedCriteria(createCriteria("ORM_Intereses_idIntereses"));
}
public orm.RamadeportivaDetachedCriteria createRamaDeportiva_idRamaDeportivaCriteria() {
return new orm.RamadeportivaDetachedCriteria(createCriteria("ORM_RamaDeportiva_idRamaDeportiva"));
}
public orm.AsistenciaDetachedCriteria createAsistenciaCriteria() {
return new orm.AsistenciaDetachedCriteria(createCriteria("ORM_Asistencia"));
}
public Alumno uniqueAlumno(PersistentSession session) {
return (Alumno) super.createExecutableCriteria(session).uniqueResult();
}
public Alumno[] listAlumno(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Alumno[]) list.toArray(new Alumno[list.size()]);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
506adc191144813d74276b4246ee0823bf2f2268 | 687af9963a3f273d9aaa801f98fabd6091bc3339 | /src/com/javarush/test/level03/lesson12/home03/Solution.java | 51ceae08383e92e78a3af51146df9fc9252323f9 | [] | no_license | babayinc/JavaRush | 4ce375d7dbdca1df8a38b7d47fce4532ef0fcdde | 089c731fc1d380c6dde4ccba3eb824ef13000409 | refs/heads/master | 2021-01-02T09:08:54.222996 | 2015-04-21T16:15:54 | 2015-04-21T16:15:54 | 32,571,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.javarush.test.level03.lesson12.home03;
/* Я буду зарабатывать $50 в час
Ввести с клавиатуры число n.
Вывести на экран надпись «Я буду зарабатывать $n в час».
Пример:
Я буду зарабатывать $50 в час
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution
{
public static void main(String[] args) throws Exception
{
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String s = bufferedReader.readLine();
System.out.println("Я буду зарабатывать $" + s + " в час");
}
} | [
"alexander.max@gmail.com"
] | alexander.max@gmail.com |
612660d2646bf542dcbb83fecf2b6720ef152a9b | 480cc73434bdb8b30e0281d5655519d47b83fbc9 | /18_12_02_AccountingManagementService/src/telran/security/accounting/service/AccountingMongo.java | 59f6b9da18635fca646c2b260c4ceaeb994ff4a4 | [] | no_license | Belostotskii/accountingManagement2 | 3ac7c3fd9a67229d4f299674d9754e63c2dc47cb | 03bf18b57876f3028747ba1455b529d3f536222c | refs/heads/master | 2020-04-09T04:46:33.923031 | 2018-12-03T13:26:34 | 2018-12-03T13:26:34 | 160,035,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | package telran.security.accounting.service;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import telran.security.accounting.Account;
import telran.security.accounting.IAccounting;
import telran.security.accounting.repository.IAccountingMongoRepository;
@Service
public class AccountingMongo implements IAccounting{
@Autowired
IAccountingMongoRepository accountsRepo;
@Value("${expiration_period:1}")
int expirationPeriod;
@PostConstruct
public void displayValue() {
System.out.println(expirationPeriod);
}
@Override
public String getPassword(String username) {
Account account=accountsRepo.findById(username).orElse(null);
if((ChronoUnit.DAYS.between(account.getActivationDate(), LocalDate.now()) < expirationPeriod) && !account.isRevoked() && account != null)
return account.getPassword_hash();
else return null;
}
@Override
public String[] getRoles(String username) {
Account account=accountsRepo.findById(username).orElse(null);
if(account==null)
return null;
Set<String> setRoles=account.getRoles();
return setRoles.stream().map(x->"ROLE_"+x)
.toArray((x)->new String[setRoles.size()]);
}
}
| [
"i.belostotskiy@gmail.com"
] | i.belostotskiy@gmail.com |
5e10cf5a68c57b23ab28c9a36fab7cadb0594005 | 4a82aeefc880c3335574022cdc82552e925e7455 | /utils/src/main/java/com/linsh/utilseverywhere/PermissionUtils.java | c4cdda679dbb34cb92839ccea85933062d393959 | [] | no_license | niemj/Utils-Everywhere | 5085e9ed06316ec372ee17543d04e21399029bed | 64cb80af4a9f9a2c5e68394ef548e43a12bdbd76 | refs/heads/master | 2021-05-05T23:12:36.680549 | 2018-01-01T15:47:16 | 2018-01-01T15:47:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,524 | java | package com.linsh.utilseverywhere;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import java.util.ArrayList;
/**
* <pre>
* author : Senh Linsh
* github : https://github.com/SenhLinsh
* date : 2017/11/10
* desc : 工具类: 权限相关
* </pre>
*/
public class PermissionUtils {
/**
* 默认的请求码
*/
public static final int REQUEST_CODE_PERMISSION = 101;
private PermissionUtils() {
}
//================================================ Android 6.0 权限申请 ================================================//
/**
* Android 6.0 以上检查权限
* <p>该方法只有在 Android 6.0 以上版本才能返回正确的结果, 因此需要提前判断 SDK 版本
* <br>注: Android M 以下系统检查的是清单文件而不是用户决定是否授予的权限
*
* @param permission 权限
* @return 是否通过
*/
public static boolean checkPermission(String permission) {
return ContextCompat.checkSelfPermission(ContextUtils.get(), permission)
== PackageManager.PERMISSION_GRANTED;
}
/**
* Android 6.0 以上检查权限
* <p>该方法只有在 Android 6.0 以上版本才能返回正确的结果, 因此需要提前判断 SDK 版本
* <br>注: Android M 以下系统检查的是清单文件而不是用户决定是否授予的权限
*
* @param permissions 多个权限
* @return 是否全部通过
*/
public static boolean checkPermissions(String... permissions) {
for (String permission : permissions) {
if (!checkPermission(permission)) {
return false;
}
}
return true;
}
/**
* 检查权限, 如果不通过, 将自动请求该系统权限
*
* @param activity Activity
* @param permission 系统权限
* @param listener 权限回调
*/
public static void checkAndRequestPermission(Activity activity, String permission, @NonNull PermissionListener listener) {
checkAndRequestPermissions(activity, new String[]{permission}, listener);
}
/**
* 检查多个权限, 如果不通过, 将自动请求该系统权限
*
* @param activity Activity
* @param permissions 多个系统权限
* @param listener 权限回调
*/
public static void checkAndRequestPermissions(Activity activity, String[] permissions, @NonNull PermissionListener listener) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ArrayList<String> list = new ArrayList<>();
for (String permission : permissions) {
if (checkPermission(permission)) {
listener.onGranted(permission);
} else if (isPermissionNeverAsked(activity, permission)) {
listener.onDenied(permission, true);
} else {
list.add(permission);
}
}
if (list.size() > 0) {
requestPermissions(activity, ArrayUtils.toStringArray(list), listener);
}
} else {
for (String permission : permissions) {
listener.onBeforeAndroidM(permission);
}
}
}
/**
* 申请系统权限
*
* @param activity Activity
* @param permission 系统权限
* @param listener 权限回调
*/
public static void requestPermission(Activity activity, String permission, @Nullable PermissionListener listener) {
requestPermissions(activity, new String[]{permission}, listener);
}
/**
* 申请duoge系统权限
*
* @param activity Activity
* @param permissions 系统权限
* @param listener 权限回调
*/
public static void requestPermissions(Activity activity, String[] permissions, @Nullable PermissionListener listener) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ActivityCompat.requestPermissions(activity, permissions, REQUEST_CODE_PERMISSION);
}
}
/**
* 判断指定的权限是否被用户选择不再弹出提醒 (即申请权限时无法弹出窗口, 需要用户手动前往权限界面进行打开)
*
* @param activity Activity
* @param permission 系统权限
* @return 是否不再弹出提醒
*/
public static boolean isPermissionNeverAsked(Activity activity, String permission) {
return ActivityCompat.shouldShowRequestPermissionRationale(activity, permission);
}
/**
* 解析 Activity 中申请权限的回调, 无需自己进行判断, 需重写方法 {@link Activity#onRequestPermissionsResult(int, String[], int[])}
* 并在该方法中调用此方法
*
* @param activity Activity
* @param requestCode requestCode
* @param permissions permissions
* @param grantResults grantResults
* @param listener 权限回调
*/
public static void onRequestPermissionsResult(Activity activity, int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults, @NonNull PermissionListener listener) {
if (REQUEST_CODE_PERMISSION == requestCode) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
listener.onGranted(permissions[i]);
} else if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permissions[i])) {
listener.onDenied(permissions[i], false);
} else {
listener.onDenied(permissions[i], true);
}
}
}
}
public interface PermissionListener {
void onGranted(String permission);
void onDenied(String permission, boolean isNeverAsked);
/**
* 当前系统版本在为 Android M (6.0) 以下, 无法得知是否拥有该权限, 需要实际运行才可得知
*/
void onBeforeAndroidM(String permission);
}
//==================================== 权限组, 根据不同的权限组来自定义权限的获取 ======================================//
public static class Calendar {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.READ_CALENDAR)
|| PermissionUtils.checkPermission(Manifest.permission.WRITE_CALENDAR);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
}
public static class Camera {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.CAMERA);
} else {
return checkPermissionBeforeAndroidM();
}
}
/**
* @return 返回 false 不一定是没有权限, 也有一定的可能是摄像头被占用的情况(可能性较低)
*/
public static boolean checkPermissionBeforeAndroidM() {
android.hardware.Camera cam = null;
try {
cam = android.hardware.Camera.open();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
try {
if (cam != null) {
cam.release();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
public static class Contacts {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.READ_CONTACTS)
|| PermissionUtils.checkPermission(Manifest.permission.WRITE_CONTACTS)
|| PermissionUtils.checkPermission(Manifest.permission.GET_ACCOUNTS);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
}
public static class Location {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|| PermissionUtils.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
}
public static class Microphone {
private static final int RECORDER_SAMPLERATE = 8000;
private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_MONO;
private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.RECORD_AUDIO);
} else {
return checkPermissionBeforeAndroidM();
}
}
/**
* @return 返回 false 不一定是没有权限, 也有一定的可能是麦克风被占用的情况(可能性较低)
*/
public static boolean checkPermissionBeforeAndroidM() {
try {
boolean hasPermission = true;
AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
RECORDER_SAMPLERATE, RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING, 1024 * 2);
//开始录制音频
try {
// 防止某些手机崩溃
audioRecord.startRecording();
} catch (IllegalStateException e) {
e.printStackTrace();
}
// 根据开始录音判断是否有录音权限
if (audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
hasPermission = false;
}
audioRecord.stop();
audioRecord.release();
return hasPermission;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
public static class Phone {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.READ_PHONE_STATE)
|| PermissionUtils.checkPermission(Manifest.permission.CALL_PHONE)
|| PermissionUtils.checkPermission(Manifest.permission.READ_CALL_LOG)
|| PermissionUtils.checkPermission(Manifest.permission.WRITE_CALL_LOG)
|| PermissionUtils.checkPermission(Manifest.permission.ADD_VOICEMAIL)
|| PermissionUtils.checkPermission(Manifest.permission.USE_SIP)
|| PermissionUtils.checkPermission(Manifest.permission.PROCESS_OUTGOING_CALLS);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
}
public static class Sensors {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.BODY_SENSORS);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
/**
* 检查相机硬件是否可用
*/
public static boolean checkHardware() {
return ContextUtils.get().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
}
}
public static class Sms {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.SEND_SMS)
|| PermissionUtils.checkPermission(Manifest.permission.RECEIVE_SMS)
|| PermissionUtils.checkPermission(Manifest.permission.READ_SMS)
|| PermissionUtils.checkPermission(Manifest.permission.RECEIVE_WAP_PUSH)
|| PermissionUtils.checkPermission(Manifest.permission.RECEIVE_MMS);
} else {
return checkPermissionBeforeAndroidM();
}
}
private static boolean checkPermissionBeforeAndroidM() {
// TODO: 17/6/17
return true;
}
}
public static class Storage {
public static boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return PermissionUtils.checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
|| PermissionUtils.checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
return checkPermissionBeforeAndroidM();
}
}
public static boolean checkPermissionBeforeAndroidM() {
return true;
}
}
}
| [
"lyuanxiang0812@126.com"
] | lyuanxiang0812@126.com |
3486928eec2c0bcd4e138b8763798064a4911fba | 5955caa5726e105fe73b449d2b6b32c8d8d8c750 | /TwitterAPI/src/dataextraction/RedditExtraction.java | c07872ca6dca1bd01c82fd4344a699252865e57c | [] | no_license | nicolasrsantos/RumourFlow | 7c8ac597e2e307c9cb126b76b0d2006bc2a84a49 | d0ce0c183af09f7892b9246157704949d18eddeb | refs/heads/master | 2021-01-11T23:22:45.588118 | 2018-06-20T18:44:06 | 2018-06-20T18:44:06 | 115,960,809 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,080 | java | package dataextraction;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.commons.io.FileUtils;
import com.github.jreddit.entity.Submission;
import com.github.jreddit.memes.MemesJSON;
import com.github.jreddit.memes.Nodes;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import Utils.PropertyUtils;
import examples.ExtractSubmissionByKeyWord;
import sentiment.WikipediaTopicExtraction;
public class RedditExtraction {
public static void saveToCsv(List<GroundTruthNode> submissions, String outputFile) throws IOException {
FileWriter fileWriter = new FileWriter(outputFile);
StringBuilder stringBuilder = new StringBuilder();
for (GroundTruthNode sub : submissions) {
System.out.println("Saving new string");
stringBuilder.append("\"" + sub.getPost() + "\"," + sub.getBeliefClass().replaceAll("\r", "") + "," + sub.getSentiment() + "\n");
System.out.println("String saved");
}
System.out.println("Saving file");
fileWriter.write(stringBuilder.toString());
System.out.println("File saved");
fileWriter.close();
}
public static void getUserKarma(String inputDir, String keyword) throws IOException {
String json = FileUtils.readFileToString(new File(inputDir + keyword + ".json"));
Gson gson = new Gson();
MemesJSON posts = gson.fromJson(json, MemesJSON.class);
List<Nodes> nodes = posts.getUserNodes();
String sURL = null;
List<GroundTruthNode> karmaNodes = new ArrayList<GroundTruthNode>();
for (Nodes node : nodes) {
if (node.getTitle() == node.getLabel()) {
System.out.println("Processing new node");
sURL = "https://www.reddit.com/user/" + node.getTitle() + "/about.json";
URL url = new URL(sURL);
URLConnection request = url.openConnection();
request.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36");
request.connect();
GroundTruthNode newNode = new GroundTruthNode();
newNode.setPost(node.getLabel().replaceAll("\n", " "));
newNode.setBeliefClass(node.getTitle());
try {
JsonParser jp = new JsonParser(); //from gson
JsonObject root = jp.parse(new InputStreamReader((InputStream) request.getContent())).getAsJsonObject();
JsonObject rootData = root.get("data").getAsJsonObject();
if (rootData.has("link_karma") && rootData.has("comment_karma")) {
int linkKarma = rootData.get("link_karma").getAsInt();
int commentKarma = rootData.get("comment_karma").getAsInt();
newNode.setSentiment(Integer.toString(linkKarma + commentKarma));
} else {
newNode.setSentiment(Integer.toString(0));
}
} catch (FileNotFoundException e) {
newNode.setSentiment(Integer.toString(0));
}
karmaNodes.add(newNode);
System.out.println("New node processed");
}
}
System.out.println("Saving to csv file");
saveToCsv(karmaNodes, "C:\\Users\\nico\\Desktop\\posts.csv");
}
public static Boolean isChild(Nodes dad, Nodes child) {
while (child.getParentID() != null) {
child = child.getParentID();
}
if (child.getLabel().equals(dad.getLabel())) {
return true;
}
return false;
}
public static void getRealSubmissions(String inputDir, String keyword) throws IOException {
String json = FileUtils.readFileToString(new File(inputDir + keyword + ".json"));
Gson gson = new Gson();
MemesJSON posts = gson.fromJson(json, MemesJSON.class);
List<Nodes> nodes = posts.getNodes();
List<Nodes> userNodes = posts.getUserNodes();
List<FakeSubmission> listSubs = new ArrayList<FakeSubmission>();
for (Nodes node : nodes) {
FakeSubmission newSub = new FakeSubmission();
newSub.setCreated(node.getTimestamp());
List<String> users = new ArrayList<String>();
users.add(node.getLabel());
for (Nodes userNode : userNodes) {
if (isChild(node, userNode)) {
users.add(userNode.getTitle());
}
}
newSub.setUsers(users);
listSubs.add(newSub);
}
List<List<String>> spreaders = new ArrayList<>();
List<List<String>> ignorants = new ArrayList<>();
List<List<String>> stiflers = new ArrayList<>();
List<List<String>> spreaders_temp = new ArrayList<>();
Comparator<FakeSubmission> comparator = new Comparator<FakeSubmission>() {
public int compare(FakeSubmission c1, FakeSubmission c2) {
return (int) (c1.getCreated() - c2.getCreated()); // use your logic
}
};
Collections.sort(listSubs, comparator);
for (int i = 0; i < listSubs.size(); i++) {
List<String> spreader = new ArrayList<>();
List<String> ignorant = new ArrayList<>();
List<String> stifler = new ArrayList<>();
List<String> spreader_temp = new ArrayList<>();
FakeSubmission sub = listSubs.get(i);
// at t0, one spreader and the rest are ignorants
if (i == 0) {
for (int j = 0; j < sub.getUsers().size(); j++) {
if (j == 0) {
if (!spreader.contains(sub.getUsers().get(j)))
spreader.add(sub.getUsers().get(j));
} else {
if (!ignorant.contains(sub.getUsers().get(j)))
ignorant.add(sub.getUsers().get(j));
}
}
spreaders.add(spreader);
ignorants.add(ignorant);
stiflers.add(stifler);
// ignorant become spreaders now
for (int j = 0; j < sub.getUsers().size(); j++) {
spreader_temp.add(sub.getUsers().get(j));
}
spreaders_temp.add(spreader_temp);
} else {
// at t1..tn, calculate spreader, ignorant, and stifler
for (int j = 0; j < sub.getUsers().size(); j++) {
String user = sub.getUsers().get(j);
if (j == 0) {
spreader.add(user);
} else {
// active spreader
if (ExtractSubmissionByKeyWord.checkIfSpreader(spreaders_temp, user)) {
if (!spreader.contains(user)) {
spreader.add(user);
}
} else if (ExtractSubmissionByKeyWord.checkIfStifler(spreaders_temp, user)) {
if (!stifler.contains(user)) {
stifler.add(user);
}
} else if (!ignorant.contains(user)) {
ignorant.add(user);
}
}
}
spreaders.add(spreader);
ignorants.add(ignorant);
stiflers.add(stifler);
// at t1..tn, calculate spreader, ignorant, and stifler
for (int j = 0; j < sub.getUsers().size(); j++) {
// active spreader
String user = sub.getUsers().get(j);
spreader_temp.add(user);
}
spreaders_temp.add(spreader_temp);
}
}
for (List<String> list : spreaders) {
for (String name : list) {
System.out.println(name + ",spreader");
}
}
for (List<String> list : ignorants) {
for (String name : list) {
System.out.println(name + ",ignorant");
}
}
for (List<String> list : stiflers) {
for (String name : list) {
System.out.println(name + ",stifler");
}
}
}
public static Integer getNumberOfTopics(GroundTruthNode user, List<GroundTruthNode> users) {
int numberOfTopics = 0;
for (GroundTruthNode cur : users) {
if (cur.getBeliefClass().equals(user.getBeliefClass())) {
numberOfTopics += WikipediaTopicExtraction.getWikis(cur.getPost()).size();
}
}
return numberOfTopics;
}
public static void getTopics(String filename) throws IOException {
List<GroundTruthNode> users = new ArrayList<GroundTruthNode>();
users = RedditGroundTruth.parseCsv(filename);
for (GroundTruthNode user : users) {
System.out.println(getNumberOfTopics(user, users));
}
}
public static void main(String[] args) throws IOException {
String filename = "C:\\Users\\nico\\Downloads\\postUser.tsv";
getTopics(filename);
}
}
| [
"nicolas.rsantos1@gmail.com"
] | nicolas.rsantos1@gmail.com |
3d7d6bb3438fb5a48f0aa9359817ba84719bf5a6 | f354aa53e040f8c91f7a6ade4f96aabdeb42e157 | /cloud_solution/cloudmp111111111111111/src/com/zhicloud/ms/vo/PlatformResourceMonitorVO.java | b4a4acfd5fe4a357fd63c7c37363fea0524a304f | [] | no_license | spofa/web_develop | 39c280096e79d919a363b3edc281e0f26792898b | 2c0ab556b5388fbef95614833db0f53fc81d0d40 | refs/heads/master | 2021-06-14T23:46:48.313666 | 2017-03-31T05:19:43 | 2017-03-31T05:19:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,224 | java | /**
* Project Name:op
* File Name:PlatformResourceMonitorVO.java
* Package Name:com.zhicloud.op.vo
* Date:2015年6月9日上午9:55:29
*
*
*/
package com.zhicloud.ms.vo;
import com.zhicloud.ms.common.util.json.JSONBean;
import net.sf.json.JSONArray;
/**
* ClassName: PlatformResourceMonitorVO
* Function: 平台资源监控
* date: 2015年6月9日 上午9:55:29
*
* @author sasa
* @version
* @since JDK 1.7
*/
public class PlatformResourceMonitorVO implements JSONBean{
private int task;//监控任务id
private JSONArray server;//宿主机数量[停止,告警,故障,正常]
private JSONArray host ;//云主机数量[停止,告警,故障,正常]
private int cpuCount;//cpu总核心数
private String cpuUsage ;//cpu利用率
private JSONArray memory;//内存空间,单位:字节,[可用,总量]
private String memoryUsage ;//内存利用率
private JSONArray diskVolume ;//磁盘空间,单位:字节,[可用,总量]
private String diskUsage ;//磁盘利用率
private JSONArray diskIO ;//磁盘io,[读请求,读字节,写请求,写字节,IO错误次数]
private JSONArray networkIO ;//网络io,[接收字节,接收包,接收错误,接收丢包,发送字节,发送包,发送错误,发送丢包]
private JSONArray speed ;//速度,单位字节/s,[读速度,写速度,接收速度,发送速度]
private String timestamp;//时间戳,格式"YYYY-MM-DD HH:MI:SS"
private Integer region;//地域
public int getTask() {
return task;
}
public void setTask(int task) {
this.task = task;
}
public JSONArray getServer() {
return server;
}
public void setServer(JSONArray server) {
this.server = server;
}
public JSONArray getHost() {
return host;
}
public void setHost(JSONArray host) {
this.host = host;
}
public int getCpuCount() {
return cpuCount;
}
public void setCpuCount(int cpuCount) {
this.cpuCount = cpuCount;
}
public String getCpuUsage() {
return cpuUsage;
}
public void setCpuUsage(String cpuUsage) {
this.cpuUsage = cpuUsage;
}
public JSONArray getMemory() {
return memory;
}
public void setMemory(JSONArray memory) {
this.memory = memory;
}
public String getMemoryUsage() {
return memoryUsage;
}
public void setMemoryUsage(String memoryUsage) {
this.memoryUsage = memoryUsage;
}
public JSONArray getDiskVolume() {
return diskVolume;
}
public void setDiskVolume(JSONArray diskVolume) {
this.diskVolume = diskVolume;
}
public String getDiskUsage() {
return diskUsage;
}
public void setDiskUsage(String diskUsage) {
this.diskUsage = diskUsage;
}
public JSONArray getDiskIO() {
return diskIO;
}
public void setDiskIO(JSONArray diskIO) {
this.diskIO = diskIO;
}
public JSONArray getNetworkIO() {
return networkIO;
}
public void setNetworkIO(JSONArray networkIO) {
this.networkIO = networkIO;
}
public JSONArray getSpeed() {
return speed;
}
public void setSpeed(JSONArray speed) {
this.speed = speed;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public Integer getRegion() {
return region;
}
public void setRegion(Integer region) {
this.region = region;
}
}
| [
"陈锦鸿"
] | 陈锦鸿 |
e7bfe4a780e0d1889e25986f38aaff41ff85726f | 630959a7b1d01336d4518140244611ce4601f269 | /src/com/tropicana/ipingpang/MyInfoActivity.java | ad5958dbe6e9944887908c49c8fc9afdfd59af3c | [] | no_license | Tropicana33/IPingPang | 0a9712c91f23b5814cae72f28491b31ca136d479 | cc6bc02c57e7ff3b2d2587c1741bc3fcd3d49a63 | refs/heads/master | 2020-06-13T12:46:45.618767 | 2016-12-02T09:01:07 | 2016-12-02T09:01:07 | 75,377,807 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 15,077 | java | package com.tropicana.ipingpang;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.map.MyLocationData;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.tropicana.ipingpang.application.MyApplication;
import com.tropicana.ipingpang.base.BaseActivity;
import com.tropicana.ipingpang.bmob.bean.User;
import com.tropicana.ipingpang.global.GlobalContants;
import com.tropicana.ipingpang.location.MyLocationManager;
import com.tropicana.ipingpang.utils.ImageLoadOptions;
import com.tropicana.ipingpang.utils.LogUtils;
import com.tropicana.ipingpang.utils.PhotoUtil;
import com.tropicana.ipingpang.utils.SharePreferenceUtils;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.bmob.im.db.BmobDB;
import cn.bmob.im.util.BmobLog;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.datatype.BmobGeoPoint;
import cn.bmob.v3.listener.UpdateListener;
import cn.bmob.v3.listener.UploadFileListener;
public class MyInfoActivity extends BaseActivity {
private View view;
private TextView tv_set_nick, tv_set_name, tv_set_gender;
private ImageView iv_set_avator;
private RelativeLayout layout_head, layout_nick, layout_gender,layout_change_pwd;
private Button btn_exit_login;
LinearLayout layout_all;
private ImageLoader imageLoader;
private MyLocationManager myLocationManager;
@Override
public void initData() {
view = View.inflate(getApplicationContext(), R.layout.activity_my_info, null);
tv_set_nick = (TextView) view.findViewById(R.id.tv_set_nick);
tv_set_name = (TextView) view.findViewById(R.id.tv_set_name);
tv_set_gender = (TextView) view.findViewById(R.id.tv_set_gender);
iv_set_avator = (ImageView) view.findViewById(R.id.iv_set_avator);
layout_head = (RelativeLayout) view.findViewById(R.id.layout_head);
layout_nick = (RelativeLayout) view.findViewById(R.id.layout_nick);
layout_gender = (RelativeLayout) view.findViewById(R.id.layout_gender);
layout_all = (LinearLayout) view.findViewById(R.id.layout_all);
layout_change_pwd=(RelativeLayout) view.findViewById(R.id.layout_change_pwd);
btn_exit_login=(Button) view.findViewById(R.id.btn_exit_login);
fl_base.addView(view);
tv_title.setText("个人资料");
ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(MyInfoActivity.this));//imageloader必须初始化
myLocationManager=new MyLocationManager(this, userManager); //获取用户的定位信息并上传到bmob
layout_head.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showAvatarPop(); //修改头像
}
});
layout_nick.setOnClickListener(new OnClickListener() {//修改昵称
@Override
public void onClick(View v) { //修改昵称
Intent intentNickChange=new Intent(MyInfoActivity.this,NickChange.class);
startActivity(intentNickChange);
}
});
layout_gender.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showSexChooseDialog(); //修改性别
}
});
layout_change_pwd.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intentPwd=new Intent(MyInfoActivity.this,PwdChangeActivity.class);
startActivity(intentPwd);
}
});
//退出登入
btn_exit_login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("TOUCH", "退出登入");
SharePreferenceUtils.putBoolean(getApplicationContext(), "is_login", false);
final ProgressDialog progress = new ProgressDialog(
MyInfoActivity.this);
progress.setMessage("正在退出登入...");
progress.setCanceledOnTouchOutside(false);
progress.show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
BmobUser.logOut(MyApplication.getContext());//清除缓存用户对象
Intent intent=new Intent(MyInfoActivity.this,LoginActivity.class);
startActivity(intent);
progress.dismiss();
finish();
}
}, 1000);
}
});
}
//初始化我的资料
private void initMeData() {
User user = userManager.getCurrentUser(User.class);
Log.d("TOUCH","hight = "+user.getHight()+",sex= "+user.getSex()+"avar="+user.getAvatar());
updateUser(user); //更新我的资料
SharePreferenceUtils.putBoolean(MyInfoActivity.this, "is_login", true);
SharePreferenceUtils.putString(MyInfoActivity.this, "user_nick", user.getNick());
SharePreferenceUtils.putString(MyInfoActivity.this, "user_account", user.getUsername());
SharePreferenceUtils.putString(MyInfoActivity.this, "avatar", user.getAvatar());
}
//更新我的资料
private void updateUser(User user) {
// 更改
refreshAvatar(user.getAvatar());
tv_set_name.setText(user.getUsername());
tv_set_nick.setText(user.getNick());
tv_set_gender.setText(user.getSex() == true ? "男" : "女");
}
@Override
public void onResume() {
super.onResume();
initMeData();
}
/**
* 设置头像
*/
RelativeLayout layout_choose;
RelativeLayout layout_photo;
PopupWindow avatorPop;
public String filePath = "";
private void showAvatarPop() {
Log.d("TOUCH", "showAvatarPop");
View view = LayoutInflater.from(this).inflate(R.layout.pop_showavator, null);
layout_choose = (RelativeLayout) view.findViewById(R.id.layout_choose);
layout_photo = (RelativeLayout) view.findViewById(R.id.layout_photo);
layout_photo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { // 拍照
Log.d("TOUCH", "拍照click");
File dir = new File(GlobalContants.MyAvatarDir);
if (!dir.exists()) {
dir.mkdirs();
}
// 原图
File file = new File(dir, new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
filePath = file.getAbsolutePath();// 获取相片的保存路径
Uri imageUri = Uri.fromFile(file);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, GlobalContants.REQUESTCODE_UPLOADAVATAR_CAMERA);
}
});
// 从相册中选择
layout_choose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("TOUCH", "相册click");
Intent intent = new Intent(Intent.ACTION_PICK, null);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(intent, GlobalContants.REQUESTCODE_UPLOADAVATAR_LOCATION);
}
});
//PopupWindow这个类用来实现一个弹出框,可以使用任意布局的View作为其内容,这个弹出框是悬浮在当前activity之上的。
avatorPop = new PopupWindow(view, mScreenWidth, 600);
avatorPop.setTouchInterceptor(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
avatorPop.dismiss();
return true; // 这里如果返回true的话,touch事件将被拦截
// 拦截后 PopupWindow的onTouchEvent不被调用,这样点击外部区域无法dismiss
}
return false;
}
});
avatorPop.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
avatorPop.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
avatorPop.setTouchable(true);
avatorPop.setFocusable(true);
avatorPop.setOutsideTouchable(true);
avatorPop.setBackgroundDrawable(new BitmapDrawable());
// 动画效果 从底部弹起
avatorPop.setAnimationStyle(R.style.Animations_GrowFromBottom);
avatorPop.showAtLocation(layout_all, Gravity.BOTTOM, 0, 0);
}
Bitmap newBitmap;
boolean isFromCamera = false;// 区分拍照旋转
int degree = 0;
@Override // activity回调
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case GlobalContants.REQUESTCODE_UPLOADAVATAR_CAMERA:// 拍照修改头像
if (resultCode == RESULT_OK) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
ShowToast("SD不可用");
return;
}
isFromCamera = true;
File file = new File(filePath);
degree = PhotoUtil.readPictureDegree(file.getAbsolutePath());
Log.i("life", "拍照后的角度:" + degree);
startImageAction(Uri.fromFile(file), 200, 200, GlobalContants.REQUESTCODE_UPLOADAVATAR_CROP, true);
}
break;
case GlobalContants.REQUESTCODE_UPLOADAVATAR_LOCATION:// 本地修改头像
if (avatorPop != null) {
avatorPop.dismiss();
}
Uri uri = null;
if (data == null) {
return;
}
if (resultCode == RESULT_OK) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
ShowToast("SD不可用");
return;
}
isFromCamera = false;
uri = data.getData();
startImageAction(uri, 200, 200, GlobalContants.REQUESTCODE_UPLOADAVATAR_CROP, true);
} else {
ShowToast("照片获取失败");
}
break;
case GlobalContants.REQUESTCODE_UPLOADAVATAR_CROP:// 裁剪头像返回
// TODO sent to crop
if (avatorPop != null) {
avatorPop.dismiss();
}
if (data == null) {
// Toast.makeText(this, "取消选择", Toast.LENGTH_SHORT).show();
return;
} else {
saveCropAvator(data);
}
// 初始化文件路径
filePath = "";
// 上传头像
uploadAvatar();
break;
default:
break;
}
}
private void uploadAvatar() {
BmobLog.i("头像地址:" + path);
final BmobFile bmobFile = new BmobFile(new File(path));
bmobFile.upload(this, new UploadFileListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
String url = bmobFile.getFileUrl(MyInfoActivity.this);
// 更新BmobUser对象
updateUserAvatar(url);
}
@Override
public void onProgress(Integer arg0) {
// TODO Auto-generated method stub
}
@Override
public void onFailure(int arg0, String msg) {
// TODO Auto-generated method stub
ShowToast("头像上传失败:" + msg);
}
});
}
private void updateUserAvatar(final String url) {
User u = new User();
u.setAvatar(url);
updateUserData(u, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
ShowToast("头像更新成功!");
// 更新头像
// refreshAvatar(url);
}
@Override
public void onFailure(int code, String msg) {
// TODO Auto-generated method stub
ShowToast("头像更新失败:" + msg);
}
});
}
String path;
/**
* 保存裁剪的头像
*
* @param data
*/
private void saveCropAvator(Intent data) {
Bundle extras = data.getExtras();
if (extras != null) {
Bitmap bitmap = extras.getParcelable("data");
Log.i("life", "avatar - bitmap = " + bitmap);
if (bitmap != null) {
bitmap = PhotoUtil.toRoundCorner(bitmap, 10);
if (isFromCamera && degree != 0) {
bitmap = PhotoUtil.rotaingImageView(degree, bitmap);
}
iv_set_avator.setImageBitmap(bitmap);
// 保存图片
String filename = new SimpleDateFormat("yyMMddHHmmss").format(new Date()) + ".png";
path = GlobalContants.MyAvatarDir + filename;
PhotoUtil.saveBitmap(GlobalContants.MyAvatarDir, filename, bitmap, true);
// 上传头像
if (bitmap != null && bitmap.isRecycled()) {
bitmap.recycle();
}
}
}
}
/**
* @Title: startImageAction @return void @throws
*/
private void startImageAction(Uri uri, int outputX, int outputY, int requestCode, boolean isCrop) {
Intent intent = null;
if (isCrop) {
intent = new Intent("com.android.camera.action.CROP");
} else {
intent = new Intent(Intent.ACTION_GET_CONTENT, null);
}
intent.setDataAndType(uri, "image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", outputX);
intent.putExtra("outputY", outputY);
intent.putExtra("scale", true);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.putExtra("return-data", true);
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
intent.putExtra("noFaceDetection", true);
startActivityForResult(intent, requestCode);
}
// 更新用户数据
private void updateUserData(User user, UpdateListener listener) {
User current = (User) userManager.getCurrentUser(User.class);
user.setObjectId(current.getObjectId());
user.update(this, listener);
}
/**
* 更新头像 refreshAvatar
*
* @return void
* @throws
*/
private void refreshAvatar(String avatar) {
if (avatar != null && !avatar.equals("")) {
ImageLoader.getInstance().displayImage(avatar, iv_set_avator,
ImageLoadOptions.getOptions());
} else {
iv_set_avator.setImageResource(R.drawable.default_head);
}
}
String[] sexs = new String[]{ "男", "女" };
private void showSexChooseDialog() {
new AlertDialog.Builder(this)
.setTitle("单选框")
.setIcon(android.R.drawable.ic_dialog_info)
.setSingleChoiceItems(sexs, 0,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
BmobLog.i("点击的是"+sexs[which]);
updateInfo(which);
dialog.dismiss();
}
})
.setNegativeButton("取消", null)
.show();
}
/** 修改资料
* updateInfo
* @Title: updateInfo
* @return void
* @throws
*/
private void updateInfo(int which) {
final User u = new User();
if(which==0){
u.setSex(true);
}else{
u.setSex(false);
}
updateUserData(u,new UpdateListener() {
@Override
public void onSuccess() {
ShowToast("修改成功");
tv_set_gender.setText(u.getSex() == true ? "男" : "女");
}
@Override
public void onFailure(int arg0, String arg1) {
ShowToast("onFailure:" + arg1);
}
});
}
@Override
public void back() {
finish();
}
}
| [
"919273396@qq.com"
] | 919273396@qq.com |
32695908d83b44963250ffa5b164a1c3f091aa48 | ed189585bbcd2137120a44e1f11574e96670e657 | /chapter_012/src/main/java/ru/job4j/ComputePi.java | 7cabbe458b61bf28afa5a624bf4ded4d9b62e425 | [
"Apache-2.0"
] | permissive | Lummy86/junior | b975c658dac976aedb7b398cdc06e265919bdd20 | 8f13d7c4fa39c14240480b30babbd06c9438a9a6 | refs/heads/master | 2020-06-01T05:16:03.493785 | 2019-05-23T04:01:38 | 2019-05-23T04:01:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | package ru.job4j;
/**
* //TODO add comments.
*
* @author Petr Arsentev (parsentev@yandex.ru)
* @version $Id$
* @since 0.1
*/
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.math.BigDecimal;
public class ComputePi {
public static void main(String args[]) {
try {
String name = "Compute";
Registry registry = LocateRegistry.getRegistry("localhost");
Compute comp = (Compute) registry.lookup(name);
Pi task = new Pi(Integer.parseInt(args[1]));
BigDecimal pi = comp.executeTask(task);
System.out.println(pi);
} catch (Exception e) {
System.err.println("ComputePi exception:");
e.printStackTrace();
}
}
}
| [
"parsentev@yandex.ru"
] | parsentev@yandex.ru |
3faf648a734656d75d5656106178852b883550b6 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/26/26_7a623d34990f8fd215f591f432df456e3683fea6/AppFrame/26_7a623d34990f8fd215f591f432df456e3683fea6_AppFrame_s.java | f46cd4a24f5bea5bbb42c1f5c11a282310d74222 | [] | 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 | 21,313 | java | /**
* Copyright 2007 Wei-ju Wu
*
* This file is part of TinyUML.
*
* TinyUML 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.
*
* TinyUML 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 TinyUML; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.tinyuml.ui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.tinyuml.draw.Label;
import org.tinyuml.draw.LabelChangeListener;
import org.tinyuml.model.UmlModel;
import org.tinyuml.util.AppCommandListener;
import org.tinyuml.umldraw.structure.StructureDiagram;
import org.tinyuml.model.UmlModelImpl;
import org.tinyuml.ui.commands.ModelReader;
import org.tinyuml.ui.commands.ModelWriter;
import org.tinyuml.ui.commands.PngExporter;
import org.tinyuml.ui.commands.SvgExporter;
import org.tinyuml.ui.diagram.DiagramEditor;
import org.tinyuml.ui.diagram.EditorMouseEvent;
import org.tinyuml.ui.diagram.EditorStateListener;
import org.tinyuml.ui.diagram.SelectionListener;
import org.tinyuml.util.ApplicationResources;
import org.tinyuml.util.MethodCall;
/**
* This class implements the Application frame. The top-level UI elements are
* created here. Application events that affect the entire application are
* handled here, local event handlers are also installed.
*
* @author Wei-ju Wu
* @version 1.0
*/
public class AppFrame extends JFrame
implements EditorStateListener, AppCommandListener, SelectionListener {
private JTabbedPane tabbedPane;
private JLabel coordLabel = new JLabel(" ");
private JLabel memLabel = new JLabel(" ");
private UmlModel umlModel;
private DiagramEditor currentEditor;
private transient Timer timer = new Timer();
private transient StaticStructureEditorToolbarManager staticToolbarManager;
private transient EditorCommandDispatcher editorDispatcher;
private transient MainToolbarManager toolbarmanager;
private transient MenuManager menumanager;
private transient File currentFile;
private transient Map<String, MethodCall> selectorMap =
new HashMap<String, MethodCall>();
// Solitud D: Se necesita llevar cuenta de todos los DiagramEditor presentes
// para cada tab. Lo haremos con LinkedList
private LinkedList<DiagramEditor> diagramEditors;
/**
* Reset the transient values for serialization.
* @param stream an ObjectInputStream
* @throws IOException if I/O error occured
* @throws ClassNotFoundException if class was not found
*/
@SuppressWarnings("PMD.UnusedFormalParameter")
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
timer = new Timer();
staticToolbarManager = null;
editorDispatcher = null;
toolbarmanager = null;
menumanager = null;
currentFile = null;
initSelectorMap();
}
/**
* Creates a new instance of AppFrame.
*/
public AppFrame() {
// Solicitud D: debemos inicializar la lista enlazada de DiagramEditor
diagramEditors = new LinkedList<DiagramEditor>();
setTitle(getResourceString("application.title"));
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
editorDispatcher = new EditorCommandDispatcher(this);
getContentPane().add(createEditorArea(), BorderLayout.CENTER);
installMainToolbar();
installMenubar();
installStatusbar();
addWindowListener(new WindowAdapter() {
/**
* {@inheritDoc}
*/
public void windowClosing(WindowEvent e) {
quitApplication();
}
});
newModel();
pack();
scheduleMemTimer();
initSelectorMap();
//setExtendedState(JFrame.MAXIMIZED_BOTH);
}
/**
* Returns the currently displayed editor.
* @return the current editor
*/
public DiagramEditor getCurrentEditor() {
// cambio Solicitud D: Pedimos el ndice del nuevo tab
// y obtenemos el editor actual desde nuestra lista enlazada
// con el ndice entregado
int currentTabIndex = tabbedPane.getSelectedIndex();
return diagramEditors.get(currentTabIndex);
}
/**
* Returns the menu manager.
* @return the menu manager
*/
public MenuManager getMenuManager() {
return menumanager;
}
/**
* Creates the tabbed pane for the editor area.
* @return the tabbed pane
*/
private JTabbedPane createEditorArea() {
tabbedPane = new JTabbedPane();
tabbedPane.setPreferredSize(new Dimension(800, 600));
return tabbedPane;
}
/**
* Creates an editor for the specified diagram and adds it to the tabbed
* pane.
* @param diagram the diagram
*/
private void createEditor(StructureDiagram diagram) {
currentEditor = new DiagramEditor(this, diagram);
currentEditor.addEditorStateListener(this);
currentEditor.addSelectionListener(this);
currentEditor.addAppCommandListener(editorDispatcher);
currentEditor.addAppCommandListener(this);
JScrollPane spane = new JScrollPane(currentEditor);
// Solicitud D: debemos llevar la cuenta de todos los DiagramEditor
// en nuestra LinkedList (variable de I. diagramEditors)
diagramEditors.add(currentEditor);
JPanel editorPanel = new JPanel(new BorderLayout());
spane.getVerticalScrollBar().setUnitIncrement(10);
spane.getHorizontalScrollBar().setUnitIncrement(10);
staticToolbarManager = new StaticStructureEditorToolbarManager();
JToolBar toolbar = staticToolbarManager.getToolbar();
staticToolbarManager.addCommandListener(editorDispatcher);
editorPanel.add(spane, BorderLayout.CENTER);
editorPanel.add(toolbar, BorderLayout.NORTH);
final Component comp = tabbedPane.add(diagram.getLabelText(), editorPanel);
diagram.addNameLabelChangeListener(new LabelChangeListener() {
/** {@inheritDoc} */
public void labelTextChanged(Label label) {
tabbedPane.setTitleAt(tabbedPane.indexOfComponent(comp),
label.getText());
}
});
}
/**
* Adds the tool bar.
*/
private void installMainToolbar() {
toolbarmanager = new MainToolbarManager();
toolbarmanager.addCommandListener(this);
toolbarmanager.addCommandListener(editorDispatcher);
getContentPane().add(toolbarmanager.getToolbar(), BorderLayout.NORTH);
}
/**
* Adds the menubar.
*/
private void installMenubar() {
menumanager = new MenuManager();
menumanager.addCommandListener(this);
menumanager.addCommandListener(editorDispatcher);
setJMenuBar(menumanager.getMenuBar());
}
/**
* Adds a status bar.
*/
private void installStatusbar() {
JPanel statusbar = new JPanel(new BorderLayout());
statusbar.add(coordLabel, BorderLayout.WEST);
statusbar.add(memLabel, BorderLayout.EAST);
getContentPane().add(statusbar, BorderLayout.SOUTH);
}
/**
* Returns the specified resource as a String object.
* @param property the property name
* @return the property value
*/
private String getResourceString(String property) {
return ApplicationResources.getInstance().getString(property);
}
// ************************************************************************
// **** Event listeners
// *****************************************
// ************************************************************************
// **** EditorStateListener
// *****************************************
/**
* {@inheritDoc}
*/
public void mouseMoved(EditorMouseEvent event) {
coordLabel.setText(String.format("(%.1f, %.1f)", event.getX(),
event.getY()));
}
/**
* {@inheritDoc}
*/
public void stateChanged(DiagramEditor editor) {
updateMenuAndToolbars(editor);
}
/**
* {@inheritDoc}
*/
public void elementAdded(DiagramEditor editor) {
// spring loading is implemented here
staticToolbarManager.doClick("SELECT_MODE");
updateMenuAndToolbars(editor);
}
/**
* {@inheritDoc}
*/
public void elementRemoved(DiagramEditor editor) {
updateMenuAndToolbars(editor);
}
/**
* Query the specified editor state and set the menu and the toolbars
* accordingly.
* @param editor the editor
*/
private void updateMenuAndToolbars(DiagramEditor editor) {
menumanager.enableMenuItem("UNDO", editor.canUndo());
menumanager.enableMenuItem("REDO", editor.canRedo());
toolbarmanager.enableButton("UNDO", editor.canUndo());
toolbarmanager.enableButton("REDO", editor.canRedo());
}
// ************************************************************************
// **** SelectionListener
// *****************************************
/**
* {@inheritDoc}
*/
public void selectionStateChanged() {
boolean hasSelection = getCurrentEditor().getSelectedElements().size() > 0;
/*
menumanager.enableMenuItem("CUT", hasSelection);
menumanager.enableMenuItem("COPY", hasSelection);
*/
menumanager.enableMenuItem("DELETE", hasSelection);
/*
toolbarmanager.enableButton("CUT", hasSelection);
toolbarmanager.enableButton("COPY", hasSelection);
*/
toolbarmanager.enableButton("DELETE", hasSelection);
}
// ************************************************************************
// **** CommandListener
// *****************************************
/**
* Initializes the selector map.
*/
private void initSelectorMap() {
try {
selectorMap.put("NEW_MODEL", new MethodCall(
getClass().getMethod("newModel")));
selectorMap.put("OPEN_MODEL", new MethodCall(
getClass().getMethod("openModel")));
selectorMap.put("SAVE_AS", new MethodCall(
getClass().getMethod("saveAs")));
selectorMap.put("SAVE", new MethodCall(
getClass().getMethod("save")));
selectorMap.put("EXPORT_GFX", new MethodCall(
getClass().getMethod("exportGfx")));
selectorMap.put("DELETE", new MethodCall(
getClass().getMethod("delete")));
selectorMap.put("EDIT_SETTINGS", new MethodCall(
getClass().getMethod("editSettings")));
selectorMap.put("QUIT", new MethodCall(
getClass().getMethod("quitApplication")));
selectorMap.put("ABOUT", new MethodCall(
getClass().getMethod("about")));
selectorMap.put("HELP_CONTENTS", new MethodCall(
getClass().getMethod("displayHelpContents")));
} catch (NoSuchMethodException ex) {
ex.printStackTrace();
}
}
/**
* {@inheritDoc}
*/
public void handleCommand(String command) {
MethodCall methodcall = selectorMap.get(command);
if (methodcall != null) {
methodcall.call(this);
} else {
System.out.println("not handled: " + command);
}
}
/**
* Call this method to exit this application in a clean way.
*/
public void quitApplication() {
if (canQuit()) {
timer.cancel();
timer.purge();
dispose();
Thread.currentThread().interrupt();
}
}
/**
* Checks if application can be quit safely.
* @return true if can quit safely, false otherwise
*/
private boolean canQuit() {
if (currentEditor.canUndo()) {
return JOptionPane.showConfirmDialog(this,
ApplicationResources.getInstance().getString("confirm.quit.message"),
ApplicationResources.getInstance().getString("confirm.quit.title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
return true;
}
/**
* Opens the settings editor.
*/
public void editSettings() {
System.out.println("EDIT SETTINGS");
}
/**
* Creates a new model.
*/
public void newModel() {
if (canCreateNewModel()) {
umlModel = new UmlModelImpl();
StructureDiagram diagram = new StructureDiagram(umlModel);
umlModel.addDiagram(diagram);
diagram.setLabelText("Class diagram 1");
// Cambio Solicitud D: Veremos qu pasa si no removemos todo y en vez de eso
// solo agregamos un nuevo Tab
/* tabbedPane.removeAll(); */
createEditor(diagram);
}
}
/**
* Determines if a new model can be created.
* @return true the model can be created, false otherwise
*/
private boolean canCreateNewModel() {
if (currentEditor != null && currentEditor.canUndo()) {
return JOptionPane.showConfirmDialog(this,
ApplicationResources.getInstance().getString("confirm.new.message"),
ApplicationResources.getInstance().getString("confirm.new.title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
return true;
}
/**
* Sets up and starts the timer task.
*/
private void scheduleMemTimer() {
TimerTask task = new TimerTask() {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
memLabel.setText(getMemString());
}
});
}
};
// every 5 seconds
timer.schedule(task, 2000, 5000);
}
/**
* Creates the memory information string.
* @return the memory status string
*/
private String getMemString() {
long free = Runtime.getRuntime().freeMemory();
long total = Runtime.getRuntime().totalMemory();
long used = total - free;
used /= (1024 * 1024);
total /= (1024 * 1024);
return String.format("used: %dM total: %dM ", used, total);
}
/**
* Exports graphics as SVG.
*/
public void exportGfx() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle(getResourceString("dialog.exportgfx.title"));
FileNameExtensionFilter svgFilter = new FileNameExtensionFilter(
"Scalable Vector Graphics file (*.svg)", "svg");
FileNameExtensionFilter pngFilter = new FileNameExtensionFilter(
"Portable Network Graphics file (*.png)", "png");
fileChooser.addChoosableFileFilter(svgFilter);
fileChooser.addChoosableFileFilter(pngFilter);
fileChooser.setAcceptAllFileFilterUsed(false);
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
if (fileChooser.getFileFilter() == svgFilter) {
try {
SvgExporter exporter = new SvgExporter();
exporter.writeSVG(getCurrentEditor(), fileChooser.getSelectedFile());
} catch (IOException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(),
getResourceString("error.exportgfx.title"),
JOptionPane.ERROR_MESSAGE);
}
} else if (fileChooser.getFileFilter() == pngFilter) {
try {
PngExporter exporter = new PngExporter();
exporter.writePNG(getCurrentEditor(), fileChooser.getSelectedFile());
} catch (IOException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(),
getResourceString("error.exportgfx.title"),
JOptionPane.ERROR_MESSAGE);
}
}
}
}
/**
* Returns the FileFilter for the TinyUML serialized model files.
* @return the FileFilter
*/
private FileNameExtensionFilter createModelFileFilter() {
return new FileNameExtensionFilter(
"TinyUML serialized model file (*.tsm)", "tsm");
}
/**
* Opens a TinyUML model.
*/
public void openModel() {
if (canOpen()) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle(getResourceString("dialog.openmodel.title"));
fileChooser.addChoosableFileFilter(createModelFileFilter());
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
currentFile = fileChooser.getSelectedFile();
umlModel = ModelReader.getInstance().readModel(currentFile);
tabbedPane.removeAll();
createEditor((StructureDiagram) umlModel.getDiagrams().get(0));
updateFrameTitle();
} catch (IOException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(),
getResourceString("error.readfile.title"),
JOptionPane.ERROR_MESSAGE);
}
}
}
}
/**
* Checks if application can be quit safely.
* @return true if can quit safely, false otherwise
*/
private boolean canOpen() {
if (currentEditor.canUndo()) {
return JOptionPane.showConfirmDialog(this,
ApplicationResources.getInstance().getString("confirm.open.message"),
ApplicationResources.getInstance().getString("confirm.open.title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
return true;
}
/**
* Saves the model with a file chooser.
*/
public void saveAs() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle(getResourceString("dialog.saveas.title"));
fileChooser.addChoosableFileFilter(createModelFileFilter());
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
currentFile = saveModelFile(fileChooser.getSelectedFile());
updateFrameTitle();
}
}
/**
* Saves immediately if possible.
*/
public void save() {
if (currentFile == null) {
saveAs();
} else {
saveModelFile(currentFile);
}
}
/**
* Writes the current model file. The returned file is different if the input
* file does not have the tsm extension.
* @param file the file to write
* @return the file that was written
*/
private File saveModelFile(File file) {
File result = null;
try {
result = ModelWriter.getInstance().writeModel(this, file, umlModel);
currentEditor.clearUndoManager();
updateMenuAndToolbars(currentEditor);
} catch (IOException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, ex.getMessage(),
getResourceString("error.savefile.title"), JOptionPane.ERROR_MESSAGE);
}
return result;
}
/**
* Sets the frame title according to the current working file.
*/
private void updateFrameTitle() {
if (currentFile != null) {
setTitle(ApplicationResources.getInstance()
.getString("application.title") + " [" + currentFile.getName() + "]");
} else {
setTitle(ApplicationResources.getInstance()
.getString("application.title"));
}
}
/**
* Deletes the current selection.
*/
public void delete() {
getCurrentEditor().deleteSelection();
}
/**
* Shows the about dialog.
*/
public void about() {
JOptionPane.showMessageDialog(this, getResourceString("dialog.about.text"),
getResourceString("dialog.about.title"), JOptionPane.INFORMATION_MESSAGE);
}
/**
* Displays the help contents.
*/
public void displayHelpContents() {
try {
URI helpUri = new URI("http://www.tinyuml.org/Wikka/UserDocs");
Desktop.getDesktop().browse(helpUri);
} catch (IOException ex) {
JOptionPane.showMessageDialog(this,
getResourceString("error.nohelp.message"),
getResourceString("error.nohelp.title"),
JOptionPane.ERROR_MESSAGE);
} catch (URISyntaxException ignore) {
ignore.printStackTrace();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f95e730568ae1dded01d178a1b5a50712e641aa9 | a5a5430a63056e3e9d3c56494ac1ff06bedcc2d6 | /WonderfulParty/gen/com/example/wonderfulparty/BuildConfig.java | b43e9dfe41d475160509dc1f317b4b563c8cfb4f | [] | no_license | dovefairy/WonderfulParty | bd7447ece7996965dc6ba2a8ccac5dc7ca87cfbc | b9cbf34f470864cf65be7932091794577436056d | refs/heads/master | 2020-05-18T10:53:55.274961 | 2015-08-07T12:45:22 | 2015-08-07T12:45:22 | 40,359,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.wonderfulparty;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"18246449934@163.com"
] | 18246449934@163.com |
dacc78c8dd02f9a3d0c937a6a62b21ce4e61ca63 | 3e9c34c3abe6b061411f1baeaefa39ed73068ce0 | /memberBackend/product/src/main/java/com/duyansoft/member/service/OperService.java | 111fa393031d2733cd922915633f23fb4bd6f605 | [] | no_license | HiNeil/bnx-member | 1adda52216c39567005282616ac652507372f14a | cef44015881e3b2e9edbbf6085934041260e5c28 | refs/heads/master | 2021-01-17T22:02:08.248776 | 2016-02-20T14:33:49 | 2016-02-20T14:33:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | /**
*
*/
package com.duyansoft.member.service;
import com.duyansoft.member.common.EventParam;
/**
* @Package com.guozha.oms.web.controller.user
* @Description: TODO
* @author sunhanbin
* @date 2015-9-20下午9:18:03
*/
public interface OperService {
/**
* 创建root用户
*
* @author Frank
* @date 2015-9-21 下午1:54:11
* @param param
* @return void
*/
public void createRootUser(EventParam params);
/**
* 操作员登录
*
* @author Frank
* @date 2015-9-21 下午2:40:01
* @param params
* @return void
*/
public void login(EventParam params);
/**
* 创建用户
*
* @Description
* @author sunhanbin
* @date 2015-12-5下午9:13:34
* @param params
*/
public void create(EventParam params);
}
| [
"sunangie@126.com"
] | sunangie@126.com |
847d5323dbbcaba3d5c621a96848ae00a6ab8eb0 | 1ccd7ff8c14d0b3d5003f544205dc64ef6c4a5f0 | /src/main/java/com/book/dao/UserDao.java | e3d4f980bbdaf103652c0b01e2f3066cb660534c | [] | no_license | heihuafeifahui/book | cdd0b92f91720cee23746381aa630df8e9ad796f | 69b6b59a2d4e244aa0d3368506f4b8e88d929890 | refs/heads/master | 2022-03-26T07:08:16.384438 | 2017-11-29T07:59:35 | 2017-11-29T07:59:35 | 106,782,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,913 | java | package com.book.dao;
import java.util.List;
import javax.transaction.Transactional;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Filter;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Component;
import com.book.domain.User;
@Component
@Transactional
public class UserDao extends BaseDao<User>{
public void save(User instance) {
log.debug("saving User instance");
try {
getSession().save(instance);
log.debug("save successful");
}catch(RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void updata(User instance) {
log.debug("updata User instance");
try {
getSession().update(instance);
log.debug("update successful");
}catch (RuntimeException re) {
log.error("update filed", re);
throw re;
}
}
public void delete(User instance) {
log.debug("deleting User instance");
try {
getSession().delete(instance);
log.debug("delete successful");
}catch(RuntimeException re) {
log.error("delete failed",re);
throw re;
}
}
public User findById(String id) {
log.debug("getting User instance with id :" + id);
try {
User instance=getSession().get(User.class, id);
return instance;
}catch(RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public User findById(String mid,String id) {
log.debug("getting User instance with id: " + id);
try {
//构造离线查询
DetachedCriteria dc=DetachedCriteria.forClass(User.class);
Session session=getSession();
//判断mid是否为空
if(!StringUtils.isNotBlank(mid)) {
mid= "";
}
//通过session创建过滤器过滤好友
Filter filter=session.enableFilter("user_myfriends");
//设置过滤器参数用户自我id关联
filter.setParameter("uid", mid);
//添加查询条件数据库查询"id"是否与id相等
dc.add(Property.forName("id").eq(id));
//将criteria.list()赋值给users
List<User> users=findAllByCriteria(session, dc);
try {
//获得第一条元素
return users.get(0);
}catch(Exception e) {
return null;
}
}catch(RuntimeException re) {
log.error("get failed",re);
throw re;
}
}
public User findByAccount(String account) {
try {
DetachedCriteria dc=DetachedCriteria.forClass(User.class);
//disunction组合一组逻辑或【or】条件
Disjunction dis=Restrictions.disjunction();
//判断账号是否相等
dis.add(Property.forName("account").eq(account));
//增加查询条件
dc.add(dis);
List<User> list=findAllByCriteria(dc);
try {
return list.get(0);
}catch(Exception e) {
return null;
}
}catch(RuntimeException re) {
log.error("merge failed",re);
throw re;
}
}
}
| [
"1156679632@qq.com"
] | 1156679632@qq.com |
77ff2853c85dcc3c878ac2b7d5f3720a296dadd0 | cbe40fced99785b62eca2d77f9f7451d1e6dd6af | /httpdns_android_demo/src/main/java/alibaba/httpdns_android_demo/WebviewActivity.java | eb9c61bb4898501bf7be6115371e19ab5817ed11 | [] | no_license | zhangxin8105/alicloud-android-demo | d593fd4c958c2d8acfd5c141b4495e568133beb9 | 9c97dacefd02c954857fc9f2949d19725744be4b | refs/heads/master | 2021-07-13T20:39:57.059947 | 2017-10-17T01:58:27 | 2017-10-17T01:58:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,376 | java | package alibaba.httpdns_android_demo;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.net.SSLCertificateSocketFactory;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.alibaba.sdk.android.httpdns.HttpDns;
import com.alibaba.sdk.android.httpdns.HttpDnsService;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
public class WebviewActivity extends Activity {
private WebView webView;
private static final String targetUrl = "http://www.apple.com";
private static final String TAG = "WebviewScene";
private static HttpDnsService httpdns;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo_activity_webview);
// 初始化httpdns
httpdns = HttpDns.getService(getApplicationContext(), MainActivity.accountID);
// 预解析热点域名
httpdns.setPreResolveHosts(new ArrayList<>(Arrays.asList("www.apple.com")));
webView = (WebView) this.findViewById(R.id.wv_container);
webView.setWebViewClient(new WebViewClient() {
@SuppressLint("NewApi")
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String scheme = request.getUrl().getScheme().trim();
String method = request.getMethod();
Map<String, String> headerFields = request.getRequestHeaders();
String url = request.getUrl().toString();
Log.e(TAG, "url:" + url);
// 无法拦截body,拦截方案只能正常处理不带body的请求;
if ((scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https"))
&& method.equalsIgnoreCase("get")) {
try {
URLConnection connection = recursiveRequest(url, headerFields, null);
if (connection == null) {
Log.e(TAG, "connection null");
return super.shouldInterceptRequest(view, request);
}
// 注*:对于POST请求的Body数据,WebResourceRequest接口中并没有提供,这里无法处理
String contentType = connection.getContentType();
String mime = getMime(contentType);
String charset = getCharset(contentType);
Log.e(TAG, "code:" + ((HttpURLConnection)connection).getResponseCode());
Log.e(TAG, "mime:" + mime + "; charset:" + charset);
// 无mime类型的请求不拦截
if (TextUtils.isEmpty(mime)) {
Log.e(TAG, "no MIME");
return super.shouldInterceptRequest(view, request);
} else {
if (!TextUtils.isEmpty(charset)) {
return new WebResourceResponse(mime, charset, connection.getInputStream());
} else {
// 二进制资源无需编码信息
if (isBinaryRes(mime)) {
Log.e(TAG, "binary resource for " + mime);
return new WebResourceResponse(mime, charset, connection.getInputStream());
} else {
Log.e(TAG, "non binary resource for " + mime);
return super.shouldInterceptRequest(view, request);
}
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return super.shouldInterceptRequest(view, request);
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
// API < 21 只能拦截URL参数
return super.shouldInterceptRequest(view, url);
}
});
webView.loadUrl(targetUrl);
}
/**
* 从contentType中获取MIME类型
* @param contentType
* @return
*/
private String getMime(String contentType) {
if (contentType == null) {
return null;
}
return contentType.split(";")[0];
}
/**
* 从contentType中获取编码信息
* @param contentType
* @return
*/
private String getCharset(String contentType) {
if (contentType == null) {
return null;
}
String[] fields = contentType.split(";");
if (fields.length <= 1) {
return null;
}
String charset = fields[1];
if (!charset.contains("=")) {
return null;
}
charset = charset.substring(charset.indexOf("=") + 1);
return charset;
}
/**
* 是否是二进制资源,二进制资源可以不需要编码信息
* @param mime
* @return
*/
private boolean isBinaryRes(String mime) {
if (mime.startsWith("image")
|| mime.startsWith("audio")
|| mime.startsWith("video")) {
return true;
} else {
return false;
}
}
/**
* header中是否含有cookie
* @param headers
*/
private boolean containCookie(Map<String, String> headers) {
for (Map.Entry<String, String> headerField : headers.entrySet()) {
if (headerField.getKey().contains("Cookie")) {
return true;
}
}
return false;
}
public URLConnection recursiveRequest(String path, Map<String, String> headers, String reffer) {
HttpURLConnection conn;
URL url = null;
try {
url = new URL(path);
conn = (HttpURLConnection) url.openConnection();
// 异步接口获取IP
String ip = httpdns.getIpByHostAsync(url.getHost());
if (ip != null) {
// 通过HTTPDNS获取IP成功,进行URL替换和HOST头设置
Log.d(TAG, "Get IP: " + ip + " for host: " + url.getHost() + " from HTTPDNS successfully!");
String newUrl = path.replaceFirst(url.getHost(), ip);
conn = (HttpURLConnection) new URL(newUrl).openConnection();
if (headers != null) {
for (Map.Entry<String, String> field : headers.entrySet()) {
conn.setRequestProperty(field.getKey(), field.getValue());
}
}
// 设置HTTP请求头Host域
conn.setRequestProperty("Host", url.getHost());
} else {
return null;
}
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
conn.setInstanceFollowRedirects(false);
if (conn instanceof HttpsURLConnection) {
final HttpsURLConnection httpsURLConnection = (HttpsURLConnection)conn;
WebviewTlsSniSocketFactory sslSocketFactory = new WebviewTlsSniSocketFactory((HttpsURLConnection) conn);
// sni场景,创建SSLScocket
httpsURLConnection.setSSLSocketFactory(sslSocketFactory);
// https场景,证书校验
httpsURLConnection.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
String host = httpsURLConnection.getRequestProperty("Host");
if (null == host) {
host = httpsURLConnection.getURL().getHost();
}
return HttpsURLConnection.getDefaultHostnameVerifier().verify(host, session);
}
});
}
int code = conn.getResponseCode();// Network block
if (needRedirect(code)) {
// 原有报头中含有cookie,放弃拦截
if (containCookie(headers)) {
return null;
}
String location = conn.getHeaderField("Location");
if (location == null) {
location = conn.getHeaderField("location");
}
if (location != null) {
if (!(location.startsWith("http://") || location
.startsWith("https://"))) {
//某些时候会省略host,只返回后面的path,所以需要补全url
URL originalUrl = new URL(path);
location = originalUrl.getProtocol() + "://"
+ originalUrl.getHost() + location;
}
Log.e(TAG, "code:" + code + "; location:" + location + "; path" + path);
return recursiveRequest(location, headers, path);
} else {
// 无法获取location信息,让浏览器获取
return null;
}
} else {
// redirect finish.
Log.e(TAG, "redirect finish");
return conn;
}
} catch (MalformedURLException e) {
Log.w(TAG, "recursiveRequest MalformedURLException");
} catch (IOException e) {
Log.w(TAG, "recursiveRequest IOException");
} catch (Exception e) {
Log.w(TAG, "unknow exception");
}
return null;
}
private boolean needRedirect(int code) {
return code >= 300 && code < 400;
}
class WebviewTlsSniSocketFactory extends SSLSocketFactory {
private final String TAG = WebviewTlsSniSocketFactory.class.getSimpleName();
HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
private HttpsURLConnection conn;
public WebviewTlsSniSocketFactory(HttpsURLConnection conn) {
this.conn = conn;
}
@Override
public Socket createSocket() throws IOException {
return null;
}
@Override
public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
return null;
}
@Override
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException {
return null;
}
@Override
public Socket createSocket(InetAddress host, int port) throws IOException {
return null;
}
@Override
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
return null;
}
// TLS layer
@Override
public String[] getDefaultCipherSuites() {
return new String[0];
}
@Override
public String[] getSupportedCipherSuites() {
return new String[0];
}
@Override
public Socket createSocket(Socket plainSocket, String host, int port, boolean autoClose) throws IOException {
String peerHost = this.conn.getRequestProperty("Host");
if (peerHost == null)
peerHost = host;
Log.i(TAG, "customized createSocket. host: " + peerHost);
InetAddress address = plainSocket.getInetAddress();
if (autoClose) {
// we don't need the plainSocket
plainSocket.close();
}
// create and connect SSL socket, but don't do hostname/certificate verification yet
SSLCertificateSocketFactory sslSocketFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory.getDefault(0);
SSLSocket ssl = (SSLSocket) sslSocketFactory.createSocket(address, port);
// enable TLSv1.1/1.2 if available
ssl.setEnabledProtocols(ssl.getSupportedProtocols());
// set up SNI before the handshake
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Log.i(TAG, "Setting SNI hostname");
sslSocketFactory.setHostname(ssl, peerHost);
} else {
Log.d(TAG, "No documented SNI support on Android <4.2, trying with reflection");
try {
java.lang.reflect.Method setHostnameMethod = ssl.getClass().getMethod("setHostname", String.class);
setHostnameMethod.invoke(ssl, peerHost);
} catch (Exception e) {
Log.w(TAG, "SNI not useable", e);
}
}
// verify hostname and certificate
SSLSession session = ssl.getSession();
if (!hostnameVerifier.verify(peerHost, session))
throw new SSLPeerUnverifiedException("Cannot verify hostname: " + peerHost);
Log.i(TAG, "Established " + session.getProtocol() + " connection with " + session.getPeerHost() +
" using " + session.getCipherSuite());
return ssl;
}
}
}
| [
"503361483@qq.com"
] | 503361483@qq.com |
d200653b01dde4ef8878e7484a2130ac990b4a36 | f4a4700463c3341293b348e09c23542eef7b3405 | /src/main/java/jacamo/web/implementation/WebImplOrg.java | 2386b460eb72a21f38675af16d703bb926d55292 | [] | no_license | jacamo-lang/jacamo-web | 8858ea9d2eb0a0f5674fb66d26fbc229022b0e83 | 4727f62b7aeaaa609846f6268f14fa6277bdccda | refs/heads/master | 2023-07-24T11:39:42.091743 | 2023-07-19T20:22:50 | 2023-07-19T20:22:50 | 181,954,269 | 7 | 13 | null | 2023-07-19T20:22:52 | 2019-04-17T19:19:20 | JavaScript | UTF-8 | Java | false | false | 3,014 | java | package jacamo.web.implementation;
import java.util.Optional;
import javax.inject.Singleton;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import jacamo.rest.implementation.RestImplOrg;
import moise.os.OS;
import moise.os.ns.Norm;
import ora4mas.nopl.GroupBoard;
import ora4mas.nopl.OrgBoard;
import ora4mas.nopl.SchemeBoard;
@Singleton
@Path("/organisations")
public class WebImplOrg extends RestImplOrg {
@Override
protected void configure() {
bind(new WebImplOrg()).to(WebImplOrg.class);
}
/**
* Disband all organisations.
*
* @return HTTP 200 Response (ok status) or 500 Internal Server Error in case of
* error (based on https://tools.ietf.org/html/rfc7231#section-6.6.1)
*/
@DELETE
@Produces(MediaType.TEXT_PLAIN)
public Response disbandAllOrganisations() {
try {
//precisa ter um agente dando comando
//destruir atraves do orgboard, nao dos grupos...
Optional<OrgBoard> ob = OrgBoard.getOrbBoards().stream().findFirst();
OS os = OS.loadOSFromURI(ob.get().getOSFile());
for (GroupBoard gb : GroupBoard.getGroupBoards()) {
System.out.println("group: " + gb.toString());
gb.destroy();
}
for (SchemeBoard sb : SchemeBoard.getSchemeBoards()) {
System.out.println("scheme: " + sb.toString());
sb.destroy();
}
for (Norm n : os.getNS().getNorms()) {
System.out.println("norm: " + n.toString());
os.getNS().removeNorms(n.getRole());
}
/*
List<String> organisationalArtifacts = Arrays.asList("ora4mas.nopl.GroupBoard", "ora4mas.nopl.OrgBoard",
"ora4mas.nopl.SchemeBoard", "ora4mas.nopl.NormativeBoard", "ora4mas.light.LightOrgBoard",
"ora4mas.light.LightNormativeBoard", "ora4mas.light.LightGroupBoard",
"ora4mas.light.LightSchemeBoard");
TranslEnv tEnv = new TranslEnv();
for (String wrksName : tEnv.getWorkspaces()) {
for (ArtifactId aid : CartagoService.getController(wrksName).getCurrentArtifacts()) {
if (organisationalArtifacts.contains(aid.getArtifactType())) {
System.out.println("disbanding : " + aid.getName());
//CartagoService.getController(wrksName).removeArtifact(aid.getName());
} else {
System.out.println("maintaining: " + aid.getName());
}
}
}
*/
return Response.ok().entity("Organisations disbanded!").build();
} catch (Exception e) {
e.printStackTrace();
}
return Response.status(500).build();
}
}
| [
"cleberjamaral@gmail.com"
] | cleberjamaral@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.