blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea1477954b232923d0f7f0e33ae3d7b4c8ac06e0 | f99ade6d51a94e5c169109b7f8b64552be370f1a | /sdkui/src/main/java/com/payu/payuui/Fragment/SavedCardItemFragment.java | 3ee6542172a04e530799e66199e8bf1999a85c90 | [] | no_license | mohanarchu/MvFinal | d665b29b4485f26f54c71ec74b130f3e80857102 | abe267ae535e2a9fc3f328e625a5d7614d0b4ceb | refs/heads/master | 2021-05-17T02:56:24.967169 | 2020-08-03T04:46:08 | 2020-08-03T04:46:08 | 250,586,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,675 | java | package com.payu.payuui.Fragment;
/**
* Created by ankur on 8/24/15.
*/
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.payu.india.Model.StoredCard;
import com.payu.india.Payu.PayuConstants;
import com.payu.india.Payu.PayuUtils;
import com.payu.payuui.R;
import com.payu.payuui.SdkuiUtil.SdkUIConstants;
import java.util.HashMap;
public final class SavedCardItemFragment extends Fragment {
private StoredCard mStoredCard;
private PayuUtils mPayuUtils;
private EditText cvvEditText;
private String issuingBankStatus;
private TextView issuingBankDownText;
private TextView cvvTextView;
private Boolean oneClickPayment;
private ViewPager mViewPager;
private CheckBox enableOneClickPayment;
private int position;
private Boolean isCvvValid = false;
HashMap<String, String> oneClickCardTokens;
public SavedCardItemFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getArguments();
mStoredCard = bundle.getParcelable(PayuConstants.STORED_CARD);
issuingBankStatus = bundle.getString(SdkUIConstants.ISSUING_BANK_STATUS);
oneClickPayment = bundle.getBoolean(PayuConstants.ONE_CLICK_PAYMENT);
position = bundle.getInt(SdkUIConstants.POSITION);
oneClickCardTokens = (HashMap<String, String>) bundle.getSerializable(PayuConstants.ONE_CLICK_CARD_TOKENS);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.layout_saved_card, null);
mViewPager = (ViewPager) container;
issuingBankDownText = (TextView) view.findViewById(R.id.text_view_saved_card_bank_down_error);
mPayuUtils = new PayuUtils();
cvvEditText = (EditText) view.findViewById(R.id.edit_text_cvv);
enableOneClickPayment = (CheckBox) view.findViewById(R.id.check_box_save_card_enable_one_click_payment);
cvvTextView = (TextView) view.findViewById(R.id.cvv_text_view);
// saveCvvLinearlayout = (LinearLayout) view.findViewById(R.id.layout_save_cvv_checkbox);
if (mStoredCard.getCardBrand().equals("AMEX")) {
cvvEditText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(4)});
}
{
enableOneClickPayment.setVisibility(View.VISIBLE);
}
if (mStoredCard.getMaskedCardNumber().length() == 19 && mStoredCard.getCardBrand() == "SMAE") {
cvvEditText.setVisibility(View.GONE);
}
cvvEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String cvv = s.toString();
ViewPager activityViewPager = (ViewPager) getActivity().findViewById(R.id.pager);
if (position == mViewPager.getCurrentItem() && activityViewPager.getCurrentItem() == 0) {// hardcoded 0, try to remove it
if ((mPayuUtils.validateCvv(mStoredCard.getCardBin(), cvv) && !cvv.equals("")) || cvvEditText.getVisibility() == View.GONE) {
getActivity().findViewById(R.id.button_pay_now).setEnabled(true);
isCvvValid = true;
} else {
getActivity().findViewById(R.id.button_pay_now).setEnabled(false);
isCvvValid = false;
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
((TextView) view.findViewById(R.id.text_view_masked_card_number)).setText(mStoredCard.getMaskedCardNumber());
((TextView) view.findViewById(R.id.text_view_card_name)).setText(mStoredCard.getCardName());
((TextView) view.findViewById(R.id.text_view_card_mode)).setText(mStoredCard.getCardMode());
((ImageView) view.findViewById(R.id.card_type_image)).setImageResource(getIssuerImage(mStoredCard.getCardBrand()));
if(getIssuingBankImage(mStoredCard.getIssuingBank()) != 0)
((ImageView) view.findViewById(R.id.bank_image)).setImageResource(getIssuingBankImage(mStoredCard.getIssuingBank()));
if (issuingBankStatus.equals("") == false) {
issuingBankDownText.setVisibility(View.VISIBLE);
issuingBankDownText.setText(issuingBankStatus);
} else {
issuingBankDownText.setVisibility(View.GONE);
}
return view;
}
static Drawable getDrawableUI(Context context,int resID) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
return context.getResources().getDrawable(resID);
} else {
return context.getResources().getDrawable(resID, context.getTheme());
}
}
private int getIssuingBankImage(String issuingBank) {
int resID = getResources().getIdentifier(issuingBank.toLowerCase(), "drawable", getActivity().getPackageName());
if (resID == 0)
return 0;
else
return resID;
}
private int getIssuerImage(String issuer) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
switch (issuer) {
case PayuConstants.VISA:
return R.drawable.logo_visa;
case PayuConstants.LASER:
return R.drawable.laser;
case PayuConstants.DISCOVER:
return R.drawable.discover;
case SdkUIConstants.MAESTRO:
return R.drawable.mas_icon;
case PayuConstants.MASTERCARD:
return R.drawable.mc_icon;
case PayuConstants.AMEX:
return R.drawable.amex;
case PayuConstants.DINR:
return R.drawable.diner;
case PayuConstants.JCB:
return R.drawable.jcb;
case PayuConstants.SMAE:
return R.drawable.maestro;
case PayuConstants.RUPAY:
return R.drawable.rupay;
}
return 0;
} else {
switch (issuer) {
case PayuConstants.VISA:
return R.drawable.logo_visa;
case PayuConstants.LASER:
return R.drawable.laser;
case PayuConstants.DISCOVER:
return R.drawable.discover;
case SdkUIConstants.MAESTRO:
return R.drawable.mas_icon;
case PayuConstants.MASTERCARD:
return R.drawable.mc_icon;
case PayuConstants.AMEX:
return R.drawable.amex;
case PayuConstants.DINR:
return R.drawable.diner;
case PayuConstants.JCB:
return R.drawable.jcb;
case PayuConstants.SMAE:
return R.drawable.maestro;
case PayuConstants.RUPAY:
return R.drawable.rupay;
}
return 0;
}
}
public String getCvv() {
return cvvEditText.getText().toString();
}
public Boolean isEnableOneClickPaymentChecked() {
return enableOneClickPayment.isChecked();
}
public Boolean cvvValidation() {
String cvv = "";
PayuUtils myPayuUtils = new PayuUtils();
if (cvvEditText != null && cvvEditText.getText() != null) {
cvv = cvvEditText.getText().toString();
if ((myPayuUtils.validateCvv(mStoredCard.getCardBin(), cvv) && !cvv.equals("")) || (cvvEditText != null && cvvEditText.getVisibility() == View.GONE)) {
isCvvValid = true;
} else {
isCvvValid = false;
}
}
return isCvvValid;
}
} | [
"mohan@cbotsolutions.com"
] | mohan@cbotsolutions.com |
5b05f218162427afa442c9ded17af77e35a5b22c | d44774860235872ff649075355ba32ba30ee06e2 | /android/app/src/main/java/com/beetle/face/tools/event/LoginSuccessEvent.java | e3cd573db6b2bd2d888061ef3c827a1990ba1899 | [] | no_license | richmonkey/Face | 8b7c0774f8e891de912fdcd422454aff2f7cbeaf | df4386e890f19431c11f3dd1bcd7ab7f487de8a3 | refs/heads/master | 2020-04-07T05:38:24.404051 | 2017-06-28T05:37:28 | 2017-06-28T05:37:28 | 25,218,515 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | package com.beetle.face.tools.event;
/**
* Created by tsung on 12/2/14.
*/
public class LoginSuccessEvent {
}
| [
"houxuehua49@gmail.com"
] | houxuehua49@gmail.com |
6c048d7daded07536b4d9d092121ea2234a377dd | 969cc3e499089eafc2503ecba638673625d8f98d | /1.7.10/11/ThaumCraft 1.7.10 FakePlayers-4.2.3.5/sources/src/main/java/thaumcraft/common/items/wands/ItemWandCasting.java | dd325da61592ec09725d429b09b4c1b003bba4fd | [] | no_license | will-git-eng/FixedMods | d33895820eb48caabbbc4dbfd82a47ea409df603 | ffbea738863505cf74bccac3f02ab62cd894d99f | refs/heads/master | 2020-06-06T10:52:12.121044 | 2019-06-19T15:08:59 | 2019-06-19T15:08:59 | 192,719,248 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 23,661 | java | package thaumcraft.common.items.wands;
import ru.will.git.reflectionmedic.util.EventUtils;
import ru.will.git.thaumcraft.EventConfig;
import ru.will.git.thaumcraft.ModUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.BlockCoordinates;
import thaumcraft.api.IArchitect;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.wands.*;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.Config;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.tiles.TileOwned;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class ItemWandCasting extends Item implements IArchitect
{
private IIcon icon;
DecimalFormat myFormatter = new DecimalFormat("#######.##");
public ItemFocusBasic.WandFocusAnimation animation = null;
public ItemWandCasting()
{
this.maxStackSize = 1;
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setCreativeTab(Thaumcraft.tabTC);
}
@Override
public boolean isDamageable()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
this.icon = par1IconRegister.registerIcon("thaumcraft:blank");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass)
{
return this.icon;
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
public int getMaxVis(ItemStack stack)
{
return this.getRod(stack).getCapacity() * (this.isSceptre(stack) ? 150 : 100);
}
@Override
public EnumRarity getRarity(ItemStack itemstack)
{
return EnumRarity.uncommon;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
ItemStack w1 = new ItemStack(this, 1, 0);
ItemStack w2 = new ItemStack(this, 1, 9);
ItemStack w3 = new ItemStack(this, 1, 54);
((ItemWandCasting) w2.getItem()).setCap(w2, ConfigItems.WAND_CAP_GOLD);
((ItemWandCasting) w3.getItem()).setCap(w3, ConfigItems.WAND_CAP_THAUMIUM);
((ItemWandCasting) w2.getItem()).setRod(w2, ConfigItems.WAND_ROD_GREATWOOD);
((ItemWandCasting) w3.getItem()).setRod(w3, ConfigItems.WAND_ROD_SILVERWOOD);
ItemStack sceptre = new ItemStack(ConfigItems.itemWandCasting, 1, 128);
((ItemWandCasting) sceptre.getItem()).setCap(sceptre, ConfigItems.WAND_CAP_THAUMIUM);
((ItemWandCasting) sceptre.getItem()).setRod(sceptre, ConfigItems.WAND_ROD_SILVERWOOD);
sceptre.setTagInfo("sceptre", new NBTTagByte((byte) 1));
for (Aspect aspect : Aspect.getPrimalAspects())
{
((ItemWandCasting) w1.getItem()).addVis(w1, aspect, ((ItemWandCasting) w1.getItem()).getMaxVis(w1), true);
((ItemWandCasting) w2.getItem()).addVis(w2, aspect, ((ItemWandCasting) w2.getItem()).getMaxVis(w2), true);
((ItemWandCasting) w3.getItem()).addVis(w3, aspect, ((ItemWandCasting) w3.getItem()).getMaxVis(w3), true);
((ItemWandCasting) sceptre.getItem()).addVis(sceptre, aspect, ((ItemWandCasting) sceptre.getItem()).getMaxVis(sceptre), true);
}
par3List.add(w1);
par3List.add(w2);
par3List.add(w3);
par3List.add(sceptre);
}
@Override
public String getItemStackDisplayName(ItemStack is)
{
String name = StatCollector.translateToLocal("item.Wand.name");
name = name.replace("%CAP", StatCollector.translateToLocal("item.Wand." + this.getCap(is).getTag() + ".cap"));
String rod = this.getRod(is).getTag();
if (rod.contains("_staff"))
rod = rod.substring(0, this.getRod(is).getTag().indexOf("_staff"));
name = name.replace("%ROD", StatCollector.translateToLocal("item.Wand." + rod + ".rod"));
name = name.replace("%OBJ", this.isStaff(is) ? StatCollector.translateToLocal("item.Wand.staff.obj") : this.isSceptre(is) ? StatCollector.translateToLocal("item.Wand.sceptre.obj") : StatCollector.translateToLocal("item.Wand.wand.obj"));
return name;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
int pos = list.size();
String tt2 = "";
if (stack.hasTagCompound())
{
StringBuilder tt = new StringBuilder();
int tot = 0;
int num = 0;
for (Aspect aspect : Aspect.getPrimalAspects())
{
if (stack.stackTagCompound.hasKey(aspect.getTag()))
{
String amount = this.myFormatter.format(stack.stackTagCompound.getInteger(aspect.getTag()) / 100.0F);
float mod = this.getConsumptionModifier(stack, player, aspect, false);
String consumption = this.myFormatter.format(mod * 100.0F);
++num;
tot = (int) (tot + mod * 100.0F);
String text = "";
ItemStack focus = this.getFocusItem(stack);
if (focus != null)
{
int amt = ((ItemFocusBasic) focus.getItem()).getVisCost(focus).getAmount(aspect);
if (amt > 0)
text = "§r, " + this.myFormatter.format(amt * mod / 100.0F) + " " + StatCollector.translateToLocal(((ItemFocusBasic) focus.getItem()).isVisCostPerTick(focus) ? "item.Focus.cost2" : "item.Focus.cost1");
}
if (Thaumcraft.proxy.isShiftKeyDown())
list.add(" §" + aspect.getChatcolor() + aspect.getName() + "§r x " + amount + ", §o(" + consumption + "% " + StatCollector.translateToLocal("tc.vis.cost") + ")" + text);
else
{
if (tt.length() > 0)
tt.append(" | ");
tt.append('§').append(aspect.getChatcolor()).append(amount).append("§r");
}
}
}
if (!Thaumcraft.proxy.isShiftKeyDown() && num > 0)
{
list.add(tt.toString());
tot /= num;
tt2 = " (" + tot + "% " + StatCollector.translateToLocal("tc.vis.costavg") + ")";
}
}
list.add(pos, EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.capacity.text") + " " + this.getMaxVis(stack) / 100 + "§r" + tt2);
if (this.getFocus(stack) != null)
{
list.add(EnumChatFormatting.BOLD.toString() + EnumChatFormatting.ITALIC + EnumChatFormatting.GREEN + this.getFocus(stack).getItemStackDisplayName(this.getFocusItem(stack)));
if (Thaumcraft.proxy.isShiftKeyDown())
this.getFocus(stack).addFocusInformation(this.getFocusItem(stack), player, list, par4);
}
}
public AspectList getAllVis(ItemStack is)
{
AspectList out = new AspectList();
for (Aspect aspect : Aspect.getPrimalAspects())
{
if (is.hasTagCompound() && is.stackTagCompound.hasKey(aspect.getTag()))
out.merge(aspect, is.stackTagCompound.getInteger(aspect.getTag()));
else
out.merge(aspect, 0);
}
return out;
}
public AspectList getAspectsWithRoom(ItemStack wandstack)
{
AspectList out = new AspectList();
AspectList cur = this.getAllVis(wandstack);
Aspect[] arr$ = cur.getAspects();
int len$ = arr$.length;
for (Aspect aspect : arr$)
{
if (cur.getAmount(aspect) < this.getMaxVis(wandstack))
out.add(aspect, 1);
}
return out;
}
public void storeAllVis(ItemStack is, AspectList in)
{
Aspect[] arr$ = in.getAspects();
int len$ = arr$.length;
for (Aspect aspect : arr$)
{
is.setTagInfo(aspect.getTag(), new NBTTagInt(in.getAmount(aspect)));
}
}
public int getVis(ItemStack is, Aspect aspect)
{
int out = 0;
if (is != null && aspect != null && is.hasTagCompound() && is.stackTagCompound.hasKey(aspect.getTag()))
out = is.stackTagCompound.getInteger(aspect.getTag());
return out;
}
public void storeVis(ItemStack is, Aspect aspect, int amount)
{
is.setTagInfo(aspect.getTag(), new NBTTagInt(amount));
}
public float getConsumptionModifier(ItemStack is, EntityPlayer player, Aspect aspect, boolean crafting)
{
float consumptionModifier = 1.0F;
if (this.getCap(is).getSpecialCostModifierAspects() != null && this.getCap(is).getSpecialCostModifierAspects().contains(aspect))
consumptionModifier = this.getCap(is).getSpecialCostModifier();
else
consumptionModifier = this.getCap(is).getBaseCostModifier();
if (player != null)
consumptionModifier -= WandManager.getTotalVisDiscount(player, aspect);
if (this.getFocus(is) != null && !crafting)
consumptionModifier -= this.getFocusFrugal(is) / 10.0F;
if (this.isSceptre(is))
consumptionModifier -= 0.1F;
return Math.max(consumptionModifier, 0.1F);
}
public int getFocusPotency(ItemStack itemstack)
{
return this.getFocus(itemstack) == null ? 0 : this.getFocus(itemstack).getUpgradeLevel(this.getFocusItem(itemstack), FocusUpgradeType.potency) + (this.hasRunes(itemstack) ? 1 : 0);
}
public int getFocusTreasure(ItemStack itemstack)
{
return this.getFocus(itemstack) == null ? 0 : this.getFocus(itemstack).getUpgradeLevel(this.getFocusItem(itemstack), FocusUpgradeType.treasure);
}
public int getFocusFrugal(ItemStack itemstack)
{
return this.getFocus(itemstack) == null ? 0 : this.getFocus(itemstack).getUpgradeLevel(this.getFocusItem(itemstack), FocusUpgradeType.frugal);
}
public int getFocusEnlarge(ItemStack itemstack)
{
return this.getFocus(itemstack) == null ? 0 : this.getFocus(itemstack).getUpgradeLevel(this.getFocusItem(itemstack), FocusUpgradeType.enlarge);
}
public int getFocusExtend(ItemStack itemstack)
{
return this.getFocus(itemstack) == null ? 0 : this.getFocus(itemstack).getUpgradeLevel(this.getFocusItem(itemstack), FocusUpgradeType.extend);
}
public boolean consumeVis(ItemStack is, EntityPlayer player, Aspect aspect, int amount, boolean crafting)
{
amount = (int) (amount * this.getConsumptionModifier(is, player, aspect, crafting));
if (this.getVis(is, aspect) >= amount)
{
this.storeVis(is, aspect, this.getVis(is, aspect) - amount);
return true;
}
return false;
}
public boolean consumeAllVisCrafting(ItemStack is, EntityPlayer player, AspectList aspects, boolean doit)
{
if (aspects != null && aspects.size() != 0)
{
AspectList nl = new AspectList();
Aspect[] arr$ = aspects.getAspects();
int len$ = arr$.length;
for (Aspect aspect : arr$)
{
int cost = aspects.getAmount(aspect) * 100;
nl.add(aspect, cost);
}
return this.consumeAllVis(is, player, nl, doit, true);
}
return false;
}
public boolean consumeAllVis(ItemStack is, EntityPlayer player, AspectList aspects, boolean doit, boolean crafting)
{
if (aspects != null && aspects.size() != 0)
{
AspectList nl = new AspectList();
Aspect[] arr$ = aspects.getAspects();
int len$ = arr$.length;
int i$;
Aspect aspect;
for (i$ = 0; i$ < len$; ++i$)
{
aspect = arr$[i$];
int cost = aspects.getAmount(aspect);
cost = (int) (cost * this.getConsumptionModifier(is, player, aspect, crafting));
nl.add(aspect, cost);
}
arr$ = nl.getAspects();
len$ = arr$.length;
for (i$ = 0; i$ < len$; ++i$)
{
aspect = arr$[i$];
if (this.getVis(is, aspect) < nl.getAmount(aspect))
return false;
}
if (doit && !player.worldObj.isRemote)
{
arr$ = nl.getAspects();
len$ = arr$.length;
for (i$ = 0; i$ < len$; ++i$)
{
aspect = arr$[i$];
this.storeVis(is, aspect, this.getVis(is, aspect) - nl.getAmount(aspect));
}
}
return true;
}
return false;
}
public int addVis(ItemStack is, Aspect aspect, int amount, boolean doit)
{
if (!aspect.isPrimal())
return 0;
int storeAmount = this.getVis(is, aspect) + amount * 100;
int leftover = Math.max(storeAmount - this.getMaxVis(is), 0);
if (doit)
this.storeVis(is, aspect, Math.min(storeAmount, this.getMaxVis(is)));
return leftover / 100;
}
public int addRealVis(ItemStack is, Aspect aspect, int amount, boolean doit)
{
if (!aspect.isPrimal())
return 0;
int storeAmount = this.getVis(is, aspect) + amount;
int leftover = Math.max(storeAmount - this.getMaxVis(is), 0);
if (doit)
this.storeVis(is, aspect, Math.min(storeAmount, this.getMaxVis(is)));
return leftover;
}
@Override
public void onUpdate(ItemStack is, World w, Entity e, int slot, boolean currentItem)
{
if (!w.isRemote)
{
EntityPlayer player = (EntityPlayer) e;
if (this.getRod(is).getOnUpdate() != null)
this.getRod(is).getOnUpdate().onUpdate(is, player);
}
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
if (EventUtils.cantBreak(player, x, y, z))
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
boolean result = false;
ForgeDirection direction = ForgeDirection.getOrientation(side);
if (block instanceof IWandable)
{
int tile = ((IWandable) block).onWandRightClick(world, stack, player, x, y, z, side, meta);
if (tile >= 0)
return tile == 1;
}
TileEntity tile1 = world.getTileEntity(x, y, z);
if (tile1 instanceof IWandable)
{
int ret = ((IWandable) tile1).onWandRightClick(world, stack, player, x, y, z, side, meta);
if (ret >= 0)
return ret == 1;
}
if (WandTriggerRegistry.hasTrigger(block, meta))
return WandTriggerRegistry.performTrigger(world, stack, player, x, y, z, side, block, meta);
if ((block == ConfigBlocks.blockWoodenDevice && meta == 2 || block == ConfigBlocks.blockCosmeticOpaque && meta == 2) && (!Config.wardedStone || tile1 instanceof TileOwned && player.getCommandSenderName().equals(((TileOwned) tile1).owner)))
if (!world.isRemote)
{
((TileOwned) tile1).safeToRemove = true;
world.spawnEntityInWorld(new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, new ItemStack(block, 1, meta)));
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
world.setBlockToAir(x, y, z);
}
else
player.swingItem();
if (block == ConfigBlocks.blockArcaneDoor && (!Config.wardedStone || tile1 instanceof TileOwned && player.getCommandSenderName().equals(((TileOwned) tile1).owner)))
if (!world.isRemote)
{
((TileOwned) tile1).safeToRemove = true;
if ((meta & 8) == 0)
tile1 = world.getTileEntity(x, y + 1, z);
else
tile1 = world.getTileEntity(x, y - 1, z);
if (tile1 instanceof TileOwned)
((TileOwned) tile1).safeToRemove = true;
if (Config.wardedStone || !Config.wardedStone && (meta & 8) == 0)
world.spawnEntityInWorld(new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, new ItemStack(ConfigItems.itemArcaneDoor)));
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
world.setBlockToAir(x, y, z);
}
else
player.swingItem();
return result;
}
public ItemFocusBasic getFocus(ItemStack stack)
{
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey("focus"))
{
NBTTagCompound nbt = stack.stackTagCompound.getCompoundTag("focus");
if (focusStack == null || !(focusStack.getItem() instanceof ItemFocusBasic))
{
stack.stackTagCompound.removeTag("focus");
return null;
return (ItemFocusBasic) focusStack.getItem();
}
return null;
}
public ItemStack getFocusItem(ItemStack stack)
{
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey("focus"))
{
NBTTagCompound nbt = stack.stackTagCompound.getCompoundTag("focus");
if (focusStack == null || !(focusStack.getItem() instanceof ItemFocusBasic))
{
stack.stackTagCompound.removeTag("focus");
return null;
return focusStack;
}
return null;
}
public void setFocus(ItemStack stack, ItemStack focus)
{
if (focus == null)
stack.stackTagCompound.removeTag("focus");
else
stack.setTagInfo("focus", focus.writeToNBT(new NBTTagCompound()));
}
public WandRod getRod(ItemStack stack)
{
return stack.hasTagCompound() && stack.stackTagCompound.hasKey("rod") ? WandRod.rods.get(stack.stackTagCompound.getString("rod")) : ConfigItems.WAND_ROD_WOOD;
}
public boolean isStaff(ItemStack stack)
{
WandRod rod = this.getRod(stack);
return rod instanceof StaffRod;
}
public boolean isSceptre(ItemStack stack)
{
return stack.hasTagCompound() && stack.stackTagCompound.hasKey("sceptre");
}
public boolean hasRunes(ItemStack stack)
{
WandRod rod = this.getRod(stack);
return rod instanceof StaffRod && ((StaffRod) rod).hasRunes();
}
public void setRod(ItemStack stack, WandRod rod)
{
stack.setTagInfo("rod", new NBTTagString(rod.getTag()));
if (rod instanceof StaffRod)
{
NBTTagList tags = new NBTTagList();
NBTTagCompound tag = new NBTTagCompound();
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
AttributeModifier am = new AttributeModifier(field_111210_e, "Weapon modifier", 6.0D, 0);
tag.setString("Name", am.getName());
tag.setDouble("Amount", am.getAmount());
tag.setInteger("Operation", am.getOperation());
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
tags.appendTag(tag);
stack.stackTagCompound.setTag("AttributeModifiers", tags);
}
}
public WandCap getCap(ItemStack stack)
{
return stack.hasTagCompound() && stack.stackTagCompound.hasKey("cap") ? WandCap.caps.get(stack.stackTagCompound.getString("cap")) : ConfigItems.WAND_CAP_IRON;
}
public void setCap(ItemStack stack, WandCap cap)
{
stack.setTagInfo("cap", new NBTTagString(cap.getTag()));
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
{
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, true);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK)
{
int x = mop.blockX;
int y = mop.blockY;
if (EventUtils.cantBreak(player, x, y, z))
Block block = world.getBlock(x, y, z);
if (block instanceof IWandable)
{
ItemStack stack = ((IWandable) block).onWandRightClick(world, itemstack, player);
if (stack != null)
return stack;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IWandable)
{
ItemStack stack = ((IWandable) tile).onWandRightClick(world, itemstack, player);
if (stack != null)
return stack;
}
}
ItemFocusBasic focus = this.getFocus(itemstack);
if (focus != null && !WandManager.isOnCooldown(player))
{
ItemStack stack = focus.onFocusRightClick(itemstack, world, player, mop);
if (stack != null)
if (isHeldItem && stack.stackSize > 0 && !ModUtils.isValidStack(player.getHeldItem()))
return stack;
}
}
return super.onItemRightClick(itemstack, world, player);
}
public void setObjectInUse(ItemStack stack, int x, int y, int z)
{
if (stack.stackTagCompound == null)
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setInteger("IIUX", x);
stack.stackTagCompound.setInteger("IIUY", y);
stack.stackTagCompound.setInteger("IIUZ", z);
}
public void clearObjectInUse(ItemStack stack)
{
if (stack.stackTagCompound == null)
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.removeTag("IIUX");
stack.stackTagCompound.removeTag("IIUY");
stack.stackTagCompound.removeTag("IIUZ");
}
public IWandable getObjectInUse(ItemStack stack, World world)
{
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey("IIUX"))
{
TileEntity te = world.getTileEntity(stack.stackTagCompound.getInteger("IIUX"), stack.stackTagCompound.getInteger("IIUY"), stack.stackTagCompound.getInteger("IIUZ"));
if (te instanceof IWandable)
return (IWandable) te;
}
return null;
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
IWandable tv = this.getObjectInUse(stack, player.worldObj);
if (tv != null)
{
this.animation = ItemFocusBasic.WandFocusAnimation.WAVE;
tv.onUsingWandTick(stack, player, count);
}
else
{
ItemFocusBasic focus = this.getFocus(stack);
if (focus != null && !WandManager.isOnCooldown(player))
{
WandManager.setCooldown(player, focus.getActivationCooldown(this.getFocusItem(stack)));
focus.onUsingFocusTick(stack, player, count);
}
}
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count)
{
IWandable tv = this.getObjectInUse(stack, player.worldObj);
if (tv != null)
{
tv.onWandStoppedUsing(stack, world, player, count);
this.animation = null;
}
else
{
ItemFocusBasic focus = this.getFocus(stack);
if (focus != null)
focus.onPlayerStoppedUsingFocus(stack, world, player, count);
}
this.clearObjectInUse(stack);
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack itemstack)
{
return Integer.MAX_VALUE;
}
@Override
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack)
{
ItemStack focus = this.getFocusItem(stack);
if (focus != null && !WandManager.isOnCooldown(entityLiving))
{
WandManager.setCooldown(entityLiving, this.getFocus(stack).getActivationCooldown(focus));
return focus.getItem().onEntitySwing(entityLiving, stack);
}
return super.onEntitySwing(entityLiving, stack);
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player)
{
ItemFocusBasic focus = this.getFocus(itemstack);
if (focus != null && !WandManager.isOnCooldown(player))
{
WandManager.setCooldown(player, focus.getActivationCooldown(this.getFocusItem(itemstack)));
return focus.onFocusBlockStartBreak(itemstack, x, y, z, player);
}
return false;
}
@Override
public boolean canHarvestBlock(Block par1Block, ItemStack itemstack)
{
ItemFocusBasic focus = this.getFocus(itemstack);
return focus != null && this.getFocusItem(itemstack).getItem().canHarvestBlock(par1Block, itemstack);
}
@Override
public float func_150893_a(ItemStack itemstack, Block block)
{
ItemFocusBasic focus = this.getFocus(itemstack);
return focus != null ? this.getFocusItem(itemstack).getItem().func_150893_a(itemstack, null) : super.func_150893_a(itemstack, block);
}
@Override
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player)
{
ItemFocusBasic focus = this.getFocus(stack);
return focus instanceof IArchitect && focus.isUpgradedWith(this.getFocusItem(stack), FocusUpgradeType.architect) ? ((IArchitect) focus).getArchitectBlocks(stack, world, x, y, z, side, player) : null;
}
@Override
public boolean showAxis(ItemStack stack, World world, EntityPlayer player, int side, IArchitect.EnumAxis axis)
{
ItemFocusBasic focus = this.getFocus(stack);
return focus instanceof IArchitect && focus.isUpgradedWith(this.getFocusItem(stack), FocusUpgradeType.architect) && ((IArchitect) focus).showAxis(stack, world, player, side, axis);
}
}
| [
"lbvrf090@mail.ru"
] | lbvrf090@mail.ru |
312f95630fcb980c3c005952425147bf5174d453 | 49e92f8644b70ccbe40541841fbeec896119104d | /src/main/java/com/malasong/entity/User.java | 52a1da0fe22549d3080baa0b642308c076095188 | [] | no_license | iamfangyun/malasong | 01bcf684281e1946aea059705bf5ad5d50b419d9 | b64e9e020be8aae4adcffad78f71909ce52ba0b9 | refs/heads/master | 2021-05-28T07:11:12.511818 | 2015-01-08T15:28:09 | 2015-01-08T15:28:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.malasong.entity;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="user")
public class User {
@Id
@GeneratedValue
private Long id;
private String name;
private int year;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Clazz clazz;
public User edit(String name, int year, Clazz clazz) {
this.name = name;
this.year = year;
this.clazz = clazz;
return this;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public Clazz getClazz() {
return clazz;
}
public void setClazz(Clazz clazz) {
this.clazz = clazz;
}
}
| [
"shanywei@SHANYWEI-CN.cn.oracle.com"
] | shanywei@SHANYWEI-CN.cn.oracle.com |
662e2621dcb116584a432ff3ee73ba6bd209e21b | d20668b8b22f781822065b0a2d8bc75a973ff809 | /src/tasks-service/src/main/java/jpm/mimacom/tasks/service/AbstractServiceFactory.java | c20407f2a044af105f7e03caded3536461519a83 | [] | no_license | josepm9/tasks-portlet | 7c488dafe7462ef15482510e02abac319748c1a2 | a8896462d2afdf1f174609b8431b8c580fac9eb0 | refs/heads/master | 2021-01-10T09:19:43.096572 | 2015-10-26T11:21:03 | 2015-10-26T11:21:03 | 44,954,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package jpm.mimacom.tasks.service;
import java.io.Closeable;
import java.util.Properties;
public abstract class AbstractServiceFactory implements Closeable {
protected Properties props;
public Properties getProps() {
return props;
}
public void setProps(final Properties props) {
this.props = props;
}
public abstract void initialize() throws Exception;
public abstract TasksService getTasksService();
}
| [
"josepm9@gmail.com"
] | josepm9@gmail.com |
bf136ad51a38373e7435dcc811f1dc6743ed8cf6 | d422455b0213d93c4dff952fbefdf7bad9273c29 | /src/org/usfirst/frc250/Stronghold2016/commands/auto/LongerForwardAuto.java | 46edd6d1244c81a8853bcdd37bcbf9781905c2f6 | [] | no_license | Team250/2016-Stronghold-CodeRelease | 04fec128fd4bfe26c26b7e74b907fc0522452723 | 66a8dbb921098fd1444878413c2f6efe9306a639 | refs/heads/master | 2021-01-12T03:53:32.083913 | 2017-01-07T14:22:51 | 2017-01-07T14:22:51 | 78,283,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package org.usfirst.frc250.Stronghold2016.commands.auto;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
*
*/
public class LongerForwardAuto extends CommandGroup {
public LongerForwardAuto() {
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
addSequential(new _DriveForward(), 5);
}
}
| [
"jonathan.saulsbery@team250.org"
] | jonathan.saulsbery@team250.org |
dcc5b7f003ad8ca211ee4d14516db8b5daf38f5b | 1486bed60e1636e56c6c3b396257bb5f481953d0 | /ENSIM/Java/POO-Spring-TP5/src/test/java/fr/ensim/herbron/tp5/Tp5ApplicationTests.java | 679b9ad3fa631a59aaee68cc3f5ed64cb4c26cb4 | [] | no_license | TanguyHerbron/Etudes | 35ab53b64a25909ea177c4d7204abcecd4270e30 | 2949f4dba89bd74619426d24837577d3e2961b41 | refs/heads/master | 2021-01-11T02:41:14.565470 | 2019-03-08T22:34:21 | 2019-03-08T22:34:21 | 70,911,677 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package fr.ensim.herbron.tp5;
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 Tp5ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"tanguy.herbron@outlook.com"
] | tanguy.herbron@outlook.com |
60d28b753b5c8bdad89a5357a9d44bdea5545ae8 | b88ba37e313d53d23edf70db34bb201d095b2f0e | /app/src/main/java/com/example/android/normalnotdagger/ui/message/list_dialog/ImessageFragment.java | 00af4e5df8756b9fd626b332a29b06449debb68b | [] | no_license | LeNcE1/AYG | 7934ba02160bd70fa7719da1c87a8d3b23bab9c4 | d75af8797414288f5b4a018a8921cac6a58206eb | refs/heads/master | 2021-09-01T13:08:11.178299 | 2017-12-27T05:39:36 | 2017-12-27T05:39:36 | 112,694,260 | 0 | 1 | null | 2017-12-27T04:00:37 | 2017-12-01T04:18:15 | Java | UTF-8 | Java | false | false | 988 | java | package com.example.android.normalnotdagger.ui.message.list_dialog;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.android.normalnotdagger.R;
public class ImessageFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.i_news_fragment, container, false);
MessagesFragment youFragment = new MessagesFragment();
android.app.FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction() // получаем экземпляр FragmentTransaction
.replace(R.id.news_list, youFragment)
.addToBackStack("myStack")
.commit();
return view;
}
}
| [
"Sergey15seleznev@gmail.com"
] | Sergey15seleznev@gmail.com |
fc532e116c2fc58c063501f44ab95f5cff29462b | a938c8162313da137e94d6a9d223d1ec8db5a5ca | /NicadOutputFile_maven/Clone Pairs 34/Nicad_maven67.java | 8e5a829664a1b139fbbc820b6f1a68b374b26aec | [] | no_license | ryosuke-ku/Nicad_ScrapinG | a94a61574dc17585047624b827639196b23b8e21 | 62200621eb293d7a8953ef6e18a7e0f2019ecc48 | refs/heads/master | 2020-06-29T22:03:44.189953 | 2019-08-05T13:17:57 | 2019-08-05T13:17:57 | 200,636,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | //79:maven/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
//None
public class Nicad_maven67
{
protected void mergePlugin_Dependencies( Plugin target, Plugin source, boolean sourceDominant,
Map<Object, Object> context )
{
List<Dependency> src = source.getDependencies();
if ( !src.isEmpty() )
{
List<Dependency> tgt = target.getDependencies();
Map<Object, Dependency> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
for ( Dependency element : tgt )
{
Object key = getDependencyKey( element );
merged.put( key, element );
}
for ( Dependency element : src )
{
Object key = getDependencyKey( element );
if ( sourceDominant || !merged.containsKey( key ) )
{
merged.put( key, element );
}
}
target.setDependencies( new ArrayList<>( merged.values() ) );
}
} | [
"naist1020@gmail.com"
] | naist1020@gmail.com |
0c78ab72ca97e3f8992da9441c28c3444e7be8fc | e9ee391d0aa1a28e24165382c9d8aac03cf5c107 | /app/src/main/java/com/ly/mymovie/ui/main/ComingMvpView.java | e25a515fbc542bdc04ac80b362f117b0ef4d23ff | [] | no_license | 568240761/Dagger2Demo | 42f87ab2a3a590f2013885d7ad2fc03d475b2d6a | 342ca94fcabfeaf42419f6c5ba306df551a39503 | refs/heads/master | 2021-05-14T07:29:34.332001 | 2018-01-04T13:59:32 | 2018-01-04T13:59:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.ly.mymovie.ui.main;
import com.ly.mymovie.data.model.Message;
import com.ly.mymovie.ui.base.MvpView;
/**
* Created by LanYang on 2017/12/12.
* Email:568240761@qq.com
*/
public interface ComingMvpView extends MvpView {
void notifyAdapter(Message message);
void showErrorView();
}
| [
"568240761@qq.com"
] | 568240761@qq.com |
dcfafe5867d3944948921aaa8f985843f5ffda86 | b9ef91bb8b84d077c50db8b3b9d3c0786ccdc796 | /app/src/main/java/com/codingke/codingkeplayer/NetMusicListFragment.java | 5d446e926e979856ce4e044623f23a0b426ba64a | [] | no_license | Codyfjm/codingkeplayer | e17a14b6c9f94e8fc576cef660cdab5424df625d | 201c7d0b701b536fad45ae0174929d48af27c2d1 | refs/heads/master | 2021-01-13T14:39:44.666678 | 2015-12-02T04:59:34 | 2015-12-02T04:59:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.codingke.codingkeplayer;
import android.support.v4.app.Fragment;
/**
* Created by Mr.Wang on 2015/11/2.
*/
public class NetMusicListFragment extends Fragment {
public static NetMusicListFragment newInstance(){
NetMusicListFragment netMusicListFragment = new NetMusicListFragment();
return netMusicListFragment;
}
}
| [
"1044913154@qq.com"
] | 1044913154@qq.com |
fbc3c14cb1a54db254467917ab0cb524087f8d68 | 8e57350f0df89a9529f4b0699dc197309bb89a91 | /Petrinet.Querie/src-gen/query/TransitiontoPlaceMatch.java | 7d7264bfa404c3dc714bdbf820be1d3cf56e6b59 | [] | no_license | gyurjan/Viatra-Dse-Test | 747abdf38d78c88363742905a2253e695e517248 | a67dc8f6c598b76af4daa9358dbf4774e78b8fbd | refs/heads/master | 2021-01-10T11:01:03.044450 | 2016-02-24T12:35:40 | 2016-02-24T12:35:40 | 52,269,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,095 | java | package query;
import PetriNet.Place;
import PetriNet.Transition;
import java.util.Arrays;
import java.util.List;
import org.eclipse.incquery.runtime.api.IPatternMatch;
import org.eclipse.incquery.runtime.api.impl.BasePatternMatch;
import org.eclipse.incquery.runtime.exception.IncQueryException;
import query.util.TransitiontoPlaceQuerySpecification;
/**
* Pattern-specific match representation of the query.transitiontoPlace pattern,
* to be used in conjunction with {@link TransitiontoPlaceMatcher}.
*
* <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
* Each instance is a (possibly partial) substitution of pattern parameters,
* usable to represent a match of the pattern in the result of a query,
* or to specify the bound (fixed) input parameters when issuing a query.
*
* @see TransitiontoPlaceMatcher
* @see TransitiontoPlaceProcessor
*
*/
@SuppressWarnings("all")
public abstract class TransitiontoPlaceMatch extends BasePatternMatch {
private Transition fT;
private Place fP;
private static List<String> parameterNames = makeImmutableList("T", "P");
private TransitiontoPlaceMatch(final Transition pT, final Place pP) {
this.fT = pT;
this.fP = pP;
}
@Override
public Object get(final String parameterName) {
if ("T".equals(parameterName)) return this.fT;
if ("P".equals(parameterName)) return this.fP;
return null;
}
public Transition getT() {
return this.fT;
}
public Place getP() {
return this.fP;
}
@Override
public boolean set(final String parameterName, final Object newValue) {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
if ("T".equals(parameterName) ) {
this.fT = (PetriNet.Transition) newValue;
return true;
}
if ("P".equals(parameterName) ) {
this.fP = (PetriNet.Place) newValue;
return true;
}
return false;
}
public void setT(final Transition pT) {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
this.fT = pT;
}
public void setP(final Place pP) {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
this.fP = pP;
}
@Override
public String patternName() {
return "query.transitiontoPlace";
}
@Override
public List<String> parameterNames() {
return TransitiontoPlaceMatch.parameterNames;
}
@Override
public Object[] toArray() {
return new Object[]{fT, fP};
}
@Override
public TransitiontoPlaceMatch toImmutable() {
return isMutable() ? newMatch(fT, fP) : this;
}
@Override
public String prettyPrint() {
StringBuilder result = new StringBuilder();
result.append("\"T\"=" + prettyPrintValue(fT) + ", ");
result.append("\"P\"=" + prettyPrintValue(fP)
);
return result.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fT == null) ? 0 : fT.hashCode());
result = prime * result + ((fP == null) ? 0 : fP.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (!(obj instanceof TransitiontoPlaceMatch)) { // this should be infrequent
if (obj == null) {
return false;
}
if (!(obj instanceof IPatternMatch)) {
return false;
}
IPatternMatch otherSig = (IPatternMatch) obj;
if (!specification().equals(otherSig.specification()))
return false;
return Arrays.deepEquals(toArray(), otherSig.toArray());
}
TransitiontoPlaceMatch other = (TransitiontoPlaceMatch) obj;
if (fT == null) {if (other.fT != null) return false;}
else if (!fT.equals(other.fT)) return false;
if (fP == null) {if (other.fP != null) return false;}
else if (!fP.equals(other.fP)) return false;
return true;
}
@Override
public TransitiontoPlaceQuerySpecification specification() {
try {
return TransitiontoPlaceQuerySpecification.instance();
} catch (IncQueryException ex) {
// This cannot happen, as the match object can only be instantiated if the query specification exists
throw new IllegalStateException (ex);
}
}
/**
* Returns an empty, mutable match.
* Fields of the mutable match can be filled to create a partial match, usable as matcher input.
*
* @return the empty match.
*
*/
public static TransitiontoPlaceMatch newEmptyMatch() {
return new Mutable(null, null);
}
/**
* Returns a mutable (partial) match.
* Fields of the mutable match can be filled to create a partial match, usable as matcher input.
*
* @param pT the fixed value of pattern parameter T, or null if not bound.
* @param pP the fixed value of pattern parameter P, or null if not bound.
* @return the new, mutable (partial) match object.
*
*/
public static TransitiontoPlaceMatch newMutableMatch(final Transition pT, final Place pP) {
return new Mutable(pT, pP);
}
/**
* Returns a new (partial) match.
* This can be used e.g. to call the matcher with a partial match.
* <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
* @param pT the fixed value of pattern parameter T, or null if not bound.
* @param pP the fixed value of pattern parameter P, or null if not bound.
* @return the (partial) match object.
*
*/
public static TransitiontoPlaceMatch newMatch(final Transition pT, final Place pP) {
return new Immutable(pT, pP);
}
private static final class Mutable extends TransitiontoPlaceMatch {
Mutable(final Transition pT, final Place pP) {
super(pT, pP);
}
@Override
public boolean isMutable() {
return true;
}
}
private static final class Immutable extends TransitiontoPlaceMatch {
Immutable(final Transition pT, final Place pP) {
super(pT, pP);
}
@Override
public boolean isMutable() {
return false;
}
}
}
| [
"git@bitbucket.org:gyurjanm/mate.git"
] | git@bitbucket.org:gyurjanm/mate.git |
fa2a0b3469635241600da1526dae827fb849f324 | 5aae8f5fdab3c897e5145c2503fd098630876662 | /src/main/java/com/javadaily/redditclone/model/Post.java | acdb4c722a5fe5dfba1e854ba8100e0d64960124 | [] | no_license | vrahangdale/reddit-clone | 48c33cfbee296be814b1ad80417a42daa32e4e78 | 4988215f1325b19967bbff7ec9b1750553ff5fc3 | refs/heads/main | 2023-02-25T18:59:49.185564 | 2021-02-05T20:06:40 | 2021-02-05T20:06:40 | 329,209,883 | 0 | 0 | null | 2021-01-28T02:59:08 | 2021-01-13T06:03:42 | Java | UTF-8 | Java | false | false | 1,057 | java | package com.javadaily.redditclone.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.lang.Nullable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.IDENTITY;
@Data
@Entity
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Post {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long postId;
@NotNull(message = "Post name cannot be empty or null")
private String postName;
@Nullable
private String url;
@Nullable
@Lob
private String description;
private int voteCount = 0;
private Instant createdDate;
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "userId", referencedColumnName = "userId")
private User user;
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "id", referencedColumnName = "id")
private Subreddit subreddit;
}
| [
"vrahangdale@unomaha.edu"
] | vrahangdale@unomaha.edu |
a16bd822f4dcd09a5346221e2f5d9847bf14c90e | 1f41517e7b1a1725f1ea92da2fee1a27608883c5 | /app/src/main/java/com/aceplus/samparoo/credit_collection/CreditCheckOut_Activity.java | 061692feeaa50d5ab3caff8e3bd616eb871920cb | [] | no_license | Haker712/DMS | 3d3d1313cc53f8857db7f910d61a94ac43e0b44f | d793a4d5ff45edd384f4ea9408224f40b147931e | refs/heads/master | 2020-03-07T04:28:11.870507 | 2017-03-06T04:19:31 | 2017-03-06T04:19:31 | 127,267,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,994 | java | package com.aceplus.samparoo.credit_collection;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.aceplus.samparoo.R;
import com.aceplus.samparoo.model.CreditInvoice;
import com.aceplus.samparoo.model.CreditInvoiceItems;
import com.aceplus.samparoo.utils.Database;
import com.aceplus.samparoo.utils.Utils;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class CreditCheckOut_Activity extends Activity {
private ListView creditListView;
private TextView totalAmountTxt;
private TextView totalAdvancePayTxt;
private TextView remainingPayAmountTxt;
private TextView customerNameTxt;
private TextView dateTxt;
private TextView invnoTxt;
private TextView invnoTotalAmountTxt;
private TextView invnoPayAmountTxt;
private TextView invnoCreditAmountTxt;
private TextView refundTxt;
private EditText payAmountEdit;
private EditText itemPayEdit;
private EditText receiptEdit;
private LinearLayout totalLayout;
private LinearLayout totalPayLayout;
private LinearLayout itemPayLayout;
private ImageView cancelImg, saveImg;
SQLiteDatabase database;
SimpleDateFormat fmtForInvoiceTodayStr = new SimpleDateFormat("yyMMdd");
DecimalFormat invoiceFormat = new DecimalFormat("000");
ArrayList<CreditInvoice> creditInvoiceList = new ArrayList<>();
ArrayList<CreditInvoice> creditInvoiceSaveList = new ArrayList<>();
ArrayList<CreditInvoiceItems> creditInvoiceItemsList = new ArrayList<>();
public static String creditCustomer;
public static String creditCustomerAddress;
public static String customerId;
public static String creditId;
private String creditInvoiceId;
String creditDate;
String invoiceId;
private static int listviewPosition = 0;
public static double amount = 0.0;
public static double paidAmount = 0.0;
public static double unPaidAmount = 0.0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_credit_collection);
creditDate = new SimpleDateFormat("yyyy/MM/dd").format(new Date());
database = new Database(this).getDataBase();
registerIDs();
getCreditInvoiceData();
// makeInvoiceNo(this);
catchEvents();
}
private void registerIDs() {
creditListView = (ListView) findViewById(R.id.creditcollection_list);
totalAmountTxt = (TextView) findViewById(R.id.total_amount_txt);
totalAdvancePayTxt = (TextView) findViewById(R.id.total_advance_pay_txt);
remainingPayAmountTxt = (TextView) findViewById(R.id.remaining_pay_amount_txt);
customerNameTxt = (TextView) findViewById(R.id.customer_name_txt);
dateTxt = (TextView) findViewById(R.id.date_txt);
invnoTxt = (TextView) findViewById(R.id.invno_txt);
invnoTotalAmountTxt = (TextView) findViewById(R.id.invno_total_amount_txt);
invnoPayAmountTxt = (TextView) findViewById(R.id.invno_pay_amount_txt);
invnoCreditAmountTxt = (TextView) findViewById(R.id.invno_credit_amount_txt);
refundTxt = (TextView) findViewById(R.id.refund_txt);
payAmountEdit = (EditText) findViewById(R.id.payment_amount_edit);
itemPayEdit = (EditText) findViewById(R.id.item_pay_edit);
receiptEdit = (EditText) findViewById(R.id.receipt_person_edit);
totalLayout = (LinearLayout) findViewById(R.id.total_layout);
totalPayLayout = (LinearLayout) findViewById(R.id.total_pay_layout);
itemPayLayout = (LinearLayout) findViewById(R.id.item_pay_layout);
cancelImg = (ImageView) findViewById(R.id.cancel_img);
saveImg = (ImageView) findViewById(R.id.save_img);
}
private void catchEvents() {
customerNameTxt.setText(creditCustomer);
dateTxt.setText(creditDate);
invnoTxt.setText(invoiceId);
payAmountEdit.setText(null);
itemPayEdit.setText(null);
final ArrayAdapter<CreditInvoice> credditArrayAdapter = new CreditCollectAdapter(this);
creditListView.setAdapter(credditArrayAdapter);
creditListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
totalPayLayout.setVisibility(View.GONE);
itemPayLayout.setVisibility(View.VISIBLE);
listviewPosition = position;
CreditInvoice creditInvoice = creditInvoiceList.get(position);
customerNameTxt.setText(creditCustomer);
dateTxt.setText(creditInvoice.getInvoiceDate());
invnoTxt.setText(creditInvoice.getInvoiceId());
invnoTotalAmountTxt.setText(Utils.formatAmount(creditInvoice.getAmount()));
invnoPayAmountTxt.setText(Utils.formatAmount(creditInvoice.getPaidAmount()));
invnoCreditAmountTxt.setText(Utils.formatAmount(creditInvoice.getCreditAmount()));
itemPayEdit.setText(null);
}
});
totalLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
totalPayLayout.setVisibility(View.VISIBLE);
itemPayLayout.setVisibility(View.GONE);
credditArrayAdapter.notifyDataSetChanged();
customerNameTxt.setText(creditCustomer);
dateTxt.setText(creditDate);
invnoTxt.setText(invoiceId);
double totalAmountStr = Double.parseDouble(totalAmountTxt.getText().toString().replace(",", ""));
double advancePayStr = Double.parseDouble(totalAdvancePayTxt.getText().toString().replace(",", ""));
double remainingPaystr = Double.parseDouble(remainingPayAmountTxt.getText().toString().replace(",", ""));
invnoTotalAmountTxt.setText(Utils.formatAmount(totalAmountStr));
invnoPayAmountTxt.setText(Utils.formatAmount(advancePayStr));
invnoCreditAmountTxt.setText(Utils.formatAmount(remainingPaystr));
payAmountEdit.setText(null);
}
});
creditListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
View dialogBoxView = getLayoutInflater().inflate(R.layout.dialog_box_credit_sale_product, null);
ListView saleProductListView = (ListView) dialogBoxView.findViewById(R.id.credit_sale_product_list);
creditInvoiceItemsList.clear();
CreditInvoice creditInvoice = creditInvoiceList.get(position);
creditInvoiceId = creditInvoice.getInvoiceId();
getCreditInvoiceItemsData();
saleProductListView.setAdapter(new SaleProductArrayAdapter(CreditCheckOut_Activity.this));
new AlertDialog.Builder(CreditCheckOut_Activity.this)
.setView(dialogBoxView)
.setTitle("Credit Sale Products")
.setPositiveButton("OK", null)
.show();
return true;
}
});
itemPayEdit.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence charSequence, int arg1, int arg2, int arg3) {
if (charSequence.toString().length() > 0) {
String convertedString = charSequence.toString();
convertedString = Utils.formatAmount(Double.parseDouble(charSequence.toString().replace(",", "")));
if (!itemPayEdit.getText().toString().equals(convertedString)
&& convertedString.length() > 0) {
itemPayEdit.setText(convertedString);
itemPayEdit.setSelection(itemPayEdit.getText().length());
}
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
}
@Override
public void afterTextChanged(Editable editable) {
String tempPayAmount = editable.toString().replace(",", "");
String tempNetAmount = invnoTotalAmountTxt.getText().toString().replace(",", "");
if (tempPayAmount.length() > 0 && tempNetAmount.length() > 0) {
if (Double.parseDouble(tempPayAmount) >= Double.parseDouble(tempNetAmount)) {
refundTxt.setText(Utils.formatAmount(Double.parseDouble(tempPayAmount) - Double.parseDouble(tempNetAmount)));
String str = "paid";
CreditInvoice creditInvoice = creditInvoiceList.get(listviewPosition);
double totalAmt = Double.valueOf(invnoTotalAmountTxt.getText().toString().replace(",", ""));
double creditAmt = 0;
creditInvoice.setStatus(str);
creditInvoice.setPaidAmount(totalAmt);
creditInvoice.setCreditAmount(creditAmt);
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(totalAmt));
invnoCreditAmountTxt.setText(Utils.formatAmount(creditAmt));
} else {
refundTxt.setText(Utils.formatAmount(Double.parseDouble(tempPayAmount) - Double.parseDouble(tempNetAmount)));
String str = "unpaid";
CreditInvoice creditInvoice = creditInvoiceList.get(listviewPosition);
double payAmt = Double.valueOf(invnoPayAmountTxt.getText().toString().replace(",", ""));
double tempPay = Double.parseDouble(tempPayAmount);
double payTotal = payAmt + tempPay;
double creditTotal = Double.parseDouble(tempNetAmount) - Double.parseDouble(tempPayAmount);
creditInvoice.setStatus(str);
creditInvoice.setPaidAmount(payTotal);
creditInvoice.setCreditAmount(creditTotal);
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(payTotal));
invnoCreditAmountTxt.setText(Utils.formatAmount(creditTotal));
}
} else {
refundTxt.setText("0");
String str = "unpaid";
CreditInvoice creditInvoice = creditInvoiceList.get(listviewPosition);
double payAmt = Double.valueOf(invnoPayAmountTxt.getText().toString().replace(",", ""));
double creditAmt = Double.valueOf(invnoCreditAmountTxt.getText().toString().replace(",", ""));
creditInvoice.setStatus(str);
creditInvoice.setPaidAmount(payAmt);
creditInvoice.setCreditAmount(creditAmt);
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(payAmt));
invnoCreditAmountTxt.setText(Utils.formatAmount(creditAmt));
}
}
});
payAmountEdit.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence charSequence, int arg1, int arg2, int arg3) {
if (charSequence.toString().length() > 0) {
String convertedString = charSequence.toString();
convertedString = Utils.formatAmount(Double.parseDouble(charSequence.toString().replace(",", "")));
if (!payAmountEdit.getText().toString().equals(convertedString)
&& convertedString.length() > 0) {
payAmountEdit.setText(convertedString);
payAmountEdit.setSelection(payAmountEdit.getText().length());
}
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
}
@Override
public void afterTextChanged(Editable editable) {
String tempPayAmount = editable.toString().replace(",", "");
String tempNetAmount = invnoTotalAmountTxt.getText().toString().replace(",", "");
for (int i = 0; i < creditInvoiceList.size(); i++) {
credditArrayAdapter.notifyDataSetChanged();
CreditInvoice creditInvoice = creditInvoiceList.get(i);
double paidValue = creditInvoice.getPaidAmount();
double creditValue = creditInvoice.getCreditAmount();
CreditInvoice saveCredit = new CreditInvoice();
saveCredit.setPaidAmount(paidValue);
saveCredit.setCreditAmount(creditValue);
creditInvoiceSaveList.add(saveCredit);
}
if (tempPayAmount.length() > 0 && tempNetAmount.length() > 0) {
if (Double.parseDouble(tempPayAmount) >= Double.parseDouble(tempNetAmount)) {
refundTxt.setText(Utils.formatAmount(Double.parseDouble(tempPayAmount) - Double.parseDouble(tempNetAmount)));
String str = "paid";
double paidValue = 0.0;
double creditAmt = 0.0;
double paidValueTotal = 0.0;
for (int i = 0; i < creditInvoiceList.size(); i++) {
CreditInvoice creditInvoice = creditInvoiceList.get(i);
paidValue = creditInvoice.getAmount();
paidValueTotal += paidValue;
creditInvoice.setPaidAmount(paidValue);
creditInvoice.setCreditAmount(creditAmt);
creditInvoice.setStatus(str);
}
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(paidValueTotal));
invnoCreditAmountTxt.setText(Utils.formatAmount(creditAmt));
} else {
refundTxt.setText(Utils.formatAmount(Double.parseDouble(tempPayAmount) - Double.parseDouble(tempNetAmount)));
String str = "unpaid";
double paidValue = 0.0;
double unPaidValue = 0.0;
double paidValueTotal = 0.0;
double unPaidValueTotal = 0.0;
for (int i = 0; i < creditInvoiceList.size(); i++) {
CreditInvoice savecreditInvoice = creditInvoiceSaveList.get(i);
paidValue = savecreditInvoice.getPaidAmount();
unPaidValue = savecreditInvoice.getCreditAmount();
paidValueTotal += paidValue;
unPaidValueTotal += unPaidValue;
CreditInvoice creditInvoice = creditInvoiceList.get(i);
creditInvoice.setPaidAmount(paidValue);
creditInvoice.setCreditAmount(unPaidValue);
creditInvoice.setStatus(str);
}
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(paidValueTotal));
invnoCreditAmountTxt.setText(Utils.formatAmount(unPaidValueTotal));
}
} else {
refundTxt.setText("0");
String str = "unpaid";
double paidValue = 0.0;
double unPaidValue = 0.0;
double paidValueTotal = 0.0;
double unPaidValueTotal = 0.0;
for (int i = 0; i < creditInvoiceList.size(); i++) {
CreditInvoice savecreditInvoice = creditInvoiceSaveList.get(i);
paidValue = savecreditInvoice.getPaidAmount();
unPaidValue = savecreditInvoice.getCreditAmount();
paidValueTotal += paidValue;
unPaidValueTotal += unPaidValue;
CreditInvoice creditInvoice = creditInvoiceList.get(i);
creditInvoice.setPaidAmount(paidValue);
creditInvoice.setCreditAmount(unPaidValue);
creditInvoice.setStatus(str);
}
credditArrayAdapter.notifyDataSetChanged();
invnoPayAmountTxt.setText(Utils.formatAmount(paidValueTotal));
invnoCreditAmountTxt.setText(Utils.formatAmount(unPaidValueTotal));
}
}
});
cancelImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(CreditCheckOut_Activity.this, CreditCollectActivity.class));
finish();
}
});
saveImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (receiptEdit.getText().toString().length() == 0) {
new AlertDialog.Builder(CreditCheckOut_Activity.this)
.setTitle("Alert")
.setMessage("Your must provide 'Receipt Person'.")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
receiptEdit.requestFocus();
}
})
.show();
return;
}
insertIntoDB();
Utils.backToCustomerVisit(CreditCheckOut_Activity.this);
}
});
}
private void getCreditInvoiceData() {
database.beginTransaction();
Cursor cursor = database.rawQuery(
"SELECT CREDIT_ID,INV_ID,INV_DATE,TOTAL_AMT,FLAG,PAID_AMT FROM CREDIT_INVOICE"
+ " WHERE CREDIT_ID = \"" + creditId + "\""
, null);
creditInvoiceList.clear();
while (cursor.moveToNext()) {
String invoiceId = cursor.getString(cursor.getColumnIndex("INV_ID"));
String invoiceDate = cursor.getString(cursor.getColumnIndex("INV_DATE"));
double Amt = cursor.getDouble(cursor.getColumnIndex("TOTAL_AMT"));
double paidAmt = cursor.getDouble(cursor.getColumnIndex("PAID_AMT"));
String flag = cursor.getString(cursor.getColumnIndex("FLAG"));
CreditInvoice creditInvoice = new CreditInvoice();
creditInvoice.setInvoiceId(invoiceId);
creditInvoice.setInvoiceDate(invoiceDate);
creditInvoice.setAmount(Amt);
creditInvoice.setPaidAmount(paidAmt);
creditInvoice.setCreditAmount(Amt - paidAmt);
creditInvoice.setStatus(flag);
creditInvoiceList.add(creditInvoice);
}
cursor.close();
database.setTransactionSuccessful();
database.endTransaction();
}
private void getCreditInvoiceItemsData() {
database.beginTransaction();
Cursor cursor = database.rawQuery(
"SELECT INV_ID,PRODUCT_ID,QTY,DISCOUNT FROM CREDIT_ITEMS"
+ " WHERE INV_ID = \"" + creditInvoiceId + "\""
, null);
creditInvoiceItemsList.clear();
while (cursor.moveToNext()) {
String productName = cursor.getString(cursor.getColumnIndex("PRODUCT_ID"));
double quantity = cursor.getDouble(cursor.getColumnIndex("QTY"));
double discount = cursor.getDouble(cursor.getColumnIndex("DISCOUNT"));
CreditInvoiceItems creditInvoiceItems = new CreditInvoiceItems();
creditInvoiceItems.setProductName(productName);
creditInvoiceItems.setQuantity(quantity);
creditInvoiceItems.setDiscount(discount);
creditInvoiceItemsList.add(creditInvoiceItems);
}
cursor.close();
database.setTransactionSuccessful();
database.endTransaction();
}
private void insertIntoDB() {
double saveAmount = 0.0;
double savePaidAmount = 0.0;
double saveUnPaidAmount = 0.0;
String flag = null;
database.beginTransaction();
for (CreditInvoice creditInvoice : creditInvoiceList) {
saveAmount += creditInvoice.getAmount();
savePaidAmount += creditInvoice.getPaidAmount();
saveUnPaidAmount += creditInvoice.getAmount()- creditInvoice.getPaidAmount();
flag = creditInvoice.getStatus();
String arg[] = {creditInvoice.getInvoiceId()};
ContentValues cv = new ContentValues();
cv.put("FLAG",flag);
cv.put("PAID_AMT",creditInvoice.getPaidAmount());
database.update("CREDIT_INVOICE", cv, "INV_ID LIKE ?", arg);
}
String arg[] = {creditId};
ContentValues cvCredit = new ContentValues();
cvCredit.put("PAID_AMT", savePaidAmount);
cvCredit.put("CREDIT_AMT", saveUnPaidAmount);
cvCredit.put("FLAG", flag);
database.update("CREDIT", cvCredit, "CREDIT_ID LIKE ?", arg);
database.setTransactionSuccessful();
database.endTransaction();
}
public class CreditCollectAdapter extends ArrayAdapter<CreditInvoice> {
private final Activity context;
public CreditCollectAdapter(Activity context) {
super(context, R.layout.credit_collection_list_row, creditInvoiceList);//creditList
this.context = context;
}
@Override
public View getView(final int position, View view, ViewGroup parent) {
CreditInvoice creditInv = creditInvoiceList.get(position);
double tamount = 0.0;
double tpaidAmount = 0.0;
double tremainingAmount = 0.0;
for (int i = 0; i < creditInvoiceList.size(); i++) {
CreditInvoice creditInvoice = creditInvoiceList.get(i);
tamount += creditInvoice.getAmount();
tpaidAmount += creditInvoice.getPaidAmount();
tremainingAmount += creditInvoice.getCreditAmount();
}
totalAmountTxt.setText(Utils.formatAmount(tamount));
totalAdvancePayTxt.setText(Utils.formatAmount(tpaidAmount));
remainingPayAmountTxt.setText(Utils.formatAmount(tremainingAmount));
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.credit_collection_list_row, null, true);
TextView invId = (TextView) rowView.findViewById(R.id.invoice_id);
TextView invdate = (TextView) rowView.findViewById(R.id.invoice_date);
TextView invAmt = (TextView) rowView.findViewById(R.id.invoice_amount);
TextView statusTxt = (TextView) rowView.findViewById(R.id.status_txt);
invId.setText(creditInv.getInvoiceId());
invdate.setText(creditInv.getInvoiceDate());
invAmt.setText(Utils.formatAmount(creditInv.getAmount()));
statusTxt.setText(creditInv.getStatus());
return rowView;
}
}
private class SaleProductArrayAdapter extends ArrayAdapter<CreditInvoiceItems> {
public final Activity context;
public SaleProductArrayAdapter(Activity context) {
super(context, R.layout.list_row_credit_sale_products, creditInvoiceItemsList);
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CreditInvoiceItems creditInvoiceItems = creditInvoiceItemsList.get(position);
LayoutInflater layoutInflater = context.getLayoutInflater();
View view = layoutInflater.inflate(R.layout.list_row_credit_sale_products, null, true);
TextView productNameTextView = (TextView) view.findViewById(R.id.credit_name);
TextView quantityTextView = (TextView) view.findViewById(R.id.credit_qty);
TextView priceTextView = (TextView) view.findViewById(R.id.credit_price);
TextView discountTextView = (TextView) view.findViewById(R.id.credit_discount);
TextView totalAmtTextView = (TextView) view.findViewById(R.id.credit_totalAmt);
productNameTextView.setText(creditInvoiceItems.getProductName());
quantityTextView.setText(Utils.formatAmount(creditInvoiceItems.getQuantity()));
priceTextView.setText(Utils.formatAmount(creditInvoiceItems.getPrice()));
discountTextView.setText(Utils.formatAmount(creditInvoiceItems.getDiscount()));
totalAmtTextView.setText(Utils.formatAmount(creditInvoiceItems.getTotalAmount()));
return view;
}
}
}
| [
"htetaungkyaw@aceplussolutions.com"
] | htetaungkyaw@aceplussolutions.com |
3a12b1ce147e71a007e17614ffc9669b5a29023b | 800e086143df291de38c2f17109f184bf964ae8c | /src/autobus/Autobus.java | 570ef62957604c115bae02d9bbfdcbe7b69f1de4 | [] | no_license | JovanaJovanaJovana/Java | 1682cec82270830777dbb730cc98244ccd16c8f8 | 5681b8c8d073caf62f6d9cd55f275a4ba911d316 | refs/heads/master | 2021-04-20T11:28:38.543313 | 2020-03-26T11:02:57 | 2020-03-26T11:02:57 | 249,679,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,069 | java | package autobus;
/* Autobus poseduje naziv, vozaca, cenu karte i listu putnika koji se
* njime voze. Naziv i cena karte i zadaju se prilikom kreiranja.
* Moguce je dodati/ukloniti putnika kao i vozaca. Moguce je naplatiti
* kartu putnicima samo ako je vozac prisutan. Autobus ispisati u sledecem
* obliku: Naziv ( vozac - Putnik1[novac], Putnik2 [novac],... ) */
public class Autobus {
private String naziv;
private Vozac vozac;
private double cenaKarte;
private Putnik[] putnici;
private int brSedista;
public Autobus(String naziv, Vozac vozac, double cenaKarte, int brSedista) {
this.naziv = naziv;
this.vozac = vozac;
this.cenaKarte = cenaKarte;
putnici = new Putnik[brSedista];
}
public void dodajPutnika(Putnik p, int mesto) {
if (putnici[mesto] == null) {
putnici[mesto] = p;
System.out.println("Uspesno dodovanje putnika na sediste " + mesto);
} else
System.out.println("Neuspesno dodavanje putnika. Sva sedista su zauzeta.");
}
public void ukloniPutnika(Putnik p, int mesto) {
if (putnici[mesto] == p) {
putnici[mesto] = null;
System.out.println("Uspesno je otkazana rezervacija putnika " + p + " sa sedista " + mesto);
}
}
public void dodajVozaca(Vozac vozac) {
if (this.vozac == null) {
this.vozac = vozac;
System.out.println("Uspesno dodavanje vozaca.");
}
}
public void ukloniVozaca() {
if (this.vozac != null) {
this.vozac = null;
System.out.println("Uspesno uklonjen vozac.");
}
}
public void naplataKarte(Putnik p) {
if (this.vozac != null) {
p.oduzmiNovac(this.cenaKarte);
System.out.println(p.getIme() + " ima jos " + p.getNovac() + " dinara.");
} else
System.out.println("Nema vozaca u autobusu, ne mogu se naplatiti karte!");
}
@Override
public String toString() {
String s = "prevoznik: " + this.naziv + ", cena karte: " + this.cenaKarte + ", slobodna mesta: "
+ this.brSedista + "." + "\n";
s += this.vozac + "\n";
for (int i = 0; i < putnici.length; i++) {
if (putnici[i] != null)
s += putnici[i] + "\n";
}
return s;
}
}
| [
"jovanapetroviciu1371@gmail.com"
] | jovanapetroviciu1371@gmail.com |
ab950e98097849d297387db4bfeadf90ef879bb9 | 2cf25b9af85e4d1de59f783a84532bfb35e8779f | /src/com/kolmikra/Point.java | ba772553e86f36af04161574da7bd728811c9326 | [] | no_license | Kir725/Ex_Object_Oriented_Programming | bc1bf04fba8d0338f8eb9264689305cf94667517 | 99c8181c34a91f4408cee791307292bdab5b0cf6 | refs/heads/master | 2021-05-17T00:33:38.970347 | 2020-03-27T13:15:29 | 2020-03-27T13:15:29 | 250,538,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package com.kolmikra;
import java.util.Objects;
public final class Point {
private final double x;
private final double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public Point translate(double dx, double dy) {
return new Point(this.x + dx, this.y + dy);
}
public Point scale(double scaleCoeff) {
return new Point(this.x * scaleCoeff, this.y * scaleCoeff);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Point point = (Point) o;
return Double.compare(point.x, x) == 0 &&
Double.compare(point.y, y) == 0;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
@Override
public String toString() {
return "Point{" +
"x=" + x +
", y=" + y +
'}';
}
}
| [
"kir-safronov@ya.ru"
] | kir-safronov@ya.ru |
48779bef8a03f5e93406cb18f9beff1922dd625e | fc55309d64851427e73f5bf5f7a0a5b53ff10451 | /Module-2/T03.02-Exercise-ViewHolder/app/src/main/java/com/example/android/recyclerview/GreenAdapter.java | 23e30e4506d43784a8fa2b0d509ed9accd606195 | [] | no_license | shravyamutyapu/6100_MP | e7d4f09716281e09f316952603477be9468a5e92 | ad1f22487115d1e8c2a00b0e5dbb0e800142a364 | refs/heads/master | 2020-04-28T03:17:00.793443 | 2019-03-25T05:52:35 | 2019-03-25T05:52:35 | 174,930,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,001 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.recyclerview;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* We couldn't come up with a good name for this class. Then, we realized
* that this lesson is about RecyclerView.
*
* RecyclerView... Recycling... Saving the planet? Being green? Anyone?
* #crickets
*
* Avoid unnecessary garbage collection by using RecyclerView and ViewHolders.
*
* If you don't like our puns, we named this Adapter GreenAdapter because its
* contents are green.
*/
public class GreenAdapter extends RecyclerView.Adapter<GreenAdapter.NumberViewHolder> {
// TODO (1) Create a layout resource in res/layout/ called number_list_item.xml
// Do steps 2 - 11 within number_list_item.xml
// TODO (2) Make the root layout a FrameLayout
// TODO (3) Make the width match_parent and the height wrap_content
// TODO (4) Set the padding to 16dp
// TODO (5) Add a TextView as the only child of the FrameLayout
// TODO (6) Give the TextView an ID "@+id/tv_item_number"
// TODO (7) Set the height and width to wrap_content
// TODO (8) Align the TextView to the start of the parent
// TODO (9) Center the TextView vertically in the layout
// TODO (10) Set the font family to monospace
// TODO (11) Set the text size to 42sp
private static final String TAG = GreenAdapter.class.getSimpleName();
private int mNumberItems;
/**
* Constructor for GreenAdapter that accepts a number of items to display and the specification
* for the ListItemClickListener.
*
* @param numberOfItems Number of items to display in list
*/
public GreenAdapter(int numberOfItems) {
mNumberItems = numberOfItems;
}
/**
*
* This gets called when each new ViewHolder is created. This happens when the RecyclerView
* is laid out. Enough ViewHolders will be created to fill the screen and allow for scrolling.
*
* @param viewGroup The ViewGroup that these ViewHolders are contained within.
* @param viewType If your RecyclerView has more than one type of item (which ours doesn't) you
* can use this viewType integer to provide a different layout. See
* {@link android.support.v7.widget.RecyclerView.Adapter#getItemViewType(int)}
* for more details.
* @return A new NumberViewHolder that holds the View for each list item
*/
@Override
public NumberViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
Context context = viewGroup.getContext();
int layoutIdForListItem = R.layout.number_list_item;
LayoutInflater inflater = LayoutInflater.from(context);
boolean shouldAttachToParentImmediately = false;
View view = inflater.inflate(layoutIdForListItem, viewGroup, shouldAttachToParentImmediately);
NumberViewHolder viewHolder = new NumberViewHolder(view);
return viewHolder;
}
/**
* OnBindViewHolder is called by the RecyclerView to display the data at the specified
* position. In this method, we update the contents of the ViewHolder to display the correct
* indices in the list for this particular position, using the "position" argument that is conveniently
* passed into us.
*
* @param holder The ViewHolder which should be updated to represent the contents of the
* item at the given position in the data set.
* @param position The position of the item within the adapter's data set.
*/
@Override
public void onBindViewHolder(NumberViewHolder holder, int position) {
Log.d(TAG, "#" + position);
holder.bind(position);
}
/**
* This method simply returns the number of items to display. It is used behind the scenes
* to help layout our Views and for animations.
*
* @return The number of items available in our forecast
*/
@Override
public int getItemCount() {
return mNumberItems;
}
class NumberViewHolder extends RecyclerView.ViewHolder{
TextView listItemNumberView;
public NumberViewHolder(View itemView) {
super(itemView);
listItemNumberView = (TextView) itemView.findViewById(R.id.tv_item_number);
}
public void bind(int ListIndex){
listItemNumberView.setText(String.valueOf(ListIndex));
}
}
// TODO (12) Create a class called NumberViewHolder that extends RecyclerView.ViewHolder
// TODO (13) Within NumberViewHolder, create a TextView variable called listItemNumberView
// TODO (14) Create a constructor for NumberViewHolder that accepts a View called itemView as a parameter
// TODO (15) Within the constructor, call super(itemView) and then find listItemNumberView by ID
// TODO (16) Within the NumberViewHolder class, create a void method called bind that accepts an int parameter called listIndex
// TODO (17) Within bind, set the text of listItemNumberView to the listIndex
// TODO (18) Be careful to get the String representation of listIndex, as using setText with an int does something different
}
| [
"shravyamutyapu1840@msitprogram.net"
] | shravyamutyapu1840@msitprogram.net |
c3ef73853d562129d72362105df5e5f1654aa5b0 | 8eddcbc327fda219a9b826c504aa62ad40b698ef | /src/main/java/requious/compat/jei/slot/FluidSlot.java | 5fa66f4fe5a8ca293f0a7385fd7ad6dc7ad8cd35 | [
"MIT"
] | permissive | DaedalusGame/RequiousFrakto | ef192ef3c58adace1c4cf3a210fdc7b063437104 | f7b9c590dc461cc4cd359d68eb3f46a4960970a2 | refs/heads/master | 2021-06-25T00:51:56.411684 | 2021-02-27T01:46:42 | 2021-02-27T01:46:42 | 203,609,005 | 10 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,007 | java | package requious.compat.jei.slot;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import requious.Requious;
import requious.compat.jei.IngredientCollector;
import requious.compat.jei.JEISlot;
import requious.util.Misc;
import java.util.ArrayList;
import java.util.List;
public class FluidSlot extends JEISlot {
public List<FluidStack> fluids = new ArrayList<>();
public FillNormalizer normalizer = new FillNormalizer();
public FluidSlot(int x, int y, String group) {
super(x, y, group);
}
@Override
public boolean isFilled() {
return !fluids.isEmpty();
}
@Override
public void resetFill() {
super.resetFill();
fluids.clear();
}
public void addFluid(FluidStack fluid) {
fluids.add(fluid);
normalizer.add(fluid.amount);
}
@Override
public JEISlot copy() {
FluidSlot fluidSlot = new FluidSlot(x,y,group);
fluidSlot.normalizer = normalizer;
return fluidSlot;
}
@Override
public void getIngredients(IngredientCollector collector) {
for (FluidStack fluid : fluids) {
if(isInput())
collector.addInput(VanillaTypes.FLUID,fluid);
else
collector.addOutput(VanillaTypes.FLUID,fluid);
}
}
@Override
public void render(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
minecraft.getTextureManager().bindTexture(new ResourceLocation(Requious.MODID,"textures/gui/assembly_slots.png"));
Misc.drawTexturedModalRect(x*18,y*18, 18, 0, 18,18);
}
public static class FillNormalizer {
int highestFill;
public void add(int amount) {
if(amount > highestFill)
highestFill = amount;
}
public int get() {
return highestFill;
}
}
}
| [
"bordlistian@hotmail.de"
] | bordlistian@hotmail.de |
7d914b6ad47abbc5d674590073bb11f159428483 | b1c4d96084f5afe7d356309d5cebb03988f4b736 | /src/main/java/com/bigdata/flink/window/SocketSourceEventTimeTumblingWindow.java | 1ce260a93fb76daa3098a2b078dd917d611605cf | [] | no_license | Spencerzsp/flink-java | 058d206f76c3f679d1949e247155dd97149f7ab4 | 153b41816ebc6d2dd57034e9d4d4f9e57b8d92e1 | refs/heads/master | 2023-01-31T22:25:06.103670 | 2020-12-05T08:47:46 | 2020-12-05T08:47:46 | 318,741,842 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,100 | java | package com.bigdata.flink.window;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.KeyedStream;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.datastream.WindowedStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.timestamps.BoundedOutOfOrdernessTimestampExtractor;
import org.apache.flink.streaming.api.windowing.assigners.TumblingEventTimeWindows;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer;
import java.util.Properties;
/**
* @ author spencer
* @ date 2020/5/26 16:29
* 使用EventTime,划分滚动窗口
* 如果使用的是并行的Source,例如kafkaSource,创建kafka的topic时有多个分区
* 每一个窗口中的Source的分区都要满足触发的条件,整个窗口才会触发
*/
public class SocketSourceEventTimeTumblingWindow {
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//设置系统处理的时间为EventTime,默认为ProcessingTime
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
SingleOutputStreamOperator<String> lines = env.socketTextStream("localhost", 8888)
//仅仅是从数据中提取一个字段作为eventTime,原来的数据不变
//Time.seconds(2)延迟2s触发
.assignTimestampsAndWatermarks(new BoundedOutOfOrdernessTimestampExtractor<String>(Time.seconds(2)) {
@Override
public long extractTimestamp(String line) {
String[] fields = line.split(",");
return Long.parseLong(fields[0]);
}
});
SingleOutputStreamOperator<Tuple2<String, Integer>> wordAndCount = lines.map(new MapFunction<String, Tuple2<String, Integer>>() {
@Override
public Tuple2<String, Integer> map(String line) throws Exception {
String[] fields = line.split(",");
String word = fields[1];
int count = Integer.parseInt(fields[2]);
return Tuple2.of(word, count);
}
});
KeyedStream<Tuple2<String, Integer>, Tuple> keyed = wordAndCount.keyBy(0);
WindowedStream<Tuple2<String, Integer>, Tuple, TimeWindow> window = keyed.window(TumblingEventTimeWindows.of(Time.seconds(5)));
window.sum(1).print();
env.execute("KafkaSourceEventTimeTumblingWindow");
}
}
| [
"spencer_spark@sina.com"
] | spencer_spark@sina.com |
68547cf2a93becf8a136e78644f4ddb2420f22af | 2f2cf576eea4792c09cc0611e79caa655ed4d9a8 | /src/java/com/exam/StudentDAO.java | 6d4d0863b7251f369e1b25c3198c4c919328ab6d | [] | no_license | shahidur24/SpringMvcCRUDvalidation | 48fd66bd21d43d9c380bfd6d8240dd6771772bf2 | ef46f5090aa9bb3a3e7a95c2701c4bf68b2e62f6 | refs/heads/master | 2020-11-24T02:06:36.874301 | 2019-12-13T20:45:26 | 2019-12-13T20:45:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,754 | 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.exam;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
/**
*
* @author APCL
*/
public class StudentDAO {
public void doSave(Student stu){
Session s = NewHibernateUtil.getSessionFactory().openSession();
s.beginTransaction();
s.save(stu);
s.getTransaction().commit();
s.close();
}
public void doUpppdate(Student stu){
Session s = NewHibernateUtil.getSessionFactory().openSession();
s.beginTransaction();
s.update(stu);
s.getTransaction().commit();
s.close();
}
public void doDelete(Student stu){
Session s = NewHibernateUtil.getSessionFactory().openSession();
s.beginTransaction();
s.delete(stu);
s.getTransaction().commit();
s.close();
}
public List<Student> findAllInfo(Student stu){
Session s = NewHibernateUtil.getSessionFactory().openSession();
List<Student> li = new ArrayList<>();
li=s.createCriteria(Student.class).list();
s.close();
return li;
}
public boolean checkUser(int id, String p){
Session s = NewHibernateUtil.getSessionFactory().openSession();
Query q = s.createQuery("From Student where id=:a and password=:b");
q.setParameter("a", id);
q.setParameter("b", p);
List<Student> li = new ArrayList<>();
li=q.list();
if (li.size()>0) {
return true;
} else {
return false;
}
}
}
| [
"TEACHER@TEACHER-PC"
] | TEACHER@TEACHER-PC |
ae2596e993f29a13a371e3ccdc6b157a95fbcd79 | 4134b133c37df9d7383c7dd3f17624ee9781a71a | /app/build/generated/source/r/androidTest/debug/edu/wisc/ece/testtwooooo/test/R.java | 35b60c55f6c057b1e8964f65bbf041c6f5071583 | [] | no_license | Joseph555/practiceAppTutorial | 93c248ad36a578a4671ffec97e3f8e79998c4c86 | db0a542368fc9c2df0868d3d4a0a6497afc301dd | refs/heads/master | 2021-07-09T09:31:40.436744 | 2017-10-05T19:35:14 | 2017-10-05T19:35:14 | 105,931,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package edu.wisc.ece.testtwooooo.test;
public final class R {
} | [
"josephkust@Josephs-MacBook-Air.local"
] | josephkust@Josephs-MacBook-Air.local |
8f13de9d4627bdca7ee145286873388ec90e7c51 | 53c60041ec2e58906175b389abd2f15182afbd1d | /mvc_git/src/grade/GradeMemberBean.java | a99be066c70f6ea58b008c14376cd7a17ecad18b | [] | no_license | elqqmffntl1/mvc_git | 5d5a9bbf41dfdbbc1281a965da3ca8a499dedd9b | ac8205ee6cefad6247f6b3bfb32398c3576b6101 | refs/heads/master | 2021-01-19T01:31:42.134517 | 2016-08-17T02:58:28 | 2016-08-17T02:58:28 | 63,742,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,924 | java | package grade;
public class GradeMemberBean {
private String id, grade,seq,examDate,type,pw,name,regDate,gender,ssn,score;
private int java, sql, html, js, birth;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public String getExamDate() {
return examDate;
}
public void setExamDate(String examDate) {
this.examDate = examDate;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPw() {
return pw;
}
public void setPw(String pw) {
this.pw = pw;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRegDate() {
return regDate;
}
public void setRegDate(String regDate) {
this.regDate = regDate;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getSsn() {
return ssn;
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
public int getJava() {
return java;
}
public void setJava(int java) {
this.java = java;
}
public int getSql() {
return sql;
}
public void setSql(int sql) {
this.sql = sql;
}
public int getHtml() {
return html;
}
public void setHtml(int html) {
this.html = html;
}
public int getJs() {
return js;
}
public void setJs(int js) {
this.js = js;
}
public int getBirth() {
return birth;
}
public void setBirth(int birth) {
this.birth = birth;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
}
| [
"elqqmffntl@gmail.com"
] | elqqmffntl@gmail.com |
596da468e4fa094a6fbfc639bbddc77c441fd14d | 5b4fe22282dc91ac38024818ebf8f4289a6e8404 | /aStarExperment/src/main/java/com/graph/read/FindPath.java | 37c45ee80cb8fc3e22d57555a9a910a6c2a01a45 | [] | no_license | hqf1996/Semantic-guided-search | b8beee28160087bf338d1518e60a24a208a7d8b9 | 7cde5114eed34579c3b76ca5df84616d39bb11b3 | refs/heads/master | 2020-09-28T15:22:39.876981 | 2019-12-09T07:04:59 | 2019-12-09T07:04:59 | 226,804,905 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,391 | java | package com.graph.read;
import com.graph.util.Util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
/**
* Created by yhj on 2018/5/29.
* 找到所有的n跳之内的所有路径,用于观察该领域下的图的大致构造
*/
public class FindPath {
private int plies;
private List<List<String>> paths;
private BaseOperate graph;
private BufferedWriter writer;
private Map<String, Integer> countMap;
public FindPath(int plies, String filePath) {
this.plies = plies;
graph = new GraphTableOperate("edge_no_string_complete_source");
paths = new ArrayList<List<String>>();
countMap = new HashMap<String, Integer>();
try {
writer = new BufferedWriter(new FileWriter(new File(filePath)));
}catch (IOException e){
e.printStackTrace();
closeWrite();
}
}
public void clear(){
paths.clear();
}
public List<List<String>> find(Collection<String> c) throws SQLException {
for(String node: c){
//递归取前n条的路径
findNext(new ArrayList<String>(Arrays.asList(node)), 0);
}
closeWrite();
return this.paths;
}
public Map<String, Integer> getCountMap(){
return countMap;
}
private void writePath(List<String> path){
try {
List<String> edges = new ArrayList<String>();
for(int i = 1;i < path.size(); i = i + 2){
edges.add(path.get(i));
}
String pathStr = edges.toString();
if(countMap.containsKey(pathStr)){
countMap.put(pathStr, countMap.get(pathStr) + 1);
}else {
countMap.put(pathStr, 1);
}
writer.write(pathStr);
writer.write("\t" + path.toString() + "\n");
writer.flush();
}catch (IOException e){
e.printStackTrace();
closeWrite();
}
}
private void closeWrite(){
try {
if(writer != null){
writer.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
private void findNext(List<String> path, int n) throws SQLException {
if(n == plies) {
writePath(path);
return;
}
String limit = "where predicate_name != 'type' and entity_id1 = '" + path.get(path.size()-1).replace("'", "\\'") + "'";
List<EdgeSource> list = (List<EdgeSource>)graph.selectLimit(limit);
if(list.size() <= 0){
writePath(path);
return;
}
for(EdgeSource each: list){
List<String> new_path = new ArrayList<String>(path);
new_path.add(each.getPredicate_name());
new_path.add(each.getEntity_id2());
findNext(new_path, n + 1);
}
}
public static void main(String[] args) throws SQLException, IOException {
FindPath findPath = new FindPath(4, "E:\\JavaProjects\\rdf_conputer\\result\\Astronaut\\four_all_path.txt");
List<String> list = Util.readFileRelate("/astronauts_id.txt");
List<List<String>> paths = findPath.find(new ArrayList<String>(list));
findPath.closeWrite();
}
}
| [
"378938941@qq.com"
] | 378938941@qq.com |
56457aaf351b8dce7df12b9ec191e95bf73f33cc | 0f0512a00ba283f140f4d1724ad7922bdbbadddc | /server-base/serverbase-swagger2/src/test/java/com/tgram/base/swagger2/serverbaseswagger2/ServerbaseSwagger2ApplicationTests.java | 24c575f05565bd98523b2c1c3437d757a7b5ee80 | [] | no_license | yelinsen005/Base_Server | f4e977f9555b4ed6bc31561d67687bb03d78aaa3 | ad3c02138d187c618cb091f7c01abb9913b7c628 | refs/heads/master | 2022-11-25T10:13:03.454267 | 2019-11-26T09:37:56 | 2019-11-26T09:37:56 | 222,632,048 | 3 | 0 | null | 2022-11-16T08:59:10 | 2019-11-19T07:12:00 | Java | UTF-8 | Java | false | false | 255 | java | package com.tgram.base.swagger2.serverbaseswagger2;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ServerbaseSwagger2ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"yelinsen05@163.com"
] | yelinsen05@163.com |
f5895772ef0633509b17c24696b6fa79d3501616 | 0ae199a25f8e0959734f11071a282ee7a0169e2d | /utils/misc/src/test/java/org/onlab/util/FrequencyTest.java | 793804430b4465ed5016014027bc1415d9afa53b | [
"Apache-2.0"
] | permissive | lishuai12/onosfw-L3 | 314d2bc79424d09dcd8f46a4c467bd36cfa9bf1b | e60902ba8da7de3816f6b999492bec2d51dd677d | refs/heads/master | 2021-01-10T08:09:56.279267 | 2015-11-06T02:49:00 | 2015-11-06T02:49:00 | 45,652,234 | 0 | 1 | null | 2016-03-10T22:30:45 | 2015-11-06T01:49:10 | Java | UTF-8 | Java | false | false | 3,562 | java | /*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onlab.util;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onlab.junit.ImmutableClassChecker;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
public class FrequencyTest {
private final Frequency frequency1 = Frequency.ofMHz(1000);
private final Frequency sameFrequency1 = Frequency.ofMHz(1000);
private final Frequency frequency2 = Frequency.ofGHz(1000);
private final Frequency sameFrequency2 = Frequency.ofGHz(1000);
private final Frequency moreSameFrequency2 = Frequency.ofTHz(1);
private final Frequency frequency3 = Frequency.ofTHz(193.1);
private final Frequency sameFrequency3 = Frequency.ofGHz(193100);
/**
* Tests immutability of Frequency.
*/
@Test
public void testImmutability() {
ImmutableClassChecker.assertThatClassIsImmutable(Frequency.class);
}
/**
* Tests equality of Frequency instances.
*/
@Test
public void testEquality() {
new EqualsTester()
.addEqualityGroup(frequency1, sameFrequency1)
.addEqualityGroup(frequency2, sameFrequency2, moreSameFrequency2)
.addEqualityGroup(frequency3, sameFrequency3)
.testEquals();
}
/**
* Tests the first object is less than the second object.
*/
@Test
public void testLessThan() {
assertThat(frequency1, is(lessThan(frequency2)));
assertThat(frequency1.isLessThan(frequency2), is(true));
}
@Test
public void testGreaterThan() {
assertThat(frequency2, is(greaterThan(frequency1)));
assertThat(frequency2.isGreaterThan(frequency1), is(true));
}
/**
* Tests add operation of two Frequencies.
*/
@Test
public void testAdd() {
Frequency low = Frequency.ofMHz(100);
Frequency high = Frequency.ofGHz(1);
Frequency expected = Frequency.ofMHz(1100);
assertThat(low.add(high), is(expected));
}
/**
* Tests subtract operation of two Frequencies.
*/
@Test
public void testSubtract() {
Frequency high = Frequency.ofGHz(1);
Frequency low = Frequency.ofMHz(100);
Frequency expected = Frequency.ofMHz(900);
assertThat(high.subtract(low), is(expected));
}
/**
* Tests multiply operation of Frequency.
*/
@Test
public void testMultiply() {
Frequency frequency = Frequency.ofMHz(1000);
long factor = 5;
Frequency expected = Frequency.ofGHz(5);
assertThat(frequency.multiply(5), is(expected));
}
}
| [
"lishuai12@huawei.com"
] | lishuai12@huawei.com |
f3ba584e7f26054415a9afb5336370d19f2087f7 | 53bed03e6b6c011545950344d8bc90683d7ac16f | /src/main/java/com/company/project/configurer/WebMvcConfigurer.java | 7719cb7538f9fa546a2b66ed44d8b709a03ad101 | [] | no_license | lingdianguole/spring-boot-seed | 8ee62601d5fab92266c581028be235df03209eb0 | 59e5a213bb07c5944c77f9e385040324747db9ac | refs/heads/master | 2020-03-27T14:56:48.328884 | 2018-12-07T09:03:14 | 2018-12-07T09:03:14 | 146,688,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,799 | java | package com.company.project.configurer;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.company.project.core.Result;
import com.company.project.core.ResultCode;
import com.company.project.core.ServiceException;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/**
* Spring MVC 配置
*/
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
private final Logger logger = LoggerFactory.getLogger(WebMvcConfigurer.class);
@Value("${spring.profiles.active}")
private String env;//当前激活的配置文件
//使用阿里 FastJson 作为JSON MessageConverter
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(SerializerFeature.WriteMapNullValue);//保留空的字段
//SerializerFeature.WriteNullStringAsEmpty,//String null -> ""
//SerializerFeature.WriteNullNumberAsZero//Number null -> 0
// 按需配置,更多参考FastJson文档哈
converter.setFastJsonConfig(config);
converter.setDefaultCharset(Charset.forName("UTF-8"));
converters.add(converter);
}
//统一异常处理
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
exceptionResolvers.add(new HandlerExceptionResolver() {
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) {
Result result = new Result();
if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误”
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
logger.info(e.getMessage());
} else if (e instanceof NoHandlerFoundException) {
result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + request.getRequestURI() + "] 不存在");
} else if (e instanceof ServletException) {
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
} else {
result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("接口 [" + request.getRequestURI() + "] 内部错误,请联系管理员");
String message;
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
message = String.format("接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s",
request.getRequestURI(),
handlerMethod.getBean().getClass().getName(),
handlerMethod.getMethod().getName(),
e.getMessage());
} else {
message = e.getMessage();
}
logger.error(message, e);
}
responseResult(response, result);
return new ModelAndView();
}
});
}
//解决跨域问题
@Override
public void addCorsMappings(CorsRegistry registry) {
//registry.addMapping("/**");
}
//添加拦截器
@Override
public void addInterceptors(InterceptorRegistry registry) {
//接口签名认证拦截器,该签名认证比较简单,实际项目中可以使用Json Web Token或其他更好的方式替代。
if (!"dev".equals(env)) { //开发环境忽略签名认证
registry.addInterceptor(new HandlerInterceptorAdapter() {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//验证签名
boolean pass = validateSign(request);
if (pass) {
return true;
} else {
logger.warn("签名认证失败,请求接口:{},请求IP:{},请求参数:{}",
request.getRequestURI(), getIpAddress(request), JSON.toJSONString(request.getParameterMap()));
Result result = new Result();
result.setCode(ResultCode.UNAUTHORIZED).setMessage("签名认证失败");
responseResult(response, result);
return false;
}
}
});
}
}
private void responseResult(HttpServletResponse response, Result result) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setStatus(200);
try {
response.getWriter().write(JSON.toJSONString(result));
} catch (IOException ex) {
logger.error(ex.getMessage());
}
}
/**
* 一个简单的签名认证,规则:
* 1. 将请求参数按ascii码排序
* 2. 拼接为a=value&b=value...这样的字符串(不包含sign)
* 3. 混合密钥(secret)进行md5获得签名,与请求的签名进行比较
*/
private boolean validateSign(HttpServletRequest request) {
String requestSign = request.getParameter("sign");//获得请求签名,如sign=19e907700db7ad91318424a97c54ed57
if (StringUtils.isEmpty(requestSign)) {
return false;
}
List<String> keys = new ArrayList<String>(request.getParameterMap().keySet());
keys.remove("sign");//排除sign参数
Collections.sort(keys);//排序
StringBuilder sb = new StringBuilder();
for (String key : keys) {
sb.append(key).append("=").append(request.getParameter(key)).append("&");//拼接字符串
}
String linkString = sb.toString();
linkString = StringUtils.substring(linkString, 0, linkString.length() - 1);//去除最后一个'&'
String secret = "Potato";//密钥,自己修改
String sign = DigestUtils.md5Hex(linkString + secret);//混合密钥md5
return StringUtils.equals(sign, requestSign);//比较
}
private String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
// 如果是多级代理,那么取第一个ip为客户端ip
if (ip != null && ip.indexOf(",") != -1) {
ip = ip.substring(0, ip.indexOf(",")).trim();
}
return ip;
}
}
| [
"lingdianguole@163.com"
] | lingdianguole@163.com |
d28ddd23e308225cc55378267b788f9236f7a1ff | 071c5d507a7b211e7a614225b40b8da2c4fe308d | /src/main/java/com/ea/elasticsearch/model/Record.java | d127f66c8a6c170e3e62416e54d49000991ea5ae | [] | no_license | Ferdiando/elasticsearch-master | fc559595c90fd68593207ad5e8b9daf248dd1abb | 27e28e87be3b22805ac835ab45fa4d9ef75a8942 | refs/heads/master | 2020-04-29T20:59:06.351425 | 2019-03-19T01:34:47 | 2019-03-19T01:34:47 | 176,399,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.ea.elasticsearch.model;
/**
* 抓取记录
*/
public class Record {
private String msg;
private String nickName;
private String date;
private String source;
private int status;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"huyang3868@163.com"
] | huyang3868@163.com |
5599aaed8f7a9a4105032f553e6caf6c3ea4e32e | ae04a9dfdff8f7ef0646755657e84e6dfc0d7377 | /src/com/qufei/mapper/Dict_国资2010RowMapper.java | 7b6140aa72c3f40c4a25c41c479c7275227745a0 | [] | no_license | saaserp/Zichanguanliu-Client | 5f68b6fbdd6083d56f3fde2211721b436b7f7207 | f8cf74b4cb41f26b7690e6a0435c870097be628e | refs/heads/master | 2022-12-07T14:06:22.403967 | 2016-01-07T01:37:49 | 2016-01-07T01:37:49 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,042 | java | package com.qufei.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import com.qufei.model.Dict_国资2010Model;
import com.qufei.tools.IRowMapper;
import com.qufei.tools.Model;
public class Dict_国资2010RowMapper implements IRowMapper {
@Override
public Model mappingRow(JSONObject jsobj) {
// TODO Auto-generated method stub
Dict_国资2010Model m = null;
try {
m = new Dict_国资2010Model(jsobj.getString("代码"), jsobj.getString("名称"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return m;
}
@Override
public Map<String, String> mappingRow(Model md) {
// TODO Auto-generated method stub
Map<String,String>m=new HashMap<String, String>();
Dict_国资2010Model mdd=(Dict_国资2010Model) md;
m.put("代码", mdd.get代码());
m.put("名称",mdd.get名称());
return m;
}
}
| [
"821272852@qq.com"
] | 821272852@qq.com |
25ba7085ab4476a80d93f9c7b1aef08c4b5569b6 | 6234757cfaa619977f7adde266b06ebffd923ae2 | /src/main/java/com/goosen/commons/dao/RoleMenuMapper.java | 332813f8ce42f7f71b0529e9b3aeace5d9d400ba | [
"MIT"
] | permissive | goosen123/mp-demo2 | b42f1e02f4dfae95b1d602e1f91fc965353683fd | e37a388f05acf72f2a79d9607ad41990b0e00374 | refs/heads/master | 2020-03-22T19:44:14.833097 | 2018-07-27T09:21:52 | 2018-07-27T09:21:52 | 140,547,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.goosen.commons.dao;
import com.goosen.commons.model.po.RoleMenu;
import com.goosen.commons.utils.MyMapper;
/**
* 角色菜单
* @author Goosen
* 2018年7月5日 -下午11:37:20
*/
public interface RoleMenuMapper extends MyMapper<RoleMenu>{
}
| [
"2630344884@qq.com"
] | 2630344884@qq.com |
d1d0e5cfaf214dc1ff7ae37e904b715250758f2a | 7990f62c5eddbc75ff8e90dcc444ff620bf33f6c | /java8/lamda/example/Sample4.java | b264f65c29b47f775d56f6d119898ecb56cdb6a2 | [] | no_license | rrohitramsen/use-case | 7e5e958b3b7fbbc86050ccf5d5ffe70f2b7e510e | 49f03af114d4430bf285ac41d82cc2e0efd379ed | refs/heads/master | 2021-01-11T22:11:43.294754 | 2017-01-24T09:28:54 | 2017-01-24T09:28:54 | 78,936,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,493 | java | package java8.lamda.example;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Stream;
/**
* Created by rohitkumar on 24/01/17.
*
* Parallel Stream Example
*/
public class Sample4 {
public static void main(String[] args) {
List<Integer> values = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
/*System.out.println("Start Time = "+new Date());
System.out.println(sequentialStream(values));
System.out.println("EndTime = "+new Date());*/
System.out.println("Start Time = "+new Date());
System.out.println(parallelStream(values));
System.out.println("EndTime = "+new Date());
Stream<Integer> stream = values.stream();
}
private static int sequentialStream(List<Integer> values) {
return values.stream()
.mapToInt(Sample4 :: doubleIt)
.sum();
}
private static int doubleIt(Integer value) {
System.out.println(Thread.currentThread().getName());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return value * 2;
}
/**
* If input size huge, then we have to think about performance.
* @param values
* @return
*/
private static int parallelStream(List<Integer> values) {
return values.parallelStream()
.mapToInt(Sample4::doubleIt)
.sum();
}
}
| [
"rrohit.ramsen@gmail.com"
] | rrohit.ramsen@gmail.com |
822cd4e9e0021568c517a35d8c3b25727de01f9d | 586368b6bfdcdc64216026085543b9f1b9920910 | /src/view/UINewUser.java | 60d511a2682b07d5d8612441d408a3e285c0258a | [] | no_license | chmcapel/Locadora_De_DVDs | 8e0d443a48dfb0771b05d5b1e80ad766a2418995 | 533dc78603bb491feedcef2575724c8308ba07fc | refs/heads/main | 2023-06-20T18:46:26.429343 | 2021-08-01T16:25:24 | 2021-08-01T16:25:24 | 391,677,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,131 | 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 view;
import DAOModels.DAOUser;
import Models.UserModel;
import javax.swing.JOptionPane;
/**
*
* @author A D E P T
*/
public class UINewUser extends javax.swing.JFrame {
UserModel userModel = new UserModel();
DAOUser DAOUser = new DAOUser();
public UINewUser() {
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() {
jPanel1 = new javax.swing.JPanel();
lb_NewUserTitle = new javax.swing.JLabel();
lb_userName = new javax.swing.JLabel();
lb_userPassword = new javax.swing.JLabel();
lb_confirmPassword = new javax.swing.JLabel();
txt_userName = new javax.swing.JTextField();
txt_userPassword = new javax.swing.JPasswordField();
txt_confirmPassword = new javax.swing.JPasswordField();
bt_register = new javax.swing.JButton();
bt_cancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
lb_NewUserTitle.setFont(new java.awt.Font("Calibri", 1, 30)); // NOI18N
lb_NewUserTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lb_NewUserTitle.setText("Novo Usuário");
lb_userName.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
lb_userName.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
lb_userName.setText("Usuário: ");
lb_userPassword.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
lb_userPassword.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
lb_userPassword.setText("Senha: ");
lb_confirmPassword.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
lb_confirmPassword.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
lb_confirmPassword.setText("Confirmar Senha: ");
bt_register.setBackground(new java.awt.Color(255, 255, 255));
bt_register.setFont(new java.awt.Font("Calibri", 0, 15)); // NOI18N
bt_register.setText("Cadastrar");
bt_register.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2));
bt_register.setFocusPainted(false);
bt_register.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bt_register.setMaximumSize(new java.awt.Dimension(90, 28));
bt_register.setMinimumSize(new java.awt.Dimension(90, 28));
bt_register.setPreferredSize(new java.awt.Dimension(90, 28));
bt_register.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_registerActionPerformed(evt);
}
});
bt_cancel.setBackground(new java.awt.Color(255, 255, 255));
bt_cancel.setFont(new java.awt.Font("Calibri", 0, 15)); // NOI18N
bt_cancel.setText("Cancelar");
bt_cancel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2));
bt_cancel.setFocusPainted(false);
bt_cancel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bt_cancel.setMaximumSize(new java.awt.Dimension(90, 28));
bt_cancel.setMinimumSize(new java.awt.Dimension(90, 28));
bt_cancel.setPreferredSize(new java.awt.Dimension(90, 28));
bt_cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bt_cancelActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lb_NewUserTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(bt_register, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bt_cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lb_confirmPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_userPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(lb_userName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txt_userPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
.addComponent(txt_userName, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txt_confirmPassword))))
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(lb_NewUserTitle)
.addGap(45, 45, 45)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txt_userName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_userName))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txt_userPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_userPassword))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txt_confirmPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_confirmPassword))
.addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bt_cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bt_register, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(50, 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.Alignment.TRAILING, 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)
);
setSize(new java.awt.Dimension(416, 339));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void bt_registerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_registerActionPerformed
if(txt_userName.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Insira o nome de USUÁRIO para continuar!");
txt_userName.requestFocus();
} else if(txt_userPassword.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Insira uma SENHA para continuar!");
txt_userPassword.requestFocus();
} else if(txt_confirmPassword.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Preencha o campo CONFIRME SUA SENHA para continuar!");
txt_confirmPassword.requestFocus();
} else if(!txt_userPassword.getText().equals(txt_confirmPassword.getText())) {
JOptionPane.showMessageDialog(null, "As senhas digitas não coincidem!");
txt_userPassword.setText("");
txt_confirmPassword.setText("");
txt_userPassword.requestFocus();
} else {
userModel.setUser_name(txt_userName.getText());
userModel.setUser_password(txt_userPassword.getText());
DAOUser.Salvar(userModel);
txt_userName.setText("");
txt_userPassword.setText("");
txt_confirmPassword.setText("");
dispose();
}
}//GEN-LAST:event_bt_registerActionPerformed
private void bt_cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_cancelActionPerformed
if (JOptionPane.showConfirmDialog(null,"Deseja cancelar o cadastro ?","Novo Usuário",
JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION) {
txt_userName.setText("");
txt_userPassword.setText("");
txt_confirmPassword.setText("");
dispose();
}
}//GEN-LAST:event_bt_cancelActionPerformed
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
int option = JOptionPane.showConfirmDialog(null, "Deseja cancelar o cadastro ?","Novo Usuário",JOptionPane.YES_OPTION);
if (option == JOptionPane.YES_OPTION) {
dispose();
}
}//GEN-LAST:event_formWindowClosing
/**
* @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(UINewUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(UINewUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(UINewUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(UINewUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
new UINewUser().setVisible(true);
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bt_cancel;
private javax.swing.JButton bt_register;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lb_NewUserTitle;
private javax.swing.JLabel lb_confirmPassword;
private javax.swing.JLabel lb_userName;
private javax.swing.JLabel lb_userPassword;
private javax.swing.JPasswordField txt_confirmPassword;
private javax.swing.JTextField txt_userName;
private javax.swing.JPasswordField txt_userPassword;
// End of variables declaration//GEN-END:variables
}
| [
"chmcapel@gmail.com"
] | chmcapel@gmail.com |
591b8d51f76c3aba797c0561ac3d87844c7d0519 | b7a40f2f47b07fa13081a3a75c6845740aa99e99 | /app/src/main/java/com/honglu/future/widget/wheelview/DateDialog.java | 5eb938551cde71f7f015d83abbc24ec8562708b3 | [] | no_license | xanhf/xiao | 821e5953499ae139fd8a23df620971359991ffd3 | 22465cf73f46a3f5873b6602536b2c428a89344e | refs/heads/master | 2021-08-30T13:41:46.286058 | 2017-12-14T08:52:16 | 2017-12-14T08:52:16 | 114,592,610 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,991 | java | package com.honglu.future.widget.wheelview;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.honglu.future.R;
import java.util.ArrayList;
import java.util.Calendar;
/**
* 日期选择对话框
*/
public class DateDialog extends Dialog {
private Context context;
private WheelView wv_start_yearmonth, wv_start_day, wv_end_yearmonth, wv_end_day;
private TextView btn_myinfo_sure;
// private View layout_dismiss;
private ArrayList<String> arry_yearsMonths = new ArrayList<String>(), arry_days = new ArrayList<String>();
private CalendarTextAdapter mStartYearMonthAdapter, mStartDayAdapter, mEndYearMonthAdapter, mEndDayAdapter;
private int month, day, currentDay = getDay(), maxTextSize = 15, minTextSize = 12;
private boolean issetdata = false;
private String selectStartYearMonth, selectStartDay, selectEndYearMonth, selectEndDay;
private OnBirthListener onBirthListener;
public DateDialog(Context context) {
super(context, R.style.DateDialog);
this.context = context;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_myinfo_changebirth);
Window window = this.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
WindowManager manage = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
params.width = manage.getDefaultDisplay().getWidth();
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
// layout_dismiss = findViewById(R.id.layout_dismiss);
// layout_dismiss.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// dismiss();
// }
// });
wv_start_yearmonth = (WheelView) findViewById(R.id.wv_start_yearmonth);
wv_start_day = (WheelView) findViewById(R.id.wv_start_day);
wv_end_yearmonth = (WheelView) findViewById(R.id.wv_end_yearmonth);
wv_end_day = (WheelView) findViewById(R.id.wv_end_day);
btn_myinfo_sure = (TextView) findViewById(R.id.btn_myinfo_sure);
btn_myinfo_sure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onBirthListener != null) {
String[] splitYear = selectStartYearMonth.split("年");
String[] splitMonth = splitYear[1].split("月");
String[] splitDay = selectStartDay.split("日");
String[] splitEndYear = selectEndYearMonth.split("年");
String[] splitEndMonth = splitEndYear[1].split("月");
String[] splitEndDay = selectEndDay.split("日");
String start = splitYear[0]+"-"+((splitMonth[0].length() > 1) ? splitMonth[0] : "0"+splitMonth[0])
+"-"+((splitDay[0].length() > 1) ? splitDay[0] : "0"+splitDay[0]);
String end = splitEndYear[0]+"-"+((splitEndMonth[0].length() > 1) ? splitEndMonth[0] : "0"+splitEndMonth[0])
+"-"+((splitEndDay[0].length() > 1) ? splitEndDay[0] : "0"+splitEndDay[0]);
onBirthListener.onClick(start,end);
}
}
});
if (!issetdata) {
initData();
}
initYearsMonths();
initDays(day);
mStartYearMonthAdapter = new CalendarTextAdapter(context, arry_yearsMonths,
getYearMonthIndex(getYear(), getMonth()), maxTextSize, minTextSize);
wv_start_yearmonth.setVisibleItems(3);
wv_start_yearmonth.setViewAdapter(mStartYearMonthAdapter);
wv_start_yearmonth.setCurrentItem(getYearMonthIndex(getYear(), getMonth()));
mStartDayAdapter = new CalendarTextAdapter(context, arry_days, currentDay - 1, maxTextSize, minTextSize);
wv_start_day.setVisibleItems(3);
wv_start_day.setViewAdapter(mStartDayAdapter);
wv_start_day.setCurrentItem(currentDay - 1);
mEndYearMonthAdapter = new CalendarTextAdapter(context, arry_yearsMonths,
getYearMonthIndex(getYear(), getMonth()), maxTextSize, minTextSize);
wv_end_yearmonth.setVisibleItems(3);
wv_end_yearmonth.setViewAdapter(mEndYearMonthAdapter);
wv_end_yearmonth.setCurrentItem(getYearMonthIndex(getYear(), getMonth()));
mEndDayAdapter = new CalendarTextAdapter(context, arry_days, currentDay - 1, maxTextSize, minTextSize);
wv_end_day.setVisibleItems(3);
wv_end_day.setViewAdapter(mEndDayAdapter);
wv_end_day.setCurrentItem(currentDay - 1);
wv_start_yearmonth.addChangingListener(new OnWheelChangedListener() {
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
String currentText = (String) mStartYearMonthAdapter.getItemText(wheel.getCurrentItem());
selectStartYearMonth = currentText;
setTextviewSize(currentText, mStartYearMonthAdapter);
calDays(Integer.parseInt(currentText.substring(0, currentText.indexOf("年"))), Integer.parseInt
(currentText.substring(currentText.indexOf("年") + 1, currentText.indexOf("月"))));
initDays(day);
mStartDayAdapter = new CalendarTextAdapter(context, arry_days, currentDay - 1, maxTextSize, minTextSize);
wv_start_day.setVisibleItems(3);
wv_start_day.setViewAdapter(mStartDayAdapter);
wv_start_day.setCurrentItem(getDay() - 1);
}
});
wv_start_yearmonth.addScrollingListener(new OnWheelScrollListener() {
@Override
public void onScrollingStarted(WheelView wheel) {
}
@Override
public void onScrollingFinished(WheelView wheel) {
String currentText = (String) mStartYearMonthAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mStartYearMonthAdapter);
}
});
wv_start_day.addChangingListener(new OnWheelChangedListener() {
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
String currentText = (String) mStartDayAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mStartDayAdapter);
selectStartDay = currentText;
}
});
wv_start_day.addScrollingListener(new OnWheelScrollListener() {
@Override
public void onScrollingStarted(WheelView wheel) {
}
@Override
public void onScrollingFinished(WheelView wheel) {
String currentText = (String) mStartDayAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mStartDayAdapter);
}
});
wv_end_yearmonth.addChangingListener(new OnWheelChangedListener() {
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
String currentText = (String) mEndYearMonthAdapter.getItemText(wheel.getCurrentItem());
selectEndYearMonth = currentText;
setTextviewSize(currentText, mEndYearMonthAdapter);
calDays(Integer.parseInt(currentText.substring(0, currentText.indexOf("年"))), Integer.parseInt
(currentText.substring(currentText.indexOf("年") + 1, currentText.indexOf("月"))));
initDays(day);
mEndDayAdapter = new CalendarTextAdapter(context, arry_days, currentDay - 1, maxTextSize, minTextSize);
wv_end_day.setVisibleItems(3);
wv_end_day.setViewAdapter(mEndDayAdapter);
wv_end_day.setCurrentItem(getDay() - 1);
}
});
wv_end_yearmonth.addScrollingListener(new OnWheelScrollListener() {
@Override
public void onScrollingStarted(WheelView wheel) {
}
@Override
public void onScrollingFinished(WheelView wheel) {
String currentText = (String) mEndYearMonthAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mEndYearMonthAdapter);
}
});
wv_end_day.addChangingListener(new OnWheelChangedListener() {
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
String currentText = (String) mEndDayAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mEndDayAdapter);
selectEndDay = currentText;
}
});
wv_end_day.addScrollingListener(new OnWheelScrollListener() {
@Override
public void onScrollingStarted(WheelView wheel) {
}
@Override
public void onScrollingFinished(WheelView wheel) {
String currentText = (String) mEndDayAdapter.getItemText(wheel.getCurrentItem());
setTextviewSize(currentText, mEndDayAdapter);
}
});
}
public void initYearsMonths() {
for (int i = 2000; i <= getYear(); i++) {
for (int j = 1; j <= 12; j++) {
arry_yearsMonths.add(i + "年" + j + "月");
}
}
}
public void initDays(int days) {
arry_days.clear();
for (int i = 1; i <= days; i++) {
arry_days.add(i + "日");
}
}
private class CalendarTextAdapter extends AbstractWheelTextAdapter {
ArrayList<String> list;
protected CalendarTextAdapter(Context context, ArrayList<String> list, int currentItem, int maxsize, int minsize) {
super(context, R.layout.item_birth_year, NO_RESOURCE, currentItem, maxsize, minsize);
this.list = list;
setItemTextResource(R.id.tempValue);
}
@Override
public View getItem(int index, View cachedView, ViewGroup parent) {
View view = super.getItem(index, cachedView, parent);
return view;
}
@Override
public int getItemsCount() {
return list.size();
}
@Override
protected CharSequence getItemText(int index) {
return list.get(index) + "";
}
}
public void setBirthdayListener(OnBirthListener onBirthListener) {
this.onBirthListener = onBirthListener;
}
public interface OnBirthListener {
void onClick(String start, String end);
}
public void setTextviewSize(String curriteItemText, CalendarTextAdapter adapter) {
ArrayList<View> arrayList = adapter.getTestViews();
int size = arrayList.size();
String currentText;
for (int i = 0; i < size; i++) {
TextView textvew = (TextView) arrayList.get(i);
currentText = textvew.getText().toString();
if (curriteItemText.equals(currentText)) {
textvew.setTextSize(maxTextSize);
} else {
textvew.setTextSize(minTextSize);
}
}
}
public int getYearMonthIndex(int year, int month) {
int yearIndex = 0;
int monthIndex = 0;
if (year != getYear()) {
this.month = 12;
} else {
this.month = getMonth();
}
for (int i = 2000; i <= getYear(); i++) {
if (i == year) {
break;
}
yearIndex++;
}
for (int j = 1; j <= getMonth(); j++) {
if (j == month) {
break;
}
monthIndex++;
}
return yearIndex * 12 + monthIndex;
}
public int getYear() {
Calendar c = Calendar.getInstance();
return c.get(Calendar.YEAR);
}
public int getMonth() {
Calendar c = Calendar.getInstance();
return c.get(Calendar.MONTH) + 1;
}
public int getDay() {
Calendar c = Calendar.getInstance();
return c.get(Calendar.DATE);
}
public void initData() {
setDate(getYear(), getMonth(), getDay());
}
public void setDate(int year, int month, int day) {
selectEndYearMonth = selectStartYearMonth = year + "年" + month + "月";
selectEndDay = selectStartDay = day + "";
issetdata = true;
if (year == getYear()) {
this.month = getMonth();
} else {
this.month = 12;
}
calDays(year, month);
}
public void calDays(int year, int month) {
boolean leayyear = false;
leayyear = year % 4 == 0 && year % 100 != 0;
for (int i = 1; i <= 12; i++) {
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
this.day = 31;
break;
case 2:
if (leayyear) {
this.day = 29;
} else {
this.day = 28;
}
break;
case 4:
case 6:
case 9:
case 11:
this.day = 30;
break;
}
}
// if (year == getYear() && month == getMonth()) {
// this.day = getDay();
// }
}
} | [
"zab995578513@qq.com"
] | zab995578513@qq.com |
cef5ccd809cf135a1e46d6d8a75f1bc7145a9ad2 | 3cd63aba77b753d85414b29279a77c0bc251cea9 | /main/plugins/org.talend.designer.components.libs/libs_src/crm4client/com/microsoft/schemas/crm/_2007/webservices/BooleanDocument.java | da407db295a220e68bc25d6a05cb33915fe0bdaa | [
"Apache-2.0"
] | permissive | 195858/tdi-studio-se | 249bcebb9700c6bbc8905ccef73032942827390d | 4fdb5cfb3aeee621eacfaef17882d92d65db42c3 | refs/heads/master | 2021-04-06T08:56:14.666143 | 2018-10-01T14:11:28 | 2018-10-01T14:11:28 | 124,540,962 | 1 | 0 | null | 2018-10-01T14:11:29 | 2018-03-09T12:59:25 | Java | UTF-8 | Java | false | false | 9,207 | java | /*
* An XML document type.
* Localname: boolean
* Namespace: http://schemas.microsoft.com/crm/2007/WebServices
* Java type: com.microsoft.schemas.crm._2007.webservices.BooleanDocument
*
* Automatically generated - do not modify.
*/
package com.microsoft.schemas.crm._2007.webservices;
/**
* A document containing one boolean(@http://schemas.microsoft.com/crm/2007/WebServices) element.
*
* This is a complex type.
*/
public interface BooleanDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(BooleanDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sE3DFDC56E75679F2AF264CA469AD5996").resolveHandle("booleanb9e4doctype");
/**
* Gets the "boolean" element
*/
boolean getBoolean();
/**
* Gets (as xml) the "boolean" element
*/
org.apache.xmlbeans.XmlBoolean xgetBoolean();
/**
* Sets the "boolean" element
*/
void setBoolean(boolean xboolean);
/**
* Sets (as xml) the "boolean" element
*/
void xsetBoolean(org.apache.xmlbeans.XmlBoolean xboolean);
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument newInstance() {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.microsoft.schemas.crm._2007.webservices.BooleanDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.microsoft.schemas.crm._2007.webservices.BooleanDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"bchen@f6f1c999-d317-4740-80b0-e6d1abc6f99e"
] | bchen@f6f1c999-d317-4740-80b0-e6d1abc6f99e |
de235059b6f0b855e392a9129ec1225c9ce3b297 | eb75946e84d51385b575b722fe5071047c2aa747 | /src/goalBasedProblems/solvers/GraphBasedDFS.java | f27f7d0f2c19f37d2c06d84b53e251b7684df533 | [] | no_license | emranbm/Problem-Solver | 797772661e32ea8acee9d935011885e18934374e | 942920edc754e48a6b7dfb244cae0df3b7572b9d | refs/heads/master | 2021-01-12T11:44:28.512530 | 2016-12-16T17:18:56 | 2016-12-16T17:18:56 | 72,285,752 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,145 | java | package goalBasedProblems.solvers;
import goalBasedProblems.models.GoalBasedProblem;
import goalBasedProblems.models.LinkedState;
import goalBasedProblems.models.NoState;
import goalBasedProblems.models.State;
import java.util.ArrayList;
import java.util.LinkedList;
/**
* Created by emran on 10/29/16.
*/
public class GraphBasedDFS implements GoalBasedSolver {
private GoalBasedProblem goalBasedProblem;
protected LinkedList<StateDepthBundle> queue;
private int expanded = 0;
private int seen = 1;
private int maxNodesInRAM = 0;
protected int maxDepth;
public GraphBasedDFS(GoalBasedProblem goalBasedProblem, int maxDepth) {
this.goalBasedProblem = goalBasedProblem;
this.queue = new LinkedList<>();
this.queue.add(new StateDepthBundle(goalBasedProblem.startState(), 0));
this.maxDepth = maxDepth;
}
@Override
public State tick() {
StateDepthBundle currentBundle;
try {
currentBundle = queue.getLast();
} catch (Exception e) {
// Nothing finished in the given max depth.
return new NoState();
}
queue.remove(queue.size() - 1);
ArrayList<State> children = goalBasedProblem.getChildren(currentBundle.state);
expanded++;
int nextDepth = currentBundle.depth + 1;
if (nextDepth > maxDepth)
return null;
for (State state : children) {
if (state instanceof LinkedState)
((LinkedState) state).setParent((LinkedState) currentBundle.state);
seen++;
if (goalBasedProblem.isGoal(state))
return state;
queue.add(new StateDepthBundle(state, nextDepth));
}
// queue.addAll(children);
if (queue.size() > maxNodesInRAM)
maxNodesInRAM = queue.size();
return null;
}
@Override
public int getSeenStatesCount() {
return seen;
}
@Override
public int getExpandedCount() {
return expanded;
}
@Override
public int maxNodesInRAM() {
return maxNodesInRAM;
}
}
| [
"emran.bm@gmail.com"
] | emran.bm@gmail.com |
96aee220d621a98e9e2e6da9eb06a19254dc2d74 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113/u-11-111-1112-11113-f5744.java | c30a4b2dc59df1ae91171e6d65ed12daf488a759 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
6329998429532 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
d0c7dcedc3fb6e300248e97613fa83b51741eb52 | 79e2e1a77e771d0b15140cf3937b4cfb9e70600e | /src/main/java/au/com/iglooit/lichking/controller/ApplicationPayTestController.java | 274240de20a4d34c43fe20d1dd475e11bf246557 | [] | no_license | rrkd/lichking | a9de36343cc69bd9af3309ef2653c8f4e440f508 | 294d477b4eb344e06c7e312c1c977b4d936c3d4c | refs/heads/master | 2020-04-21T03:49:21.372330 | 2014-11-01T21:09:00 | 2014-11-01T21:09:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | package au.com.iglooit.lichking.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Created with IntelliJ IDEA.
* User: nicholas.zhu
* Date: 27/10/2014
* Time: 8:34 PM
*/
@Controller
public class ApplicationPayTestController {
@RequestMapping(value = "/app/paymentTest", method = RequestMethod.GET)
public String paymentTest() {
return "/app/payment-test";
}
@RequestMapping(value = "/app/paymentTestCB", method = RequestMethod.GET)
public String index() {
return "/app/payment-test-cb";
}
}
| [
"nicholas.zhu@fairfaxmedia.com.au"
] | nicholas.zhu@fairfaxmedia.com.au |
7c51e2aa801f4d47ae174d23a1819697ae79ff3d | 8ff2a5fb97602b1488d59fda080bc05048a7b0cf | /lab5GD/src/Auction.java | bf9c7c1be7357ec40e4709acfd17cb53208b9964 | [] | no_license | berendeev/JavaLabs | 2c322032fa1a2be3c3ec113c22c9246d6e44b81a | 97472dfac182bcec686b667bcc339ee300400312 | refs/heads/master | 2021-09-07T07:24:52.196855 | 2018-02-19T15:25:24 | 2018-02-19T15:25:24 | 110,569,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,342 | java | import java.util.Random;
public class Auction implements Runnable {
private int startPrice;
private int currentPrice;
private int countOfLots;
private boolean state;
private Participant leader;
Auction(int startPrice, int countOfLots) {
this.startPrice = startPrice;
this.countOfLots = countOfLots;
state = true;
nextLot();
}
public boolean getSate() {
return state;
}
public int getCurrentPrice() {
return currentPrice;
}
public synchronized void bet(Participant p) {
Random random = new Random();
currentPrice += random.nextInt(25);
leader = p;
}
public void nextLot() {
System.out.println("\nЛот номер:" + countOfLots);
currentPrice = startPrice;
leader = null;
}
@Override
public void run() {
if (leader != null) {
if (leader.getMoney() < currentPrice) {
leader.blocked(2);
System.out.println("Участник " + leader.getIdOfParticipant() + "заблокирован");
} else {
leader.buy(currentPrice);
System.out.println("Участник " + leader.getIdOfParticipant() + "выкупил лот за " + currentPrice);
}
if (countOfLots > 0) {
countOfLots--;
nextLot();
} else {
System.out.println("Аукцион завершен");
state = false;
}
} else {
System.out.println("Лот не продан");
}
}
}
| [
"sellect.47@gmail.com"
] | sellect.47@gmail.com |
0c153c2110ebfeb4cb11d9f4e659ce58fc95e107 | 7ab46a39fb5178fec55968b2db4bebb42a08fed9 | /src/main/java/com/tomseiler/mudproxy/models/parsed/RoomBuilder.java | 51ae1712357cca27b5f7bc836446857030ce52dc | [] | no_license | tmseiler/mudproxy | 521ef11f075cb7e45dc60bffdec8f38cba04eb75 | fb3d297c8becfd1ddb7033806534df6ff6b77b44 | refs/heads/master | 2023-08-19T06:59:36.483928 | 2021-10-11T20:08:59 | 2021-10-11T20:08:59 | 297,205,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.tomseiler.mudproxy.models.parsed;
import java.util.Set;
public class RoomBuilder {
private String name;
private Set<String> exits;
public RoomBuilder name(String name) {
this.name = name;
return this;
}
public RoomBuilder exits(Set<String> exits) {
this.exits = exits;
return this;
}
public Room createRoom() {
return new Room(name, exits);
}
} | [
"tmseiler@gmail.com"
] | tmseiler@gmail.com |
47428dd93f44ffd7e9844a7a4cf3d57ffbcb59b0 | 1d9536408950a0a6ebb637c20492657bfe8af94c | /code_forces/EDU/Binary_Search/Step_1/Closest_to_the_Left_B_Pr.java | 47bceb91df539f6f03dd1972ebe5a90523b303f6 | [] | no_license | atish1999/Testing_knowledge | 2d5c5b9b53afb3d560454056b35850d1cb87aae1 | b31dc0e185458c576737a888549d838a091c1939 | refs/heads/master | 2023-07-16T03:24:32.236832 | 2021-09-04T02:16:21 | 2021-09-04T02:16:21 | 302,491,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,708 | java | package code_forces.EDU.Binary_Search.Step_1;
import java.util.*;
import java.io.*;
public class Closest_to_the_Left_B_Pr {
public static void main(String[] args) throws java.lang.Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer s = new StringTokenizer(br.readLine());
int n=Integer.parseInt(s.nextToken()),k=Integer.parseInt(s.nextToken());
int a[]=new int[n];
s = new StringTokenizer(br.readLine());
for(int i=0; i<n; i++) a[i]=Integer.parseInt(s.nextToken());
s = new StringTokenizer(br.readLine());
while(k-->0) {
int target=Integer.parseInt(s.nextToken());
int l=-1;//a[l]<=x //closest to the left
int r=n;//a[r]>x
while(l+1<r) {
int m=(l+r)>>>1;
if(a[m]<=target) l=m;
else r=m;
}
// if all the elements are greater than x then l would be -1.
System.out.println(l+1);
}
}
static void solve1()throws java.lang.Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer s = new StringTokenizer(br.readLine());
int n=Integer.parseInt(s.nextToken()),k=Integer.parseInt(s.nextToken());
int a[]=new int[n];
s = new StringTokenizer(br.readLine());
for(int i=0; i<n; i++) a[i]=Integer.parseInt(s.nextToken());
s = new StringTokenizer(br.readLine());
while(k-->0) {
int target=Integer.parseInt(s.nextToken());
int x=Arrays.binarySearch(a, target);
if(x<0) {x*=-1;--x;}
else {
for(int i=x; i<n-1; i++) {
if(a[i]==a[i+1]) ++x;
else break;
}
++x;//because we have to print 1-based indexing...
}
System.out.println(x);
}
}
}
| [
"atishnaskar1999@gmail.com"
] | atishnaskar1999@gmail.com |
deeb90452114c9539bcf1b82c778e197a6406a5e | 7851ba126a6b0be16a916dc4ec2322546a5b02ea | /src/main/java/com/docusign/hackathon/connect/model/GetFolderItems.java | d6323cbb52721480923c41188659e4b9acedb8fb | [] | no_license | amit143bist/pocHackathon | 93480e5e7693529c2333d7b7637af2e5fdb7fb79 | 79590d1e1659850df0cdd2f899396354d0702573 | refs/heads/master | 2021-01-24T16:27:00.030605 | 2018-08-13T04:53:28 | 2018-08-13T04:53:28 | 123,194,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,578 | java |
package com.docusign.hackathon.connect.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FolderFilter" type="{http://www.docusign.net/API/3.0}FolderFilter" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"folderFilter"
})
@XmlRootElement(name = "GetFolderItems")
public class GetFolderItems {
@XmlElement(name = "FolderFilter")
protected FolderFilter folderFilter;
/**
* Gets the value of the folderFilter property.
*
* @return
* possible object is
* {@link FolderFilter }
*
*/
public FolderFilter getFolderFilter() {
return folderFilter;
}
/**
* Sets the value of the folderFilter property.
*
* @param value
* allowed object is
* {@link FolderFilter }
*
*/
public void setFolderFilter(FolderFilter value) {
this.folderFilter = value;
}
}
| [
"Amit.Bist@docusign.com"
] | Amit.Bist@docusign.com |
c30c5a17a8c9bbb8d947c57b4f5e27d750bae77e | 1a697258bb142a693ef569146e1a88782864718d | /lib/src/main/java/com/hss01248/lib/supertoast/utils/AccessibilityUtils.java | c872188f0d3fcbc594b9e1194e776373f66d0e57 | [
"Apache-2.0"
] | permissive | glassLake/MyToast | a967cb18d6eea71325a6e87841521a9264457126 | 39e635a3507eedae5fb5f251e3dd004adb080060 | refs/heads/master | 2020-07-04T12:46:31.015188 | 2016-09-23T05:57:25 | 2016-09-23T05:57:25 | 67,770,683 | 14 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | /*
* Copyright 2013-2016 John Persano
* 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.hss01248.lib.supertoast.utils;
import android.content.Context;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
/**
* Utility class that is used to send an {@link AccessibilityEvent}.
*/
public class AccessibilityUtils {
/**
* Try to send an {@link AccessibilityEvent}
* for a {@link View}.
*
* @param view The View that will dispatch the AccessibilityEvent
* @return true if the AccessibilityEvent was dispatched
*/
@SuppressWarnings("UnusedReturnValue")
public static boolean sendAccessibilityEvent(View view) {
final AccessibilityManager accessibilityManager = (AccessibilityManager)
view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (!accessibilityManager.isEnabled()) return false;
final AccessibilityEvent accessibilityEvent = AccessibilityEvent
.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
accessibilityEvent.setClassName(view.getClass().getName());
accessibilityEvent.setPackageName(view.getContext().getPackageName());
view.dispatchPopulateAccessibilityEvent(accessibilityEvent);
accessibilityManager.sendAccessibilityEvent(accessibilityEvent);
return true;
}
} | [
"hss01248@gmail.com"
] | hss01248@gmail.com |
22acbbdcfb13b78f37818cff716659103148f1b7 | 6a5c0ba1bc9d3329a3f16fd0bd8f08b31fc310fa | /src/main/java/com/example/springbootMVC/controller/AccountController.java | 18bd1e50ac9e7469ef1013e5c636d3f6cc4ac4fe | [] | no_license | SmithJerry/Projetdev | 3957fff6a73c6302e81de220bf5abfad2166ea4b | 8b4b23e5e7f9b4d9e07c122a7dc72f65f0f7b518 | refs/heads/master | 2023-02-13T07:08:46.102111 | 2021-01-22T07:41:07 | 2021-01-22T07:41:07 | 331,872,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,672 | java | package com.example.springbootMVC.controller;
import com.example.springbootMVC.RespStat;
import com.example.springbootMVC.entity.Account;
import com.example.springbootMVC.service.AccountService;
import com.github.pagehelper.PageInfo;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* @author Liang
* @date 2020/11/30 - 10:39
*/
@Controller
@RequestMapping("/account")
public class AccountController {
@Autowired
FastFileStorageClient fc;
@Autowired
AccountService accountSrv;
@RequestMapping("/login")
public String login() {
return "account/login";
}
@RequestMapping("/validataAccount")
@ResponseBody
public String validataAccount(String loginName, String password, HttpServletRequest request) {
System.out.println("loginName" + loginName);
System.out.println("password" + password);
//1.直接返回是否登陆成功
//2.返回Account对象,对象是空在controller里做业务逻辑
Account account = accountSrv.findByLoginNameAndPassword(loginName, password);
if (account == null) {
return "登陆失败";
} else {
//登陆成功
request.getSession().setAttribute("account", account);
return "success";
}
}
@RequestMapping("/logOut")
public String logOut(HttpServletRequest request){
request.getSession().removeAttribute("account");
return "index";
}
@RequestMapping("/list")
public String list(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize, Model model){
PageInfo<Account> page = accountSrv.findByPage(pageNum, pageSize);
model.addAttribute("page", page);
return "account/list";
}
@RequestMapping("/deleteById")
@ResponseBody
public RespStat deleteById(int id){
RespStat stat = accountSrv.deleteById(id);
return stat;
}
// FastDFS
@RequestMapping("/profile")
public String profile () {
return "account/profile";
}
// /**
// * 中文字符
// * @param filename
// * @param password
// * @return
// */
// @RequestMapping("/fileUploadController")
// public String fileUpload (MultipartFile filename, String password) {
// System.out.println("password:" + password);
// System.out.println("file:" + filename.getOriginalFilename());
// try {
//
// File path = new File(ResourceUtils.getURL("classpath:").getPath());
// File upload = new File(path.getAbsolutePath(), "static/upload/");
//
// System.out.println("upload:" + upload);
//
// filename.transferTo(new File(upload+"/"+filename.getOriginalFilename()));
//
//
// } catch (IllegalStateException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// return "profile";
// }
}
| [
"837335135@qq.com"
] | 837335135@qq.com |
c51848e0fe50cb32ceed8695d56ed0aa72357ad4 | f088370f47cb3e39072384fe913c2c49a799806e | /src/main/java/config/RedisConstants.java | 6ae5fc054a1d44966a94963dbbcb5fec9ee8ec42 | [] | no_license | ShawyerPeng/JedisUtil | 6b0ab2af13ecef120490f4360fdd1ffa246dfc73 | f57704e0916d8101ad88f351587b0d537dcd69f4 | refs/heads/master | 2021-08-24T01:30:34.553396 | 2017-12-07T13:13:25 | 2017-12-07T13:13:25 | 113,449,686 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package config;
/**
* Redis 常量类
*/
public class RedisConstants {
/**
* redis 默认配置 配置文件名
*/
public static final String DEFALUT_REDIS_FILE_NAME = "redis.properties";
/**
* redis 默认配置 端口
*/
public static final int DEFAULT_REDIS_PORT = 6379;
/**
* redis 默认配置 最大连接数
*/
public static final int DEFAULT_REDIS_POOL_MAX = 10;
/**
* redis 默认配置 每次连接数增加数
*/
public static final int DEFAULT_REDIS_POOL_IDLE = 1;
/**
* redis 默认配置 连接超时时间
*/
public static final int DEFAULT_REDIS_TRY_TIMEOUT = 10000;
/**
* redis 默认配置 临时队列名
*/
public static final String DEFAULT_REDIS_TEMP_QUEUE_TIMEP_NAME = "tmp_queue";
} | [
"patrickyateschn@gmail.com"
] | patrickyateschn@gmail.com |
24155baeaef9431e0def39194c05574be939c24b | 9fb06295b14e4c2a4ac9d04351be62b06eec6e24 | /src/formbeans/SearchForm.java | f9b67a1a6196c6a63482493ddd7dc577c12cc45e | [] | no_license | ajak6/Grammy-Awards-Web-Community | d5681db3382d79de762d287d80384c94311c252c | b999f3231497b82146c97e73c4b71ac5706dd945 | refs/heads/master | 2021-01-10T14:56:51.731033 | 2015-05-30T00:16:27 | 2015-05-30T00:16:27 | 36,536,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package formbeans;
import javax.servlet.http.HttpSession;
import org.mybeans.form.FormBean;
public class SearchForm extends FormBean{
private String celebrity;
private String action;
private HttpSession httpSession;
public String getCelebrity() {
return celebrity;
}
public void setCelebrity(String celebrity) {
this.celebrity = celebrity;
}
public HttpSession getHttpSession() {
return httpSession;
}
public String getAction() {
return action;
}
public void setAction(String s) {
action = s;
}
}
| [
"a.ameyjain@hotmail.com"
] | a.ameyjain@hotmail.com |
b7ec3008d2f45d76abf9330920a2180056d6332c | 1a18c9632c87422562d344e3a320552c65b13288 | /mining/src/main/java/amie/mining/assistant/experimental/TypingMiningAssistantWithTT.java | 0384eb53b5e5326c05c3f59fbcddb0dd9fb758f2 | [] | no_license | mazi-hou/amie | 2baa9f693fe227b4ba20201e818c3b1fb5ffd610 | fc80927a5e0306299cf77f9827f5391873c78072 | refs/heads/master | 2021-02-09T18:49:40.995863 | 2020-02-24T17:17:00 | 2020-02-24T17:17:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,775 | java | package amie.mining.assistant.experimental;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import amie.data.KB;
import amie.mining.assistant.*;
import amie.rules.Rule;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.IntCollection;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.ints.IntSet;
public class TypingMiningAssistantWithTT extends DefaultMiningAssistant {
public static String topType = "owl:Thing";
public static int topTypeBS = KB.map(topType);
public TypingMiningAssistantWithTT(KB dataSource) {
super(dataSource);
System.out.println("Materializing taxonomy...");
amie.data.Schema.materializeTaxonomy(dataSource);
this.exploitMaxLengthOption = false;
}
public Rule getInitialRule() {
Rule query = new Rule();
int[] newEdge = query.fullyUnboundTriplePattern();
int[] succedent = newEdge.clone();
succedent[1] = KB.TRANSITIVETYPEbs;
succedent[2] = topTypeBS;
Rule candidate = new Rule(succedent, (double)kb.countOneVariable(succedent));
candidate.setId(1);
candidate.setFunctionalVariablePosition(0);
registerHeadRelation(candidate);
return candidate;
}
@Override
public Collection<Rule> getInitialAtoms(double minSupportThreshold) {
return Arrays.asList(getInitialRule());
}
@Override
public Collection<Rule> getInitialAtomsFromSeeds(IntCollection relations,
double minSupportThreshold) {
return Arrays.asList(getInitialRule());
}
@Override
public boolean isNotTooLong(Rule rule) {
return rule.getRealLength() <= rule.getId();
}
@Override
public boolean shouldBeOutput(Rule candidate) {
return true;
}
@Override
public boolean shouldBeClosed() {
return false;
}
public void getSubTypingRules(Rule rule, double minSupportThreshold, Collection<Rule> output) {
if (rule.getHeadRelationBS() != KB.TRANSITIVETYPEbs) {
return;
}
if (rule.getBody().isEmpty()) {
return;
}
int[] head = rule.getHead();
List<int[]> body = rule.getBody();
IntSet subTypes = amie.data.Schema.getSubTypes(kb, head[2]);
int parentTypePos = Rule.firstIndexOfRelation(body, KB.TRANSITIVETYPEbs);
for (int subType : subTypes) {
Rule succedent = new Rule(rule, rule.getSupport());
if (parentTypePos == -1) {
succedent = succedent.addAtom(KB.triple(head[0], KB.TRANSITIVETYPEbs, head[2]), 0);
} else {
succedent.getBody().get(parentTypePos)[2] = head[2];
}
succedent.getHead()[2] = subType;
double cardinality = (double)kb.countDistinct(head[0], succedent.getTriples());
if (cardinality >= minSupportThreshold) {
succedent.setSupport(cardinality);
succedent.setSupportRatio((double)cardinality / (double)this.kb.size());
succedent.setId(rule.getId()+1);
output.add(succedent);
}
}
}
public void getDomainRangeRules(Rule rule, double minSupportThreshold, Collection<Rule> output) {
if (rule.getHeadRelationBS() != KB.TRANSITIVETYPEbs) {
return;
}
IntList openVariables = rule.getOpenVariables();
if (openVariables.isEmpty()) {
return;
}
if (Rule.firstIndexOfRelation(rule.getBody(), KB.TRANSITIVETYPEbs) == -1) {
return;
}
int cardinality;
for (int openVariable : openVariables) {
int[] newEdge = rule.fullyUnboundTriplePattern();
newEdge[0] = openVariable;
newEdge[1] = KB.TRANSITIVETYPEbs;
Rule pattern = rule.addAtom(newEdge, 0);
Int2IntMap promisingTypes = kb.frequentBindingsOf(newEdge[2], pattern.getFunctionalVariable(), pattern.getTriples());
for (int promisingType : promisingTypes.keySet()) {
cardinality = promisingTypes.get(promisingType);
if (cardinality >= minSupportThreshold) {
newEdge[2] = promisingType;
Rule candidate = rule.addAtom(newEdge, cardinality);
candidate.addParent(rule);
output.add(candidate);
}
}
}
}
@Override
public boolean testConfidenceThresholds(Rule candidate) {
if(candidate.containsLevel2RedundantSubgraphs()) {
return false;
}
if(candidate.getStdConfidence() >= minStdConfidence){
//Now check the confidence with respect to its ancestors
List<Rule> ancestors = candidate.getAncestors();
for(int i = 0; i < ancestors.size(); ++i){
double ancestorConfidence = ancestors.get(i).getStdConfidence();
// Skyline technique on PCA confidence
if ((ancestors.get(i).getLength() > 1) &&
(ancestorConfidence >= candidate.getStdConfidence())) {
return false;
}
}
}else{
return false;
}
return true;
}
@Override
public void applyMiningOperators(Rule rule, double minSupportThreshold,
Collection<Rule> danglingOutput, Collection<Rule> output) {
System.err.println("Candidate: " + rule.getRuleString());
// System.err.println("refined ?");
if (!rule.isPerfect()) {
// System.err.println("yes");
super.applyMiningOperators(rule, minSupportThreshold, danglingOutput, output);
}
getSubTypingRules(rule, minSupportThreshold, output);
//getDomainRangeRules(rule, minSupportThreshold, output);
}
public static void main(String[] args) {
KB kb = new KB();
List<File> files = new ArrayList<>();
for (String arg : args) {
files.add(new File(arg));
}
try {
kb.load(files);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
TypingMiningAssistantWithTT assistant = new TypingMiningAssistantWithTT(kb);
Rule newRule;
/*Rule initialRule = assistant.getInitialRule();
System.out.println("Initial rule: " + initialRule.getRuleString());
List<Rule> output = new ArrayList<>();
System.out.println("SubTyping rules:");
assistant.getSubTypingRules(initialRule, -1, output);
for (Rule rule : output) {
System.out.println(rule.getRuleString() + "\t" + String.valueOf(rule.getStdConfidence()));
}
output.clear();
assistant.getDanglingAtoms(initialRule, -1, output);
assert(!output.isEmpty());
newRule = output.get(0);
System.out.println("New rule: " + newRule.getRuleString());
output.clear();
System.out.println("SubTyping rules:");
assistant.getSubTypingRules(newRule, -1, output);
for (Rule rule : output) {
System.out.println(rule.getRuleString() + "\t" + String.valueOf(rule.getStdConfidence()));
}
assert(!output.isEmpty());
newRule = output.get(0);
System.out.println("New rule: " + newRule.getRuleString());
output.clear();
System.out.println("SubTyping rules:");
assistant.getSubTypingRules(newRule, -1, output);
for (Rule rule : output) {
System.out.println(rule.getRuleString() + "\t" + String.valueOf(rule.getStdConfidence()));
}*/
newRule = new Rule(KB.triple(KB.map("?x"), KB.TRANSITIVETYPEbs, KB.map("<wordnet_abstraction_100002137>")),
KB.triples(KB.triple(KB.map("?x"), KB.map("<isMarriedTo>"), KB.map("?y")),
KB.triple(KB.map("?x"), KB.TRANSITIVETYPEbs, topTypeBS)), 0);
System.out.println("New rule: " + newRule.getRuleString());
long support = kb.countDistinct(KB.map("?x"), newRule.getTriples());
System.out.println("Support: " + String.valueOf(support));
System.out.println("MRT calls: " + String.valueOf(KB.STAT_NUMBER_OF_CALL_TO_MRT.get()));
/*
output.clear();
System.out.println("SubTyping rules:");
assistant.getSubTypingRules(newRule, -1, output);
for (Rule rule : output) {
System.out.println(rule.getRuleString() + "\t" + String.valueOf(rule.getStdConfidence()));
}
System.out.println("New rule: " + newRule.getRuleString());
output.clear();
System.out.println("DomainRange rules:");
assistant.getDomainRangeRules(newRule, -1, output);
for (Rule rule : output) {
System.out.println(rule.getRuleString() + "\t" + String.valueOf(rule.getStdConfidence()));
}*/
}
}
| [
"jlajus@enst.fr"
] | jlajus@enst.fr |
3048495a4d0e343afb22918ee1bd22c2637d92c2 | 5739149dee8b3d8b773cfa5ec175d7dbd7ce0605 | /droolsjbpm-tools-master.zip_expanded/droolsjbpm-tools-master/drools-eclipse/org.kie.eclipse/src/main/java/org/kie/eclipse/preferences/AbstractRuntimeDialog.java | 5d3834b4bf577db925d145316f7fb7215679ac20 | [
"Apache-2.0"
] | permissive | menty44/impbackuptwo | 4e925114f40f78fa31ac157a3ceb0f1196d3e08d | aeb389d1e000975b90e2923c465a5e746b0587da | refs/heads/master | 2021-01-22T02:28:42.397040 | 2017-02-06T05:56:26 | 2017-02-06T05:56:26 | 81,052,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,061 | java | /*
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.eclipse.preferences;
import java.io.File;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.kie.eclipse.runtime.IRuntime;
import org.kie.eclipse.runtime.IRuntimeManager;
public abstract class AbstractRuntimeDialog extends Dialog {
private IRuntimeManager runtimeManager;
private IRuntime runtime;
private Text nameText;
private Text pathText;
private Text versionText;
private List<IRuntime> runtimes;
private Listener textModifyListener = new Listener() {
public void handleEvent(Event e) {
boolean valid = validate();
getButton(IDialogConstants.OK_ID).setEnabled(valid);
}
};
public AbstractRuntimeDialog(Shell parent, List<IRuntime> runtimes) {
super(parent);
setBlockOnOpen(true);
this.runtimes = runtimes;
this.runtimeManager = getRuntimeManager();
setShellStyle(getShellStyle() | SWT.RESIZE);
}
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
composite.setLayout(gridLayout);
Label label = new Label(composite, SWT.WRAP);
label.setFont(composite.getFont());
label.setText("Either select an existing Drools Runtime on your file system or create a new one.");
GridData gridData = new GridData();
gridData.horizontalSpan = 3;
gridData.widthHint = 450;
label.setLayoutData(gridData);
Label nameLabel = new Label(composite, SWT.NONE);
nameLabel.setText("Name:");
nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
nameText.setText(runtime == null || runtime.getName() == null ? "" : runtime.getName());
nameText.addListener(SWT.Modify, textModifyListener);
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
nameText.setLayoutData(gridData);
label = new Label(composite, SWT.NONE);
label.setText("Path:");
pathText = new Text(composite, SWT.SINGLE | SWT.BORDER);
pathText.setText(runtime == null || runtime.getPath() == null ? "" : runtime.getPath());
pathText.addListener(SWT.Modify, textModifyListener);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
pathText.setLayoutData(gridData);
Button selectButton = new Button(composite, SWT.PUSH | SWT.LEFT);
selectButton.setText("Browse...");
gridData = new GridData();
selectButton.setLayoutData(gridData);
selectButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
browse();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Label versionLabel = new Label(composite, SWT.NONE);
versionLabel.setText("Version:");
versionText = new Text(composite, SWT.SINGLE | SWT.BORDER);
versionText.setText(runtime == null || runtime.getName() == null ? "" : runtime.getVersion());
versionText.addListener(SWT.Modify, textModifyListener);
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
versionText.setLayoutData(gridData);
Button createButton = new Button(composite, SWT.PUSH | SWT.LEFT);
String name = runtimeManager.getBundleRuntimeName();
createButton.setText("Create a new " + name + "...");
gridData = new GridData();
gridData.horizontalSpan = 2;
createButton.setLayoutData(gridData);
createButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
createRuntime();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
return composite;
}
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Drools Runtime");
}
protected Point getInitialSize() {
return new Point(500, 250);
}
public void setRuntime(IRuntime runtime) {
this.runtime = runtime;
}
private boolean validate() {
String name = nameText.getText();
if (name == null || "".equals(name.trim())) {
return false;
}
if (runtime == null || !name.equals(runtime.getName())) {
for (IRuntime runtime: runtimes) {
if (name.equals(runtime.getName())) {
return false;
}
}
}
String location = pathText.getText();
if (location != null) {
File file = new File(location);
if (file.exists() && file.isDirectory()) {
return true;
}
}
return false;
}
private void browse() {
String selectedDirectory = null;
String dirName = pathText.getText();
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setMessage("Select the Drools runtime directory.");
dialog.setFilterPath(dirName);
selectedDirectory = dialog.open();
if (selectedDirectory != null) {
pathText.setText(selectedDirectory);
}
}
private void createRuntime() {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setMessage("Select the new Drools 6 runtime directory.");
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
IRuntime rt = runtimeManager.createBundleRuntime(selectedDirectory);
nameText.setText(rt.getName());
pathText.setText(rt.getPath());
versionText.setText(rt.getVersion());
}
}
public IRuntime getResult() {
return runtime;
}
protected void okPressed() {
runtime = getRuntimeManager().createNewRuntime();
runtime.setName(nameText.getText());
runtime.setPath(pathText.getText());
runtime.setVersion(versionText.getText());
super.okPressed();
}
abstract protected IRuntimeManager getRuntimeManager();
}
| [
"fred.oluoch@impalapay.com"
] | fred.oluoch@impalapay.com |
01af324d0a5d7ab980e50332fe2849c73218b2a7 | 1fc3417639490c181b7fe583ec9737c1874ce57f | /spepjava/tests/functional/com/qut/middleware/spep/InitializerTest.java | a57d8d241c2b2adba72952d2c92c57a51c9fa5b0 | [
"Apache-2.0"
] | permissive | ldaley/esoeproject | 2ae44a2aa6aafc1c42ed8c194865047a546f4a33 | 0857a3f97354df81431a30e5f2d55640144965d1 | refs/heads/master | 2021-05-26T21:00:48.457040 | 2009-08-04T03:28:52 | 2009-08-04T03:28:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,116 | java | /*
* Copyright 2006, Queensland University of Technology
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* Author: Shaun Mangelsdorf
* Creation Date: 8/12/2006
*
* Purpose: Tests the Initializer class.
*/
package com.qut.middleware.spep;
import static org.junit.Assert.*;
import static org.easymock.EasyMock.*;
import static com.qut.middleware.test.functional.Capture.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.StringBufferInputStream;
import java.util.Vector;
import javax.servlet.ServletContext;
import org.junit.Before;
import org.junit.Test;
import com.qut.middleware.test.functional.Capture;
/** */
public class InitializerTest
{
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception
{
// for method coverage only
new Initializer();
System.setProperty("spep.data", "webapp" + File.separator + "descriptors" );
}
/**
* Test method for {@link com.qut.middleware.spep.Initializer#init(javax.servlet.ServletContext)}.
* @throws Exception
*/
@Test
public void testInit1() throws Exception
{
Capture<SPEP> captureSPEP = new Capture<SPEP>();
ServletContext context = createMock(ServletContext.class);
expect(context.getAttribute((String)notNull())).andReturn(null).anyTimes();
context.setAttribute((String)notNull(), capture(captureSPEP));
expectLastCall().anyTimes();
InputStream spKeyStoreStream = new FileInputStream("tests" + File.separator + "testdata" + File.separator + "testspkeystore.ks");
expect(context.getResourceAsStream("/WEB-INF/spkeystore.ks")).andReturn(spKeyStoreStream).once();
replay(context);
Initializer.init(context);
verify(context);
Vector<SPEP> captured = captureSPEP.getCaptured();
assertTrue(captured.size() > 0);
SPEP spep = captured.get(0);
assertNotNull(spep);
}
/**
* Test method for {@link com.qut.middleware.spep.Initializer#init(javax.servlet.ServletContext)}.
* @throws Exception
*/
@Test
public void testInit2() throws Exception
{
SPEP spep = createMock(SPEP.class);
ServletContext context = createMock(ServletContext.class);
expect(context.getAttribute((String)notNull())).andReturn(spep).anyTimes();
replay(context);
assertSame(spep, Initializer.init(context));
verify(context);
}
/**
* Test method for {@link com.qut.middleware.spep.Initializer#init(javax.servlet.ServletContext)}.
* @throws Exception
*
* Test behaviour when an invalid context is provided.
*/
@Test (expected = IllegalArgumentException.class)
public void testInit3() throws Exception
{
Initializer.init(null);
}
/**
* Test method for {@link com.qut.middleware.spep.Initializer#init(javax.servlet.ServletContext)}.
* @throws Exception
*
* Test behaviour when properties fail to load.
*/
@Test (expected = IllegalArgumentException.class)
public void testInit4() throws Exception
{
ServletContext context = createMock(ServletContext.class);
expect(context.getAttribute((String)notNull())).andReturn(null).anyTimes();
InputStream configStream = new FileInputStream(System.getProperty("user.dir") + File.separator + "webapp" + File.separator + "descriptors" + File.separator + "spep.config");
expect(context.getResourceAsStream("/WEB-INF/spepvars.config")).andReturn(null).once();
replay(context);
Initializer.init(context);
}
}
| [
"bradleybeddoes@intient.com"
] | bradleybeddoes@intient.com |
bccb8c3d8393b4d804d937164a0b4a6d6fda8705 | 480baa2a93863372d1ed84c86052755cf7578c7a | /src/main/java/com/sha/springbootbookseller/security/jwt/JwtProvider.java | 7423106f75105fae774413aa7eda6c1cf4064d36 | [] | no_license | batuhanelibol/spring-boot-book-seller | 9725ad819cef76a3d37bb63fd5f58ece32844fd2 | 7700214f6ed9d00373fd8fbf987125d6b12dc9c0 | refs/heads/master | 2023-07-09T16:49:26.598260 | 2021-08-04T11:26:43 | 2021-08-04T11:26:43 | 392,661,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,191 | java | package com.sha.springbootbookseller.security.jwt;
import com.sha.springbootbookseller.security.UserPrincipal;
import com.sha.springbootbookseller.util.SecurityUtils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;
@Component
public class JwtProvider implements IJwtProvider
{
@Value("${app.jwt.secret}")
private String JWT_SECRET;
@Value("${app.jwt.expiration-in-ms}")
private Long JWT_EXPIRATION_IN_MS;
@Override
public String generateToken(UserPrincipal auth)
{
String authorities = auth.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(","));
return Jwts.builder()
.setSubject(auth.getUsername())
.claim("roles", authorities)
.claim("userId", auth.getId())
.setExpiration(new Date(System.currentTimeMillis() + JWT_EXPIRATION_IN_MS))
.signWith(SignatureAlgorithm.HS512, JWT_SECRET)
.compact();
}
@Override
public Authentication getAuthentication(HttpServletRequest request)
{
Claims claims = extractClaims(request);
if (claims == null)
{
return null;
}
String username = claims.getSubject();
Long userId = claims.get("userId", Long.class);
Set<GrantedAuthority> authorities = Arrays.stream(claims.get("roles").toString().split(","))
.map(SecurityUtils::convertToAuthority)
.collect(Collectors.toSet());
UserDetails userDetails = UserPrincipal.builder()
.username(username)
.authorities(authorities)
.id(userId)
.build();
if (username == null)
{
return null;
}
return new UsernamePasswordAuthenticationToken(userDetails, null, authorities);
}
@Override
public boolean validateToken(HttpServletRequest request)
{
Claims claims = extractClaims(request);
if (claims == null)
{
return false;
}
if (claims.getExpiration().before(new Date()))
{
return false;
}
return true;
}
private Claims extractClaims(HttpServletRequest request)
{
String token = SecurityUtils.extractAuthTokenFromRequest(request);
if (token == null)
{
return null;
}
return Jwts.parser()
.setSigningKey(JWT_SECRET)
.parseClaimsJws(token)
.getBody();
}
}
| [
"batuhanelibol94@gmail.com"
] | batuhanelibol94@gmail.com |
1c3b5c23637527d8aba49a33ec0dff2148d994b0 | f7463a562aef1fbd6b56d45b6a3d94108fb8d501 | /RigitalApp.api/src/main/java/co/edu/uniandes/csw/grupo/softwaresalas/master/logic/api/_ISoftwareSalasMasterLogicService.java | eada0583a0e0b34416d67ac26c994edca84e93f0 | [] | no_license | paotoya757/Rigital---production-repo | 7d17058a4a342862924d89260da0fef2566ad0eb | e51899e6f00c37dc441bdad602871fcbfe44f984 | refs/heads/master | 2021-01-13T01:31:24.431190 | 2014-12-02T06:42:55 | 2014-12-02T06:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,843 | java |
/* ========================================================================
* Copyright 2014 grupo
*
* Licensed under the MIT, The MIT License (MIT)
* Copyright (c) 2014 grupo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
* ========================================================================
Source generated by CrudMaker version 1.0.0.201410152247
*/
package co.edu.uniandes.csw.grupo.softwaresalas.master.logic.api;
import co.edu.uniandes.csw.grupo.softwaresalas.master.logic.dto.SoftwareSalasMasterDTO;
public interface _ISoftwareSalasMasterLogicService {
public SoftwareSalasMasterDTO createMasterSoftwareSalas(SoftwareSalasMasterDTO detail);
public void updateMasterSoftwareSalas(SoftwareSalasMasterDTO detail);
public void deleteMasterSoftwareSalas(Long id);
public SoftwareSalasMasterDTO getMasterSoftwareSalas(Long id);
} | [
"pa.otoya757@uniandes.edu.co"
] | pa.otoya757@uniandes.edu.co |
5be5a9423e543cc0da69675a5ca097a0aab0d6f8 | c6f63cf4524567f12d4226b9cdcbfee9c5c3d95c | /gen/main/java/org/hl7/fhir/ProcedureFocalDevice.java | b2302958e0546da827d6de593239531bf434ee8b | [] | no_license | usnistgov/fhir.emf | 83852f9388619fa7b76c05dd725c311c96e733e6 | affea7e1fc2b53cb67e706f47264b408909b2253 | refs/heads/master | 2021-01-11T02:40:21.282622 | 2016-10-21T18:51:25 | 2016-10-21T18:51:25 | 70,912,620 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,827 | java | /**
*/
package org.hl7.fhir;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Procedure Focal Device</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
* An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.ProcedureFocalDevice#getAction <em>Action</em>}</li>
* <li>{@link org.hl7.fhir.ProcedureFocalDevice#getManipulated <em>Manipulated</em>}</li>
* </ul>
*
* @see org.hl7.fhir.FhirPackage#getProcedureFocalDevice()
* @model extendedMetaData="name='Procedure.FocalDevice' kind='elementOnly'"
* @generated
*/
public interface ProcedureFocalDevice extends BackboneElement {
/**
* Returns the value of the '<em><b>Action</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The kind of change that happened to the device during the procedure.
* <!-- end-model-doc -->
* @return the value of the '<em>Action</em>' containment reference.
* @see #setAction(CodeableConcept)
* @see org.hl7.fhir.FhirPackage#getProcedureFocalDevice_Action()
* @model containment="true"
* extendedMetaData="kind='element' name='action' namespace='##targetNamespace'"
* @generated
*/
CodeableConcept getAction();
/**
* Sets the value of the '{@link org.hl7.fhir.ProcedureFocalDevice#getAction <em>Action</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Action</em>' containment reference.
* @see #getAction()
* @generated
*/
void setAction(CodeableConcept value);
/**
* Returns the value of the '<em><b>Manipulated</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The device that was manipulated (changed) during the procedure.
* <!-- end-model-doc -->
* @return the value of the '<em>Manipulated</em>' containment reference.
* @see #setManipulated(Reference)
* @see org.hl7.fhir.FhirPackage#getProcedureFocalDevice_Manipulated()
* @model containment="true" required="true"
* extendedMetaData="kind='element' name='manipulated' namespace='##targetNamespace'"
* @generated
*/
Reference getManipulated();
/**
* Sets the value of the '{@link org.hl7.fhir.ProcedureFocalDevice#getManipulated <em>Manipulated</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Manipulated</em>' containment reference.
* @see #getManipulated()
* @generated
*/
void setManipulated(Reference value);
} // ProcedureFocalDevice
| [
"geoffry.roberts@nist.gov"
] | geoffry.roberts@nist.gov |
f26172262803c9bb3e7726b7a89ed3bf4bb374cc | b175929833656b550c2c0b5523e488905b0139c8 | /src/main/java/org/perscholas/Firstspringbootproject/dao/CurrentMealsRepo.java | a297c3c5ee3d40a380c1b72b85a4c1bbebbc5d8c | [] | no_license | kateoriley1/Case-Study | dc27757e606f7a1c0a27e7d1726c050c35e98e8d | f6e382748021258f93fe4dbb4fa5540d6ac255d9 | refs/heads/main | 2023-07-11T01:45:14.097669 | 2021-08-26T16:35:53 | 2021-08-26T16:35:53 | 399,203,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package org.perscholas.Firstspringbootproject.dao;
import org.perscholas.Firstspringbootproject.models.CurrentMeals;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CurrentMealsRepo extends JpaRepository<CurrentMeals, Integer> {
List<CurrentMeals> findAll();
@Query("select p.id from #{#entityName} p")
List<Integer> getAllIds();
CurrentMeals findByMealcode(Integer mealcode);
}
| [
"77642211+kateoriley1@users.noreply.github.com"
] | 77642211+kateoriley1@users.noreply.github.com |
512b0e5e3298d7066125b160f44bdc63564ce12c | 3f054fcd6fdec6cf77153066268fe7287e884ab1 | /src/main/java/org/itstep/controller/HomeController.java | 66d506dbd6ca05a200e13bbbcb62af43699f441b | [] | no_license | kukuyashnyy/hello-sping-jpa | e1ff5d207d009e5473a761c14761ff0e3ac99cc1 | 385ee9ab13642feac11e44032b234b19b14d1704 | refs/heads/master | 2023-04-04T21:21:18.643109 | 2021-01-27T21:01:12 | 2021-01-27T21:01:12 | 333,558,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package org.itstep.controller;
import org.itstep.controller.domain.dao.TaskDao;
import org.itstep.controller.domain.entity.Task;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.List;
@Controller
public class HomeController {
private final TaskDao taskDao;
public HomeController(TaskDao taskDao) {
this.taskDao = taskDao;
}
@GetMapping
public String index(Model model) {
List<Task> tasks = taskDao.findAll();
if (tasks != null) {
model.addAttribute("tasks", tasks);
}
return "index";
}
@GetMapping("/delete/{id}")
public String delete(@PathVariable Integer id) {
taskDao.delete(taskDao.findById(id));
return "redirect:/";
}
@PostMapping
public String create(String context, Task task) {
switch (context) {
case "create" :
taskDao.save(task);
break;
case "update" :
taskDao.update(task);
break;
}
return "redirect:/";
}
}
| [
"starsonic71@gmail.com"
] | starsonic71@gmail.com |
5026f37016ce563317923462d25d930e208c6f29 | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_3/src/b/g/b/f/Calc_1_3_16159.java | da3245c643eb32e152c1d2d445a724d94c9f9bcd | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.g.b.f;
public class Calc_1_3_16159 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
5474e2cbac052d7da8c123d881472cb0f457b51c | d01d55178835a8db9f8cc3333b8b39c49c544954 | /src/main/java/com/yvonne/advanced/design/pattern/structure/Bridge.java | e9ec1573758049d1eb6fd6023a4ca16b6a41b1ea | [] | no_license | Yvonne8888/sunshine | 4cdf4115177ad452e56b130b0c68256546bd8048 | bbcaa5fc575ba4296a3f9231ff92eb222e302382 | refs/heads/master | 2023-04-15T10:49:26.207232 | 2021-04-26T15:37:13 | 2021-04-26T15:37:13 | 355,614,647 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,844 | java | package com.yvonne.advanced.design.pattern.structure;
/**
* 桥接模式:
* 将抽象化与实现化解耦,使得二者可以独立变化
* 我们常用的JDBC桥DriverManager一样,JDBC进行连接数据库时,在各个数据库之间进行切换,基本不需要动太多的代码,甚至丝毫不动
* 原因就是JDBC统一接口,每个数据库提供各自的实现,用一个叫做数据库驱动的程序来桥接
*/
public class Bridge {
public static void main(String[] args) {
SourceSub1 sourceSub1 = new SourceSub1();//实现类对象
SourceSub2 sourceSub2 = new SourceSub2();//实现类对象
MyBridge myBridge = new MyBridge();//功能桥
myBridge.setSourceable3(sourceSub1);//桥接
myBridge.method();//使用桥接后的方法
myBridge.setSourceable3(sourceSub2);//桥接
myBridge.method();//使用桥接后的方法
}
}
//接口
interface Sourceable3{
void method();
}
//实现类1
class SourceSub1 implements Sourceable3{
@Override
public void method() {
System.out.println("This is SourceSub1 method!");
}
}
//实现类2
class SourceSub2 implements Sourceable3{
@Override
public void method() {
System.out.println("This is SourceSub2 method!");
}
}
//定义一个抽象的桥
abstract class AbstractBridge{
private Sourceable3 sourceable3;
//桥接后实现动态方法调用
public void method(){
sourceable3.method();
}
public Sourceable3 getSourceable3() {
return sourceable3;
}
public void setSourceable3(Sourceable3 sourceable3) {
this.sourceable3 = sourceable3;
}
}
//继承使用抽象的桥
class MyBridge extends AbstractBridge{
@Override
public void method(){
getSourceable3().method();
}
}
| [
"826726727@qq.com"
] | 826726727@qq.com |
df64fb802e1f4f46cb4a0493f45ea4b90b632c9a | 221e29cea8c4f61b856420db326fdcc6f6319bf9 | /src/main/java/com/whx/design_pattern/state/TVContext.java | 7c65ce27b8ab74717644f5b99564ddd62b1d2c3f | [] | no_license | whx4J8/base-know | ba0fd32b9cd5f8bd0f9c42bef98c48ced3c2cd11 | d29bebb3508fad37af714e85c3b54b7e7e0dfcf0 | refs/heads/master | 2021-01-10T01:38:45.095162 | 2016-02-04T14:59:25 | 2016-02-04T14:59:25 | 47,308,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.whx.design_pattern.state;
/**
* Created by wanghongxing on 15/12/7.
*/
public class TVContext implements State {
private State tvState;
public State getTvState() {
return tvState;
}
public void setTvState(State tvState) {
this.tvState = tvState;
}
@Override
public void doAction() {
this.tvState.doAction();
}
}
| [
"750702272@qq.com"
] | 750702272@qq.com |
6b14f47a09aae5ae9d943c0cab05c1e82d669efa | 9c75beccff2dcd9177e3b10095362e7a5efaae84 | /src/main/java/com/hzmc/nbgsyn/business/dao/IServiceUserDao.java | 168e83db5cdfaaabc100148ef43e9c7b1c820588 | [] | no_license | mc-chentf/nbgsyn | 0b06f9931f614828b64501d7e5abf2cabdf339cb | bc65f44347ff00bd5a53553c780f4da552c0da40 | refs/heads/master | 2020-05-22T01:05:55.634307 | 2016-09-28T06:16:56 | 2016-09-28T06:16:56 | 63,122,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.hzmc.nbgsyn.business.dao;
import com.hzmc.nbgsyn.pojo.ServiceUser;
public interface IServiceUserDao {
public ServiceUser findServiceUserByCondition(ServiceUser serviceUser);
}
| [
"chentf@mchz.com.cn"
] | chentf@mchz.com.cn |
cf7cfb3f60afca7f17134f802d8e6110fa04b5d6 | 6978e0268b5f1470b38e535cd134da2c7e31718c | /src/main/java/com/bing/mapper/ProductYisunTireMapper.java | 36ff0ed51e36dc4ea1a586d69c764cfde4b39d2a | [] | no_license | jiangnan98/JiangNan | 8d3b008d0a94bde35d7a93458cc524c66635d74e | 8bbb098118683989e449ee6f42329fb6f2bb5cd8 | refs/heads/master | 2022-07-09T06:02:52.351096 | 2019-06-11T11:28:33 | 2019-06-11T11:28:33 | 136,498,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.bing.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.bing.model.ProductYisunTire;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jiang
* @since 2019-04-29
*/
@Repository
public interface ProductYisunTireMapper extends BaseMapper<ProductYisunTire> {
}
| [
"liliubing@qq.com"
] | liliubing@qq.com |
4900feb90bb2c1ebd3f22f306bf949ab2d4fae0e | c28e2d528a45f19a01d99c0d1735f571ba5428b8 | /src/Board.java | fb6aa9c684058b2887f2d8b62aa426937ac6b636 | [] | no_license | RichardsJ17/Checkers-AI | 9e137ff76b13dc84d888a2b063f23575f261a569 | e06208180ea0dfedc836e75ebe49257eb6a63065 | refs/heads/main | 2023-08-11T08:36:13.847303 | 2021-09-30T15:37:13 | 2021-09-30T15:37:13 | 412,108,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,279 | java | import java.util.ArrayList;
public class Board {
private Piece[][] board;
private String[][] textBoard;
private ArrayList<Piece> redPieces;
private ArrayList<Piece> blackPieces;
public Board()
{
this.board = new Piece[8][8];
this.textBoard = new String[18][18];
this.redPieces = new ArrayList<Piece>();
this.blackPieces = new ArrayList<Piece>();
setUpTextBoard();
}
// Finish
public Board duplicateBoard(){
Board replicaGameState = new Board();
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
if(this.board[i][j] != null)
{
replicaGameState.board[i][j] = this.board[i][j].duplicatePiece();
if(this.board[i][j].getColor().equals("Red")) {
replicaGameState.redPieces.add(replicaGameState.board[i][j]);
} else {
replicaGameState.blackPieces.add(replicaGameState.board[i][j]);
}
}
}
}
for(int i = 0; i < 18; i++)
{
for(int j = 0; j < 18; j++)
{
replicaGameState.textBoard[i][j] = this.textBoard[i][j];
}
}
return replicaGameState;
}
public void movePiece(Position pos, Position targetPos)
{
Position textPosition = getTextCoords(pos);
Piece movingPiece = getPiece(pos.getRow(), pos.getCol());
this.board[targetPos.getRow()][targetPos.getCol()] = movingPiece;
movingPiece.setPosition(targetPos);
this.board[pos.getRow()][pos.getCol()] = null;
this.textBoard[textPosition.getRow()][textPosition.getCol()] = " ";
// King me
if (movingPiece.getColor().equals("Red") && targetPos.getRow() == 7 || movingPiece.getColor().equals("Black") && targetPos.getRow() == 0) {
movingPiece.setKing();
}
// Removing jumped piece
if (Math.abs(targetPos.getRow() - pos.getRow()) == 2) {
Position jumpedPosition = getJumpedPieceCoords(pos, targetPos);
textPosition = getTextCoords(jumpedPosition);
Piece removedPiece = getPiece(jumpedPosition.getRow(), jumpedPosition.getCol());
this.board[jumpedPosition.getRow()][jumpedPosition.getCol()] = null;
this.textBoard[textPosition.getRow()][textPosition.getCol()] = " ";
ArrayList<Piece> pieces = getPieces(removedPiece.getColor());
for(int i = 0; i < pieces.size(); i++) {
if(pieces.get(i).getId() == removedPiece.getId()) {
pieces.remove(i);
break;
}
}
}
drawPiece (movingPiece, targetPos.getRow(), targetPos.getCol());
}
public Piece getPiece(int currentRow, int currentCol)
{
return this.board[currentRow][currentCol];
}
public void addPiece(Piece p, int targetRow, int targetCol)
{
if(p.getColor().equals("Red")) {
this.redPieces.add(p);
} else {
this.blackPieces.add(p);
}
this.board[targetRow][targetCol] = p;
drawPiece(p, targetRow, targetCol);
}
public String[][] displayBoard()
{
return this.textBoard;
}
private void drawPiece(Piece p, int targetRow, int targetCol)
{
Position textPosition = getTextCoords(new Position(targetRow, targetCol));
if(p.getColor() == "Red")
{
if(p.isKing())
{
this.textBoard[textPosition.getRow()][textPosition.getCol()] = "X";
}
else
{
this.textBoard[textPosition.getRow()][textPosition.getCol()] = "x";
}
}
else if(p.getColor() == "Black")
{
if(p.isKing())
{
this.textBoard[textPosition.getRow()][textPosition.getCol()] = "O";
}
else
{
this.textBoard[textPosition.getRow()][textPosition.getCol()] = "o";
}
}
}
private Position getTextCoords(Position position) {
return new Position((position.getRow() + 1) * 2, (position.getCol() + 1) * 2);
}
private Position getJumpedPieceCoords(Position startingPosition, Position targetPosition) {
return new Position((startingPosition.getRow() + targetPosition.getRow()) / 2, (startingPosition.getCol() + targetPosition.getCol()) / 2);
}
public ArrayList<Piece> getRedPieces() {
return this.redPieces;
}
public ArrayList<Piece> getBlackPieces() {
return this.blackPieces;
}
public ArrayList<Piece> getPieces(String color) {
if(color.toLowerCase().equals("red")) {
return this.redPieces;
} else {
return this.blackPieces;
}
}
public boolean isGameOver() {
if(this.redPieces.isEmpty() || this.blackPieces.isEmpty()) {
return true;
} else {
return false;
}
}
public void setUpTextBoard()
{
int colCount = 0;
int rowCount = 0;
// row
for(int i = 0; i < 18; i++)
{
// col
for(int j = 0; j < 18; j++)
{
// Labeling rows
if((i > 0) && (i %2 == 0) && (j == 0))
{
this.textBoard[i][j] = Integer.toString(rowCount + 1);
rowCount++;
}
// Placing "|"
else if(((i > 0) && (j % 2 == 1) && (i % 2 == 0)) || ((i > 1 && i < 17) && (j == 1 || j == 17)))
{
this.textBoard[i][j] = "|";
}
// Labeling cols
else if((i == 0) && (j > 0) && (j % 2 == 0))
{
this.textBoard[i][j] = Integer.toString(colCount + 1);
colCount++;
}
// Placing "-"
else if(((i > 0) && (j > 0) && (j % 2 == 0) && (i % 2 == 1)) || (j > 1 && j < 17) &&(i == 1 || i == 17))
{
this.textBoard[i][j] = "-";
}
// Placing "+"
else if(((i > 0) && (j > 0) && (j % 2 == 1) && (i % 2 == 1)))
{
this.textBoard[i][j] = "+";
}
// Placing initial empty spaces
else
{
this.textBoard[i][j] = " ";
}
}
}
}
}
| [
"the6thj@hotmail.com"
] | the6thj@hotmail.com |
a0318fb18386eb0a931eb5bfe191a14130bf5ebb | d83cd1d3cf8182a3cde81a107e2dabdc14252538 | /LiveStreamer/src/main/java/mcomp/dissertation/live/serverconnect/NettyServerConnect.java | f04a53d5ebbe7eb778009589400cc8f8cd3a47f6 | [] | no_license | abhinav-sunderrajan/LiveStreamer | c7e7ef36e0086c80e449c5ce78616b85ea39d7f7 | cb19d9fc19318694e91adc1720f2e74f55a66f6d | refs/heads/master | 2020-04-05T02:55:43.615668 | 2013-04-30T11:57:08 | 2013-04-30T11:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,539 | java | package mcomp.dissertation.live.serverconnect;
import java.net.InetSocketAddress;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import mcomp.dissertation.beans.LiveTrafficBean;
import mcomp.dissertation.beans.LiveWeatherBean;
import org.apache.log4j.Logger;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.DownstreamMessageEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.channel.UpstreamMessageEvent;
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
import org.jboss.netty.handler.codec.serialization.ClassResolvers;
import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
/**
*
* This class is responsible for establishing a connection to the server
*
*/
public class NettyServerConnect<E> {
private String serverAddr;
private ClientBootstrap bootstrap;
private ChannelFuture future;
private Queue<E> buffer;
private ChannelFactory factory;
private ScheduledExecutorService executor;
private int streamRate;
private static final Logger LOGGER = Logger
.getLogger(NettyServerConnect.class);
/**
*
* @param serverIP
* @param buffer
* @param executor
* @param streamRate
*/
public NettyServerConnect(String serverIP,
final ConcurrentLinkedQueue<E> buffer,
final ScheduledExecutorService executor, final int streamRate) {
this.serverAddr = serverIP;
this.buffer = buffer;
this.executor = executor;
this.streamRate = streamRate;
this.factory = new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
/**
* Call method to establish connection with server with a timeout of 10
* seconds.
* @param serverPort
* @param buffer
* @throws InterruptedException
*/
public void connectToNettyServer(final int serverPort)
throws InterruptedException {
bootstrap = new ClientBootstrap(factory);
bootstrap.setOption("tcpNoDelay", true);
bootstrap.setOption("keepAlive", true);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() {
return Channels.pipeline(new ObjectEncoder(), new ObjectDecoder(
ClassResolvers.cacheDisabled(getClass().getClassLoader())),
new SendUpStream(), new LiveBeanSender());
}
});
future = bootstrap.connect(new InetSocketAddress(serverAddr, serverPort));
future.await(10, TimeUnit.SECONDS);
LOGGER.info("Connected to server");
Channel channel = future.getChannel();
channel.write(new String("A0092715"));
}
/**
*
* Send live data to the server.
*
*/
private class SendUpStream extends SimpleChannelHandler {
private Runnable runnable;
private Channel channel;
ChannelHandlerContext context;
private ChannelEvent responseEvent;
private SendUpStream() {
runnable = new Runnable() {
public void run() {
while (buffer.isEmpty()) {
// Poll till the producer has filled the queue. Bad approach
// will
// optimize this.
}
E obj = buffer.poll();
responseEvent = new UpstreamMessageEvent(channel, obj,
channel.getRemoteAddress());
context.sendUpstream(responseEvent);
}
};
}
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
if (e.getMessage() instanceof String) {
String msg = (String) e.getMessage();
if (msg.equalsIgnoreCase("Gandu")) {
channel = e.getChannel();
context = ctx;
executor.scheduleAtFixedRate(runnable, 0, streamRate,
TimeUnit.MICROSECONDS);
}
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
e.getCause().printStackTrace();
e.getChannel().close();
}
}
private class LiveBeanSender extends SimpleChannelHandler {
private long count = 0;
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
Channel channel = e.getChannel();
ChannelFuture channelFuture = Channels.future(e.getChannel());
ChannelEvent responseEvent;
Object bean = e.getMessage();
responseEvent = new DownstreamMessageEvent(channel, channelFuture,
bean, channel.getRemoteAddress());
ctx.sendDownstream(responseEvent);
count++;
if (count % 1000 == 0) {
long freemem = Runtime.getRuntime().freeMemory();
long totalmem = Runtime.getRuntime().totalMemory();
if (bean instanceof LiveTrafficBean) {
LOGGER.info("Traffic count is " + count + " and free mem % is "
+ (freemem * 100.0 / (freemem + totalmem)) + " at "
+ ((LiveTrafficBean) bean).getTimeStamp());
}
if (bean instanceof LiveWeatherBean) {
LOGGER.info("Weather count is " + count + " at "
+ ((LiveWeatherBean) bean).getTimeStamp());
}
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
e.getCause().printStackTrace();
e.getChannel().close();
}
}
}
| [
"abhinav.rajan0@gmail.com"
] | abhinav.rajan0@gmail.com |
aac282a06e61511f4688d530c35b6d9a19b05591 | cf08762833b4891bd89b9e0395a546b5241a958f | /config-client/src/main/java/com/example/demo/ConfigClientApplication.java | aee42040d47c8f1ce9d347c40bd2612dd2ceee25 | [] | no_license | bueryang/spc | 7916c722665775fd77576a20940353750f331540 | 0eb813a51f081d5ca9becb2c67dc3dd408e09975 | refs/heads/master | 2021-01-25T13:23:26.191991 | 2018-03-02T10:09:39 | 2018-03-02T10:09:39 | 123,560,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.example.demo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
@EnableDiscoveryClient
@RefreshScope
@EnableEurekaClient
public class ConfigClientApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigClientApplication.class, args);
}
@Value("${foo}")
String foo;
@RequestMapping(value = "/hi")
public String hi() {
return foo;
}
}
| [
"xxiao@singlemountaintech.com"
] | xxiao@singlemountaintech.com |
85740249617777dcf06a5cb0b3f670e2e3a5b034 | d20c1110891fdc9206c4a8e0dc8909afcf8ff398 | /smartapp/app/src/main/java/com/tahitu/smartgoing/Algorithm/FindBestPath.java | e72647807d3e7428bc3243ea30469055895bf115 | [
"MIT"
] | permissive | csvhub/Happy-Light | 87d4bcd8ab3d8feb9c852a7eb09376d7d17b49c6 | 66885a864361d807d15e23e63f62582bbc7ac3f1 | refs/heads/master | 2020-03-06T14:15:39.670650 | 2018-03-27T05:21:01 | 2018-03-27T05:21:01 | 126,932,581 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,651 | java | package com.tahitu.smartgoing.Algorithm;
/**
* Created by DELL on 12/7/2016.
*/
public class FindBestPath {
public static double best = Double.MAX_VALUE;
public static Boolean[] check = new Boolean[11];
public static float[] T = new float[11];
public static int[] trace = new int[11];
public static int[] bestTrace = new int[11];
public static Route[][] matrixRoute;
private static int n;
public static void calCost(int i)
{
for (int j = 1; j <= n; j++)
{
if (check[j] == false)
{
trace[i] = j;
T[i] = T[i - 1] + matrixRoute[trace[i - 1]][j].distance.value;
if (T[i] < best)
{
if (i < n)
{
check[j] = true;
calCost(i + 1);
check[j] = false;
}
else
{
best = T[n];
for (int k = 1; k <= n; k++)
bestTrace[k] = trace[k];
//cout << "\n-------" << best << "\n";
}
}
}
}
}
public static int[] getBestPath(int total) {
n = SolutionMap.getSizeListPlaces();
best = Double.MAX_VALUE;
for (int i=1; i < 10; i++) {
check[i] = false;
T[i] = 0;
trace[i] = 0;
bestTrace[i] = 0;
}
trace[1] = 1;
check[1] = true;
n=total;
calCost(2);
return bestTrace;
}
}
| [
"hachange.sgroup@gmail.com"
] | hachange.sgroup@gmail.com |
4bc25874fe813b91d892808421819ce11211bdf0 | 2eaaa776ebdfc1bf75aac8f506251fd4482005ec | /src/main/java/com/uok/sams/security/jwt/AuthEntryPointJwt.java | fec391ee945af56998efb85c60f6d3a54755d365 | [] | no_license | ayeshaanuruddha/sams | a23c3ebd2c076402932ba7c65054877122060c17 | 10c00b91496994ece5e11172cb9b97c5a59e8940 | refs/heads/main | 2023-08-25T14:32:19.428282 | 2021-11-11T17:30:15 | 2021-11-11T17:30:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package com.uok.sams.security.jwt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class AuthEntryPointJwt implements AuthenticationEntryPoint {
private static final Logger logger = LoggerFactory.getLogger(AuthEntryPointJwt.class);
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
logger.error("Unauthorized error: {}", authException.getMessage());
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Error: Unauthorized");
}
}
| [
"tharukavishwajiths@gmail.com"
] | tharukavishwajiths@gmail.com |
cf27041bc6c40859a0449d2217a46c41dc59e9f0 | c3dd084079c86284c1957be963a0b183fc59af38 | /src/main/java/com/cis/demosrping/mapper/OpinionTaskMapper.java | b311f2b5d6fcbb52a8d5808c520e6e24f5f4c1b4 | [] | no_license | hankuikuide/demo-srping | b2b2b3e614c66fc40464bde5562526fed0c53064 | f55b605c4816f699f91823f8628a5ccf8f62d820 | refs/heads/master | 2020-04-07T07:57:39.857927 | 2018-11-20T05:45:20 | 2018-11-20T05:45:20 | 158,195,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package com.cis.demosrping.mapper;
import com.cis.demosrping.model.OpinionTask;
import com.cis.demosrping.model.OpinionTaskHospitalResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
public interface OpinionTaskMapper {
OpinionTaskHospitalResult selectOpinionTask(String id);
List<OpinionTaskHospitalResult> selectOpinionAll();
void InsertOpinionTask(OpinionTaskHospitalResult task);
List<OpinionTaskHospitalResult> GetOpinionTaskHospitals(@Param("hospitalIds")List<String> hospitalIds, @Param("month")String month, @Param("regionMode")boolean regionMode);
}
| [
"hankuikuide@163.com"
] | hankuikuide@163.com |
f1c543e553feed542b1d7962dfd8494773fddbb7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_eb177a0acc4d982bee5c27a89176470cbad7cd7f/CatchClause/6_eb177a0acc4d982bee5c27a89176470cbad7cd7f_CatchClause_t.java | 256ac0d03d67f01ea1673e241c07b1ea0f64bbec | [] | 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 | 608 | java | package net.primitive.javascript.core.ast;
import lombok.Getter;
import net.primitive.javascript.core.visitors.StatementVisitor;
public class CatchClause extends Statement {
@Getter private final String identifier;
@Getter private final Statement[] statements;
public CatchClause(String identifier, AstNodeList astNode) {
this.identifier = identifier;
this.statements = astNode.getAstNodes().toArray(new Statement[] {});
astNode.setParentNode(this);
}
@Override
public void accept(StatementVisitor visitor) {
visitor.visitCatchClause(this);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
cb84bf2d0c2399b47a671b4140b18f3cf5679ee4 | b1bbab648cd11846c7ec8607433f21c2ffaea74c | /pet-clinic-data/src/main/java/mermody/springframework/petclinic/repositories/VisitRepository.java | 821e72581369640339cd5b0dae5a8000b493f2ac | [] | no_license | m3rmody/pet-clinic | 6cc9c4862a492d2b682b8d1d42cb183b353cefc6 | d6b2739d216aebbeb76b32329fa9d5a83dbe588d | refs/heads/master | 2022-12-19T06:13:21.873696 | 2020-09-26T16:53:47 | 2020-09-26T16:53:47 | 294,402,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package mermody.springframework.petclinic.repositories;
import mermody.springframework.petclinic.model.Visit;
import org.springframework.data.repository.CrudRepository;
public interface VisitRepository extends CrudRepository<Visit, Long> {
}
| [
"dmytro.shevchenkoit@gmail.com"
] | dmytro.shevchenkoit@gmail.com |
d66281a9cf994c87990df9243ea0664504133c97 | 0a1fa35658ff42aaeea9fac29c51ee8bede8698a | /src/AktionsControl.java | bdb450afbf1ac7e5cf8547c4cf70534349ddd6f5 | [] | no_license | jgraeger/siedler | 345b5dbb19ecbc75c37ae18026fb73785ab2b948 | 570bc5f2cc3d230937c2c239cd8d535a38e36da3 | refs/heads/master | 2020-04-10T19:15:51.468703 | 2015-07-10T17:58:15 | 2015-07-10T17:58:15 | 38,894,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,410 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Reagiert auf Eingaben von AktionsPanel, und stößt notfalls im GameManager die notwendigen Änderungen an
* @author jbrose
*/
public class AktionsControl implements ActionListener {
public AktionsControl() {
}
@Override
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
if (actionCommand.equals("throwDices")){
if (Main.optionManager.getDiceAnimation()){
JOptionPane.showMessageDialog(null, ImageManager.getImageIcon("img/sonstige/wuerfel.gif"), null, JOptionPane.PLAIN_MESSAGE);
}
Main.gameManager.wuerfeln();
} else if (actionCommand.equals("trade")){
Main.gameManager.handel();
} else if (actionCommand.equals("buyCard")){
//Der Spieler kann sich die Karte leisten, da der Knopf sonst nicht klickbar wäre
Entwicklungskarte karte = Entwicklungskarte.getEntwicklungskarte();
if (karte == null){
//Es gibt keine Karten mehr
JOptionPane.showMessageDialog(null, "Es wurden schon alle Karten gezogen!", "Fehler", JOptionPane.ERROR_MESSAGE);
return;
}
JOptionPane.showMessageDialog(null, Main.gameManager.getCurrentPlayer().getName() + " hat eine " + karte.getName() + " erhalten", "Entwicklungskarte", JOptionPane.INFORMATION_MESSAGE);
Main.gameManager.getCurrentPlayer().addEntwicklungskarte(karte);
Main.gameManager.getCurrentPlayer().karteKaufen();
String currentPlayer = Main.gameManager.getCurrentPlayer().getName().toString();
Main.gameManager.log(currentPlayer + " hat eine Entwicklungskarte gekauft",false);
} else if (actionCommand.equals("playCard")){
EntwicklungsControl control = new EntwicklungsControl(Main.gameManager.getCurrentPlayer());
new EntwicklungsView(control,Main.gameManager.getCurrentPlayer());
Main.gameManager.notifyer();
} else if (actionCommand.equals("nextTurn")){
Main.gameManager.naechsteRunde();
}
}
}
| [
"jgraeger@iPad-Charite.local"
] | jgraeger@iPad-Charite.local |
911980dc6b1329a157260ad671c87f373b083d7b | 5a291e1bbcd7160d15fdf90f2d695ad2af1516f0 | /src/main/java/com/sportradar/unifiedodds/example/impl/utils/BatchTaskProcessor.java | b182a2be77612f08548b30610f714bf1fc351864 | [] | no_license | eroznik/advanced-uof-sdk-example | 57f2f0d0a39a95522619b3b51d78b726a5d206b4 | 1e6f310f6adae5d91744fa16f9955967342077b1 | refs/heads/master | 2022-12-23T09:57:18.000595 | 2020-09-17T11:33:50 | 2020-09-17T11:33:50 | 296,292,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,993 | java | package com.sportradar.unifiedodds.example.impl.utils;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
public class BatchTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(BatchTaskProcessor.class);
private final String identifier;
private final Executor executor;
private final Map<String, List<Runnable>> batch;
public BatchTaskProcessor(final String identifier,
final Executor executor,
final Map<String, List<Runnable>> batch) {
Preconditions.checkNotNull(identifier);
Preconditions.checkNotNull(executor);
Preconditions.checkNotNull(batch);
this.identifier = identifier;
this.executor = executor;
this.batch = batch;
}
public void processBatch(Runnable onBatchCompleted) {
final Stopwatch stopwatch = Stopwatch.createStarted();
final AtomicInteger processedCount = new AtomicInteger(this.batch.size());
final OnOrderedTasksCompletedCallback callback = () -> onProcessedCountChange(processedCount, stopwatch, onBatchCompleted);
final int numOfRecords;
final List<Runnable> runnables;
{
int numOfRecordsLocal = 0;
runnables = new ArrayList<>(this.batch.size());
for (final List<Runnable> group : this.batch.values()) {
final ArrayList<Runnable> ordered = new ArrayList<>(group);
numOfRecordsLocal += ordered.size();
runnables.add(new OrderedTasks(ordered, callback, this.executor));
}
numOfRecords = numOfRecordsLocal;
}
logger.info("[{}] Processing '{}' records in '{}' queues", identifier, numOfRecords, runnables.size());
try {
for (final Runnable runnable : runnables) {
this.executor.execute(runnable);
}
} catch (final Exception e) {
logger.error("[{}] Failed to schedule records processing, exc:", identifier, e);
tryStartNewBatch(stopwatch, onBatchCompleted);
}
}
private synchronized void onProcessedCountChange(AtomicInteger processedCount,
Stopwatch stopwatch,
Runnable onBatchCompleted) {
int i = processedCount.decrementAndGet();
if (i > 0) {
return;
}
tryStartNewBatch(stopwatch, onBatchCompleted);
}
private void tryStartNewBatch(Stopwatch stopwatch, Runnable onBatchCompleted) {
logger.info("[{}] Batch processing completed, execution time: {}", identifier, stopwatch.elapsed());
try {
onBatchCompleted.run();
} catch (Exception e) {
logger.error("[{}] An exception occurred while restarting batch, exc: {}", identifier, e.getMessage(), e);
}
}
@FunctionalInterface
private interface OnOrderedTasksCompletedCallback {
void onTasksCompleted();
}
private static final class OrderedTasks implements Runnable {
private final ArrayList<Runnable> runnables;
private final OnOrderedTasksCompletedCallback onOrderedTasksCompletedCallback;
private final Executor executor;
private int index;
private OrderedTasks(final ArrayList<Runnable> runnables,
final OnOrderedTasksCompletedCallback onOrderedTasksCompletedCallback,
final Executor executor) {
this.runnables = runnables;
this.onOrderedTasksCompletedCallback = onOrderedTasksCompletedCallback;
this.executor = executor;
this.index = 0;
}
@Override
public void run() {
try {
final Runnable runnable = this.runnables.get(this.index);
if (runnable != null) {
runnable.run();
}
} catch (final Exception exc) {
logger.error("Unexpected exc in run(): ", exc);
} finally {
this.index++;
if (this.index < this.runnables.size()) {
this.enqueueNext();
} else {
this.markAsDone();
}
}
}
private void enqueueNext() {
try {
this.executor.execute(this);
} catch (final Exception exc) {
logger.error("Unexpected exc in enqueueNext(): ", exc);
this.markAsDone();
}
}
private void markAsDone() {
onOrderedTasksCompletedCallback.onTasksCompleted();
}
}
} | [
"e.roznik@sportradar.com"
] | e.roznik@sportradar.com |
d2476ee7bd56de8c957befe8be51536c0802013c | 3ec329a6d5a75006ad6279b5cd26a76abae1f7c9 | /Incubator/Incubator/src/isolette/TemperatureSensor.java | 004cc325c2561751d52e6b27659f17b69bebb4d6 | [] | no_license | akshaymnair/Incubator | dad63de964a997e4bb2fdef7b68c4238221cf258 | 56813b7bb722a71a98e83aafc862b3b22464f0d6 | refs/heads/master | 2020-03-12T07:33:24.783349 | 2018-04-21T21:09:33 | 2018-04-21T21:09:33 | 130,508,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package isolette;
import java.io.FileNotFoundException;
enum status{
VALID, INVALID;
}
public class TemperatureSensor {
private int currentTemp;
private status state;
Air air = new Air();
public TemperatureSensor() {
currentTemp = 0;
state = status.VALID;
}
public int getCurrentTemp(int infantTemp, HeatSource heatSource) throws FileNotFoundException {
currentTemp = (int)Math.round(air.getAirTemp(infantTemp, heatSource));
return currentTemp;
}
public status getState() {
return state;
}
public void setState(status state) {
this.state = state;
}
public void setCurrentTemp(int currentTemp) {
this.currentTemp = currentTemp;
}
@Override
public String toString() {
return "TemperatureSensor [currentTemp=" + currentTemp + ", state=" + state + ", air=" + air + "]";
}
}
| [
"mr.akshay.m.s@gmail.com"
] | mr.akshay.m.s@gmail.com |
99d1479de36839fb1707bd01e6f783c374d0bee4 | 97a9cd83a101ee022d8d9252c1b6611c02d13b41 | /Hello/src/ghataure/AboutMe.java | 01c6f806586bc944cac39cb80551c83909fee25e | [] | no_license | NavtejG/ICS3U | bcde8f541467b65a34b60fe8ddb7a82b04b17d9a | c1064e5a1025cc9398b6059717a12041ba553be8 | refs/heads/master | 2020-07-22T22:41:59.401112 | 2017-01-24T18:34:04 | 2017-01-24T18:34:04 | 67,817,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,678 | java | /**
*
*/
package ghataure;
/**
* ICS3U
* AboutMe.java
<<<<<<< HEAD
* Shows informations about Navtej
=======
* Shows informations about navtej
>>>>>>> branch 'master' of https://github.com/NavtejG/ICS3U.git
*13/09/2016
*Navtej Ghataure
*/
public class AboutMe {
/**
* @param args
*/
public static void main(String[] args) {
System.out.print("Navtej.G\n");
System.out.print("Miss.Kemp\n");
System.out.print("Runnymede Collegiate Institute\n");
System.out.print("\"Go Ravens!\"\n\n");
System.out.format("%-10s%1s%15s","Period","Day 1","Day 2\n");
System.out.format("%-10s%5s%15s","1","SPH3U1-01","SPH3U1-01\n");
System.out.format("%-10s%5S%15s","08:45","Enns,M","Enns,M\n");
System.out.format("%-10s%5s%15s","10:02","226","226\n\n");
System.out.format("%-10s%8s%15s","2","BAF3M/-02","BAF3M-02\n");
System.out.format("%-10s%5S%15s","10:07","ZZteacher,H","ZZteacher,H\n");
System.out.format("%-10s%5s%15s","11:24","220","220\n\n");
System.out.format("%-10s%8s","Lunch","Lunch\n");
System.out.format("%-10s%8S","11:24","11:24\n");
System.out.format("%-10s%8s","12:26","12:26\n\n");
System.out.format("%-10s%8s%15s","3","ICS3U/3U1-01","ICS3U/3U1-01\n");
System.out.format("%-10s%5S%15s","12:26","Kemp.C","Kemp.C\n");
System.out.format("%-10s%5s%15s","13:43","024","024\n\n");
System.out.format("%-10s%8s%15s","4","AWK2/301-01","AWK2/301-01\n");
System.out.format("%-10s%5S%15s","13:48","Lambert,A","Lambert,A\n");
System.out.format("%-10s%5s%15s","15:05","227","227\n\n");
}
}
| [
"323878314@C-H6304V1.tdsb.on.ca"
] | 323878314@C-H6304V1.tdsb.on.ca |
9711823e5293a6a711556ed31a100ae4751b2ce7 | 17f20e60a096105dd98041153d2d11a524ade79b | /src/main/java/cn/tedu/mapper/PetShowMapper.java | ad83d5c44714b89a86f58ad3b9ada057140ac377 | [] | no_license | 1357189884/petMetting | 74aeaddbc92c5111ff4752528b215b93ecd1f190 | a7a9c3d2e8fddc03fa5d7460cceb6cb5bc0046b7 | refs/heads/master | 2021-08-22T03:47:24.545373 | 2017-11-29T05:50:52 | 2017-11-29T05:50:52 | 112,421,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package cn.tedu.mapper;
import java.util.List;
import cn.tedu.pojo.PetShow;
public interface PetShowMapper {
public List<PetShow> findAll();
public PetShow findById(String id);
public void insert(PetShow petShow);
}
| [
"chongwu@302.com"
] | chongwu@302.com |
27d75a85087179cb4068845c57829f71ef0cef38 | b66bdee811ed0eaea0b221fea851f59dd41e66ec | /src/com/grubhub/AppBaseLibrary/android/dataServices/a/b/g.java | 57349328604768a81a4342a3912d754e1b835a44 | [] | no_license | reverseengineeringer/com.grubhub.android | 3006a82613df5f0183e28c5e599ae5119f99d8da | 5f035a4c036c9793483d0f2350aec2997989f0bb | refs/heads/master | 2021-01-10T05:08:31.437366 | 2016-03-19T20:41:23 | 2016-03-19T20:41:23 | 54,286,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,061 | java | package com.grubhub.AppBaseLibrary.android.dataServices.a.b;
import android.content.Context;
import com.grubhub.AppBaseLibrary.android.dataServices.a.i;
import com.grubhub.AppBaseLibrary.android.dataServices.b.b;
import com.grubhub.AppBaseLibrary.android.dataServices.interfaces.GHSICartDataModel;
import com.grubhub.AppBaseLibrary.android.dataServices.net.a;
public class g
extends d
{
private String b;
private String c;
public g(Context paramContext, String paramString1, String paramString2, i parami1, i parami2)
{
super(paramContext, parami1, parami2);
b = paramString1;
c = paramString2;
}
public void a()
{
super.a();
b().c(b, c, this, this, f());
}
public void a(GHSICartDataModel paramGHSICartDataModel)
{
if (paramGHSICartDataModel != null) {
c().a(paramGHSICartDataModel);
}
super.onResponse(paramGHSICartDataModel);
}
}
/* Location:
* Qualified Name: com.grubhub.AppBaseLibrary.android.dataServices.a.b.g
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
e12af4af85d9be5bf4be6481404f238a343c9b17 | d0536669bb37019e766766461032003ad045665b | /jdk1.4.2_src/org/apache/xalan/lib/sql/QueryParameter.java | 8046fc6835814a65df09bb1d14cbe8895c323be2 | [] | no_license | eagle518/jdk-source-code | c0d60f0762bce0221c7eeb1654aa1a53a3877313 | 91b771140de051fb843af246ab826dd6ff688fe3 | refs/heads/master | 2021-01-18T19:51:07.988541 | 2010-09-09T06:36:02 | 2010-09-09T06:36:02 | 38,047,470 | 11 | 23 | null | null | null | null | UTF-8 | Java | false | false | 3,470 | java | /*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, Lotus
* Development Corporation., http://www.lotus.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xalan.lib.sql;
/**
* Title: <p>
* Description: <p>
* Copyright: Copyright (c) <p>
* Company: <p>
* @author
* @version 1.0
*/
public class QueryParameter
{
/**
*/
private String value;
/**
*/
private String type;
/**
* @param v
* @param t
*/
public QueryParameter( String v, String t )
{
value = v;
type = t;
}
/**
* @return
*/
public String getValue( ) {
return value;
}
/**
* @param newValue
* @return
*/
public void setValue( String newValue ) {
value = newValue;
}
/**
* @param newType
* @return
*/
public void setType( String newType ) {
type = newType;
}
/**
* @return
*/
public String getType( ) {
return type;
}
} | [
"kzhaicn@e8197d6f-d431-fb3f-3203-916d138821fd"
] | kzhaicn@e8197d6f-d431-fb3f-3203-916d138821fd |
7845ecf706a2438ace7699f4d12e7811f38b9600 | f5b8434561aecee9f9c7f4f5c40ad1170fbf0391 | /src/main/java/edu/wzm/creation/factory_method/template/Operator.java | 49aeb11bad5e3d78a8e3754b628d0bcb5f5d2882 | [
"MIT"
] | permissive | GatsbyNewton/design-pattern | af97d75d136468f4d4be6fc88bf07eeb8f398d24 | 4437c4f87c7b372fd7d91d43c72092c3775d3021 | refs/heads/master | 2020-03-27T20:35:35.342153 | 2018-11-15T15:52:46 | 2018-11-15T15:52:46 | 147,079,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package edu.wzm.creation.factory_method.template;
public abstract class Operator {
protected int numA;
protected int numB;
public void setNumA(int numA) {
this.numA = numA;
}
public void setNumB(int numB) {
this.numB = numB;
}
public abstract int getResult();
}
| [
"wangzmking@163.com"
] | wangzmking@163.com |
ffe0b9083f2d6892e29e7ee2570726e45c144cf7 | 5ca5ded55c089f5680905c0e22d8ced52b3e255a | /java001Base/src/com/test/Scanner1.java | e4d5d4d7e519744c6b9db48c132b8a911dbb027a | [] | no_license | wangkeshuai-git/eclipsegit | db828d99446c4436317234f3339508f5dc672d2a | da8f4239fb2035916554dee20b5cbfd260b6508c | refs/heads/master | 2020-09-09T14:04:37.508943 | 2019-11-14T11:22:24 | 2019-11-14T11:22:24 | 221,466,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package com.test;
import java.util.Scanner;
public class Scanner1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入名字:");
String name = scanner.nextLine();
System.out.println("请输入你的爱好:");
String favor = scanner.nextLine();
System.out.println("请输入你的年龄:");
int age = scanner.nextInt();
System.out.println("###############");
System.out.println(name);
System.out.println(favor);
System.out.println("来到地球的天数:"+age*365);
System.out.println("离开地球的天数:"+(72-age)*365);
}
}
| [
"1098847134@qq.com"
] | 1098847134@qq.com |
99ceb7d9a5c63e1300a78d3494f60a8e7cf9cbff | 32fbf83aac908f21df0cd0c23bc6b1dfb26848fd | /src/main/java/com/xworkz/commonmodule/repository/Endgame21v02RepoImpl.java | 84666f74a62e7f30f9e3ee424251613b15f0f149 | [] | no_license | soubhagya333/spring_module | 3ea5a1507129e009d481954d5456db0d891f1843 | 73773445844eb3a720056218f30bb9d0a6dc019b | refs/heads/main | 2023-05-03T08:09:17.443701 | 2021-05-25T09:16:46 | 2021-05-25T09:16:46 | 368,943,340 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package com.xworkz.commonmodule.repository;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.xworkz.commonmodule.entity.Endgame21v02Entity;
@Repository
public class Endgame21v02RepoImpl implements Endgame21v02Repo {
private Logger logger;
@Autowired
private SessionFactory bean;
public Endgame21v02RepoImpl() {
logger = Logger.getLogger(getClass());
}
public Integer save(Endgame21v02Entity entity) {
Transaction transaction = null;
Integer affectedRow = 0;
try(Session session = bean.openSession()) {
transaction = session.beginTransaction();
affectedRow = (Integer)session.save(entity);
transaction.commit();
} catch (Exception e) {
transaction.rollback();
logger.error("sorry!!!you have exception in {} " + e.getMessage() , e );
}
return affectedRow;
}
@Override
public Endgame21v02Entity getByEmailId(String emailId) {
Transaction transaction = null;
Session session = null;
Endgame21v02Entity entity = null;
try {
session = bean.openSession();
Query query =session.createNamedQuery("getByEmailId");
query.setParameter("email", emailId );
entity=(Endgame21v02Entity) query.uniqueResult();
} catch (Exception e) {
logger.error("sorry!!!!you have exception in {} " + e.getMessage() , e );
}
finally {
if (session != null) {
session.close();
}
}
return entity;
}
}
| [
"soubhyagya.xworkz@gmail.com"
] | soubhyagya.xworkz@gmail.com |
e8644ed7d38a91f4f6efb9cf448338cbfda69bcf | d42abb04f6a5376cde4c71ee19ba4a1189fe9cde | /Android_Heart_First/Book/app/src/main/java/com/example/book/AdapterRecycel/AdapterRecycler.java | bf7842ceb3c4574729db1742fcd8c55b469bbd21 | [
"Apache-2.0"
] | permissive | 0352972441/Android | 42acfe0374354c0fcad6811d3fca9a1e5d077838 | 93348145f072bd3995251b30e0df2b0832d1eff1 | refs/heads/master | 2023-01-03T17:18:46.371157 | 2020-10-27T15:37:45 | 2020-10-27T15:37:45 | 278,755,577 | 0 | 1 | Apache-2.0 | 2020-10-04T05:50:44 | 2020-07-10T23:57:10 | Java | UTF-8 | Java | false | false | 2,313 | java | package com.example.book.AdapterRecycel;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.book.Data.Book;
import com.example.book.ListenerFragment.Listener;
import com.example.book.R;
import java.util.ArrayList;
public class AdapterRecycler extends RecyclerView.Adapter<AdapterRecycler.ViewHolder> {
private ArrayList<Book> listDataBook;
private Listener listener;
public AdapterRecycler(ArrayList<Book> listDataBook) {
this.listDataBook = listDataBook;
}
public void setListener(Listener listener) {
this.listener = listener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
CardView cardView = (CardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_custom_adapter,parent,false);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
CardView cardView = holder.cardView;
TextView textView = (TextView)cardView.findViewById(R.id.info_text);
ImageView imageView = (ImageView)cardView.findViewById(R.id.info_image);
textView.setText(listDataBook.get(position).getTitle());
imageView.setImageResource(listDataBook.get(position).getImage());
imageView.setContentDescription(Integer.toString(listDataBook.get(position).getTitle()));
cardView.setOnClickListener(new RecyclerView.OnClickListener(){
@Override
public void onClick(View v) {
if(listener != null){
listener.onClick(position);
}
}
});
}
@Override
public int getItemCount() {
return listDataBook.size();
}
static class ViewHolder extends RecyclerView.ViewHolder{
private CardView cardView;
ViewHolder(CardView cardView){
super(cardView);
this.cardView = cardView;
}
}
}
| [
"Nguyenvantoan.info@gmail.com"
] | Nguyenvantoan.info@gmail.com |
e8bf427205f7fbb125db16beea22f2b78d81d602 | 121e688094b56b614b6ad4396cf37804ab2e8781 | /src/main/java/com/example/server/dto/MemberDto.java | 0ee4075ef0abbf74133563e56def86f386e83a83 | [] | no_license | secbullet2359/hackertone | 1208420434bb59fc5bf74d93b0a5077e60d38164 | a6b15cef3769f691caf504ec12cbb840655e1220 | refs/heads/main | 2023-07-22T20:13:51.431171 | 2021-08-18T08:58:53 | 2021-08-18T08:58:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.example.server.dto;
import com.example.server.entity.BankAccount;
import com.example.server.entity.Member;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import java.util.List;
@Data
@Embeddable
@NoArgsConstructor
@AllArgsConstructor
public class MemberDto {
String Id;
String pw;
String name;
String email;
Long invValue;
List<BankAccount> bankAccounts;
private InvestmentPropensity convInvValue(Long invValue){
if(invValue > 7.5){
return InvestmentPropensity.AGGRESSIVE;
}else if(invValue <= 7.5 && invValue > 2.5){
return InvestmentPropensity.NEUTRAL;
}else{
return InvestmentPropensity.STABLE;
}
}
// Dto to Entity Converter
public Member convertToMember(){
return new Member(
this.getId(),
this.getPw(),
this.getName(),
this.getEmail(),
this.convInvValue(this.getInvValue()).getPropensity(),
this.getBankAccounts()
);
}
//Dto to Entity Converter
}
| [
"elice@elice.com"
] | elice@elice.com |
41c17941a4d219f7f1e05dd8f6bf8d03337317c0 | 098960114afdbdf144acf92064e3cc9a77bca040 | /src/main/java/com/github/karlklin/json/JsonPersonParser.java | a38e544e843972f539ae5b16a035f6369e99ada2 | [] | no_license | karlklin/json-learning | 7a092f5937e0ea1ad3cfe89a52e1cfc341ffb990 | dd53d5f5d45b69b154c81741f5beab4f85223884 | refs/heads/master | 2021-08-30T15:17:42.065448 | 2017-12-18T12:21:12 | 2017-12-18T12:21:12 | 114,373,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | package com.github.karlklin.json;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.karlklin.Person;
import java.io.File;
import java.io.IOException;
import java.util.Map;
public class JsonPersonParser {
private ObjectMapper mapper = new ObjectMapper();
public Person toPojo(File simpleJsonFile) {
try {
return mapper.readValue(simpleJsonFile, Person.class);
} catch (JsonParseException e) {
throw new RuntimeException(e);
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public Map<String, Integer> toPojoValue(File jsonFile) {
try {
return mapper.readValue(jsonFile, Map.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String toJson(Person person) {
try {
return mapper.writeValueAsString(person);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
| [
"karol.pawelski@cognifide.com"
] | karol.pawelski@cognifide.com |
ce1e822731cf100fde8269e3e570faaf0c5350db | 97ddb00c5b8204f92499f16ad44a708fdcfbbc51 | /app/src/main/java/com/example/opengles/renderers/Program01Renderer.java | 4e8d0ed474871f4f5f39231ce5cf34b4209fa6cc | [] | no_license | mayohn/OpenGLES | a468fb2ed8b6b5a6f7e85edf7d7141e53e24d687 | 76f27ebe16e9fbca0c9770ab3ab5dc0c5ee717a1 | refs/heads/master | 2021-05-17T23:17:52.322826 | 2021-03-15T14:47:36 | 2021-03-15T14:47:36 | 250,998,045 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.example.opengles.renderers;
import android.content.Context;
public class Program01Renderer extends ParentRenderer {
public Program01Renderer(Context context) {
super(context, Program01Renderer.class.getSimpleName());
}
}
| [
"609637391@qq.com"
] | 609637391@qq.com |
b408fb7a943fbc2b6b80cb3e65a3f6ab70371fac | f666bd02837afd908b29f5c9ae62b2943e633143 | /microservicecloud-provider-dept-8003/src/main/java/com/mason/springcloud/DeptProvider8003_App.java | a5d525e430af580a726b41ee68f6714d9e6531b1 | [] | no_license | guofeiwu/microservicecloud | 08ae5ef4e0dde35a3b479dddc3c9da3edab8c197 | 2b51cb9dc8500bc7a324e879030480f28671cb06 | refs/heads/master | 2020-04-18T21:16:18.007158 | 2019-02-01T09:07:16 | 2019-02-01T09:07:16 | 167,760,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.mason.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class DeptProvider8003_App {
public static void main(String[] args) {
SpringApplication.run(DeptProvider8003_App.class, args);
}
}
| [
"guofei.wu@ucarinc.com"
] | guofei.wu@ucarinc.com |
b66740c56b952cd8fcd285f884c5cd242a903bc7 | 47b9b50ddb788c4f5099ee731844b14615f1d300 | /src/main/java/ztc/doctorREST/DoctorRepository.java | 78b1d635d5b2a5264ea3b44ba6fdc50d0b346b1f | [] | no_license | Tiance-Zhang/doctorREST | 9146fc95e055470e3e99b4ef84b06822cf1962bc | 1cc6e5da50637d78bd4493283033811b70cefcff | refs/heads/master | 2023-02-16T13:52:06.412340 | 2021-01-08T00:34:32 | 2021-01-08T00:34:32 | 327,758,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package ztc.doctorREST;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DoctorRepository extends JpaRepository<Doctor, Integer> {
}
| [
"zhangtiance@gmail.com"
] | zhangtiance@gmail.com |
92abb83372b3f083e9d9f741bdfc461db5e4d420 | 51b8c6ed1804799dc0c394e98ddf8bb690013fa2 | /app/src/main/java/com/deitel/tyty/Train.java | 703e1fc5ead5862418a9fce5cb81432fcc170752 | [] | no_license | Artxxxman/TyTy | be2d37b52eb201293f248adbaa022a39ca2db8cb | ffe0483254d2606d741b92c34fdb96470d8b775e | refs/heads/master | 2021-01-13T07:52:22.662466 | 2016-10-23T17:02:27 | 2016-10-23T17:02:27 | 71,715,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,298 | java | package com.deitel.tyty;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.View;
import android.content.Intent;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.util.Calendar;
public class Train extends Activity implements View.OnClickListener{
TextView tvDP,tvAR,tvDate;
private int mYear, mMonth, mDay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.train);
tvAR = (TextView) findViewById(R.id.tvAR);
tvAR.setOnClickListener(this);
tvDP = (TextView) findViewById(R.id.tvDep);
tvDP.setOnClickListener(this);
tvDate = (TextView) findViewById(R.id.tvDate);
tvDate.setOnClickListener(this);
}
@Override
public void onClick(View v){
//прописываем реакцию на нажатие для каждого TextView
switch (v.getId()){
case R.id.tvDep :
if(isNetworkAvailable()) {
Intent intentDep = new Intent(this,Station.class );
intentDep.putExtra("inputDate", "Dep");
startActivityForResult(intentDep,1);}
else {Toast toast = Toast.makeText(getApplicationContext(),
"Подключение к интернету отсутствует", Toast.LENGTH_SHORT);
toast.show();}
break;
case R.id.tvAR :
if(isNetworkAvailable()) {
Intent intentAr = new Intent(this,Station.class );
intentAr.putExtra("inputDate", "Arr");
startActivityForResult(intentAr,1);}
else {Toast toast = Toast.makeText(getApplicationContext(),
"Подключение к интернету отсутствует", Toast.LENGTH_SHORT);
toast.show();}
break;
case R.id.tvDate :
callDatePicker();
default:
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data == null){
return;
}
//получем значения
String station = data.getStringExtra("station");
String mark = data.getStringExtra("inputDate");
//определяем в какой TextView вставить полученные значения
if(mark.equals("Arr")) tvAR.setText(station);
else tvDP.setText(station);
}
private void callDatePicker() {
// получаем текущую дату
final Calendar cal = Calendar.getInstance();
mYear = cal.get(Calendar.YEAR);
mMonth = cal.get(Calendar.MONTH);
mDay = cal.get(Calendar.DAY_OF_MONTH);
// инициализируем диалог выбора даты текущими значениями
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
String editTextDateParam = dayOfMonth + "." + (monthOfYear + 1) + "." + year;
tvDate.setText(editTextDateParam);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
}
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
}
| [
"artxxxmn@gmail.com"
] | artxxxmn@gmail.com |
341aeb936d11b7bd68b760455e4695974ec381bf | 4199d268eb13c68f8c895154d8fdff272e699ad0 | /23_buscador_cursos_spring_sin_webxml/src/com/formacion/controller/CursosController.java | 4c7d8ea413cd7a0126c83db2aba4417a7db2d493 | [] | no_license | japc78/udemy-javaEE-servlet-jpa-examples | de48cdf616ebed0f6ebc2d82fca9c68af135329f | 7a88d07ea46f22a5ea9a0d77bab82463bcc56c46 | refs/heads/main | 2023-07-27T20:50:49.967413 | 2021-09-01T22:05:42 | 2021-09-01T22:05:42 | 402,214,699 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,276 | java | package com.formacion.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.formacion.model.Curso;
import com.formacion.service.CursosService;
@Controller
public class CursosController {
//inyecta una instancia del servicio
@Autowired
CursosService service;
List<Curso> cursos;
public CursosController() {
cursos=new ArrayList<>();
cursos.add(new Curso("Java","Programación",50));
cursos.add(new Curso("Angular","Programación",30));
cursos.add(new Curso("Linux","Sistemas",40));
cursos.add(new Curso("Big Data","Datos",30));
cursos.add(new Curso("SQL","Datos",20));
}
@PostMapping(value="buscar")
public String buscador(@RequestParam("tema") String tema,
HttpServletRequest request) {
List<Curso> encontrados=service.buscarCursosTema(tema);
//guarda en un atributo de petición
//la lista de cursos encontrados del tema
request.setAttribute("cursos", encontrados);
return "cursos";
}
}
| [
"japc.grafico@gmail.com"
] | japc.grafico@gmail.com |
3b910292aa7f3a5c0a7bc9fb26cec8ce56e6ed30 | ca030864a3a1c24be6b9d1802c2353da4ca0d441 | /classes6.dex_source_from_JADX/com/facebook/photos/data/method/CreatePagePhotoAlbumParams.java | f6268566feeed1d75e78a6afecb097d75d087601 | [] | no_license | pxson001/facebook-app | 87aa51e29195eeaae69adeb30219547f83a5b7b1 | 640630f078980f9818049625ebc42569c67c69f7 | refs/heads/master | 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | package com.facebook.photos.data.method;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
/* compiled from: image_cache_size_bytes */
public class CreatePagePhotoAlbumParams implements Parcelable {
public static final Creator<CreatePagePhotoAlbumParams> CREATOR = new C08241();
public final long f12892a;
public final String f12893b;
public final String f12894c;
public final String f12895d;
/* compiled from: image_cache_size_bytes */
final class C08241 implements Creator<CreatePagePhotoAlbumParams> {
C08241() {
}
public final Object createFromParcel(Parcel parcel) {
return new CreatePagePhotoAlbumParams(parcel);
}
public final Object[] newArray(int i) {
return new CreatePagePhotoAlbumParams[i];
}
}
public CreatePagePhotoAlbumParams(long j, String str, @Nullable String str2, @Nullable String str3) {
Preconditions.checkNotNull(str);
this.f12892a = j;
this.f12893b = str;
this.f12894c = str2;
this.f12895d = str3;
}
public CreatePagePhotoAlbumParams(Parcel parcel) {
this.f12892a = parcel.readLong();
this.f12893b = parcel.readString();
this.f12894c = parcel.readString();
this.f12895d = parcel.readString();
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel parcel, int i) {
parcel.writeLong(this.f12892a);
parcel.writeString(this.f12893b);
parcel.writeString(this.f12894c);
parcel.writeString(this.f12895d);
}
}
| [
"son.pham@jmango360.com"
] | son.pham@jmango360.com |
5dcaa9011c465b0605af9ac527dffe3eac2150c8 | d86b00bf9aa2fa134a31c0d21bf2ab86588d0775 | /sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java | b914b31d5fa583679dba6acb14caf67193c33d2b | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | onap/ccsdk-features | 2075ee7c48742f93a288139b787b44bda4e22a18 | 25d7a57c8f243fd2e4b7c89596188c6fd2e90e17 | refs/heads/master | 2023-08-30T21:21:47.591918 | 2023-08-17T13:03:32 | 2023-08-17T13:03:43 | 156,634,457 | 0 | 5 | NOASSERTION | 2021-06-29T18:23:29 | 2018-11-08T01:49:35 | Java | UTF-8 | Java | false | false | 6,460 | java | /*
* ============LICENSE_START=======================================================
* ONAP : ccsdk features
* ================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
* 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.
* ============LICENSE_END=========================================================
*
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm71.impl;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.ChangeNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.CreateTechInfoNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OtdrScanResult;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.Edit;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Shabnam Sultana
*
* Listener for Open roadm device specific change notifications
**/
public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDeviceListener {
// variables
private static final Logger log = LoggerFactory.getLogger(OpenroadmDeviceChangeNotificationListener.class);
private Integer counter = 1;
private final NetconfAccessor netconfAccessor;
private final DataProvider databaseProvider;
private final WebsocketManagerService notificationServiceService;
private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter();
// end of variables
// constructors
public OpenroadmDeviceChangeNotificationListener(NetconfAccessor netconfAccessor, DataProvider databaseService,
WebsocketManagerService faultService) {
this.netconfAccessor = netconfAccessor;
this.databaseProvider = databaseService;
this.notificationServiceService = faultService;
}
// end of constructors
// public methods
@Override
public void onOtdrScanResult(OtdrScanResult notification) {
// TODO Auto-generated method stub
}
@Override
public void onChangeNotification(ChangeNotification notification) {
log.debug("onDeviceConfigChange(1){}", notification);
StringBuffer sb = new StringBuffer();
@NonNull
List<Edit> editList = notification.nonnullEdit();
for (Edit edit : editList) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(edit);
EventlogBuilder eventlogBuilder = new EventlogBuilder();
InstanceIdentifier<?> target = edit.getTarget();
if (target != null) {
eventlogBuilder.setObjectId(target.getPathArguments().toString());
log.debug("TARGET: {} {}", target.getClass(), target.getTargetType());
for (PathArgument pa : target.getPathArguments()) {
log.debug("PathArgument {}", pa);
}
eventlogBuilder.setAttributeName(target.getTargetType().getName());
}
eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue());
eventlogBuilder.setNewValue(String.valueOf(edit.getOperation()));
eventlogBuilder.setTimestamp(notification.getChangeTime());
eventlogBuilder.setCounter(counter);
eventlogBuilder.setSourceType(SourceType.Netconf);
databaseProvider.writeEventLog(eventlogBuilder.build());
log.debug("onDeviceConfigChange (2) {}", sb);
counter++;
}
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
ChangeNotification.QNAME, notification.getChangeTime());
}
@Override
public void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
DateAndTime now = NetconfTimeStampImpl.getConverter().getTimeStamp();
log.debug("onCreateTechInfoNotification(1){}", notification);
EventlogBuilder eventlogBuilder = new EventlogBuilder();
eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId())
.setObjectId(notification.getShelfId()).setNodeId(this.netconfAccessor.getNodeId().getValue())
.setCounter(counter).setNewValue(notification.getStatus().getName()).setSourceType(SourceType.Netconf)
.setTimestamp(now);
databaseProvider.writeEventLog(eventlogBuilder.build());
this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(),
CreateTechInfoNotification.QNAME, now);
log.debug("Create-techInfo Notification written ");
counter++;
}
// end of public methods
}
| [
"ravi.pendurty@highstreet-technologies.com"
] | ravi.pendurty@highstreet-technologies.com |
cf0cff8f51a678078ad2cc258819a1523ba52de5 | 3e3dc4ab5fea50a676c54d60f1e4cb35105b6d9e | /intermediate/stored-procedures-derby/src/main/java/org/springframework/integration/Main.java | e206d8570309f58b85118bba2e8d836638f13293 | [] | no_license | dsyer/spring-integration-samples | 3ae832f9bec71e2313e0b6cdb2420b80a2f29fd5 | b6b7a14fbaa5cb8adea2d17b8f8f8f6fab334c01 | refs/heads/master | 2023-08-28T16:31:54.960703 | 2012-02-16T16:31:26 | 2012-02-16T16:31:26 | 2,295,156 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,755 | java | /*
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration;
import java.util.List;
import java.util.Scanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.model.CoffeeBeverage;
import org.springframework.integration.service.CoffeeService;
/**
* Starts the Spring Context and will initialize the Spring Integration routes.
*
* @author Gunnar Hillert
* @since 2.1
*
*/
public final class Main {
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
private static final String LINE = "\n=========================================================";
private static final String NEWLINE = "\n ";
private Main() { }
/**
* Load the Spring Integration Application Context
*
* @param args - command line arguments
*/
public static void main(final String... args) {
LOGGER.info(LINE
+ LINE
+ "\n Welcome to Spring Integration Coffee Database! "
+ NEWLINE
+ "\n For more information please visit: "
+ "\n http://www.springsource.org/spring-integration "
+ NEWLINE
+ LINE );
final AbstractApplicationContext context =
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml");
context.registerShutdownHook();
final Scanner scanner = new Scanner(System.in);
final CoffeeService service = context.getBean(CoffeeService.class);
LOGGER.info(LINE
+ NEWLINE
+ "\n Please press 'q + Enter' to quit the application. "
+ NEWLINE
+ LINE);
System.out.print("Please enter 'list' and press <enter> to get a list of coffees.");
System.out.print("Enter a coffee id, e.g. '1' and press <enter> to get a description.\n\n");
while (!scanner.hasNext("q")) {
String input = scanner.nextLine();
if ("list".equalsIgnoreCase(input)) {
List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();
for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
coffeeBeverage.getName()));
}
} else {
System.out.println("Retrieving coffee information...");
String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));
System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
System.out.print("To try again, please enter another coffee beaverage and press <enter>:\n\n");
}
}
LOGGER.info("Exiting application...bye.");
System.exit(0);
}
}
| [
"ghillert@vmware.com"
] | ghillert@vmware.com |
ac63acdb7eb9747eec846468aaf42f082cf10b72 | 3385445ac830d258de2884b870d1341996d264cd | /mdsplus/javatraverser/RFXPVSetupSetup.java | 790d6a23e61f8fb2310607ea1d0af553d812a05c | [] | no_license | petermilne/mdsshell | a2824ea363d14b5629fa31aa14d24076215b5375 | 888a5c8ac61f932aee3630890131227d92bf37f8 | refs/heads/master | 2023-05-11T14:35:30.767863 | 2023-04-04T09:28:19 | 2023-04-04T09:28:19 | 51,762,958 | 0 | 1 | null | 2019-02-20T08:54:06 | 2016-02-15T14:59:59 | C | UTF-8 | Java | false | false | 6,020 | java |
import java.awt.*;
import javax.swing.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class RFXPVSetupSetup extends DeviceSetup {
BorderLayout borderLayout1 = new BorderLayout();
DeviceButtons deviceButtons1 = new DeviceButtons();
JPanel jPanel1 = new JPanel();
JTabbedPane jTabbedPane1 = new JTabbedPane();
GridLayout gridLayout1 = new GridLayout();
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
DeviceField deviceField1 = new DeviceField();
DeviceField deviceField2 = new DeviceField();
DeviceField deviceField3 = new DeviceField();
DeviceField deviceField5 = new DeviceField();
JPanel jPanel5 = new JPanel();
JPanel jPanel6 = new JPanel();
JPanel jPanel7 = new JPanel();
JPanel jPanel8 = new JPanel();
JPanel jPanel9 = new JPanel();
JPanel jPanel10 = new JPanel();
JPanel jPanel11 = new JPanel();
JPanel jPanel12 = new JPanel();
DeviceWave deviceWave1 = new DeviceWave();
BorderLayout borderLayout2 = new BorderLayout();
BorderLayout borderLayout3 = new BorderLayout();
DeviceWave deviceWave2 = new DeviceWave();
BorderLayout borderLayout4 = new BorderLayout();
DeviceWave deviceWave3 = new DeviceWave();
BorderLayout borderLayout5 = new BorderLayout();
DeviceWave deviceWave4 = new DeviceWave();
BorderLayout borderLayout6 = new BorderLayout();
DeviceWave deviceWave5 = new DeviceWave();
BorderLayout borderLayout7 = new BorderLayout();
DeviceWave deviceWave6 = new DeviceWave();
BorderLayout borderLayout8 = new BorderLayout();
DeviceWave deviceWave7 = new DeviceWave();
BorderLayout borderLayout9 = new BorderLayout();
DeviceWave deviceWave8 = new DeviceWave();
DeviceChoice deviceChoice1 = new DeviceChoice();
public RFXPVSetupSetup() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setWidth(568);
this.setHeight(568);
this.setDeviceType("RFXPVSetup");
this.setDeviceProvider("localhost");
this.setDeviceTitle("RFX PV Setup");
this.getContentPane().setLayout(borderLayout1);
jPanel1.setLayout(gridLayout1);
gridLayout1.setColumns(1);
gridLayout1.setRows(3);
deviceField1.setOffsetNid(1);
deviceField1.setTextOnly(true);
deviceField1.setLabelString("Comment:");
deviceField1.setNumCols(30);
deviceField1.setIdentifier("");
deviceField2.setOffsetNid(4);
deviceField2.setLabelString("Window: ");
deviceField2.setNumCols(4);
deviceField2.setIdentifier("");
deviceField2.setEditable(false);
deviceField2.setDisplayEvaluated(true);
deviceField3.setOffsetNid(5);
deviceField3.setTextOnly(true);
deviceField3.setLabelString("Enabled Units: ");
deviceField3.setNumCols(20);
deviceField3.setIdentifier("");
deviceField3.setEditable(false);
deviceField3.setDisplayEvaluated(true);
deviceField5.setOffsetNid(2);
deviceField5.setTextOnly(true);
deviceField5.setLabelString("Connection: ");
deviceField5.setNumCols(8);
deviceField5.setIdentifier("");
deviceField5.setEditable(false);
deviceField5.setDisplayEvaluated(true);
deviceWave1.setOffsetNid(8);
deviceWave1.setIdentifier("");
deviceWave1.setUpdateExpression("");
jPanel5.setLayout(borderLayout2);
jPanel6.setLayout(borderLayout3);
deviceWave2.setOffsetNid(14);
deviceWave2.setIdentifier("");
deviceWave2.setUpdateExpression("");
jPanel7.setLayout(borderLayout4);
deviceWave3.setOffsetNid(20);
deviceWave3.setIdentifier("");
deviceWave3.setUpdateExpression("");
jPanel8.setLayout(borderLayout5);
deviceWave4.setOffsetNid(26);
deviceWave4.setIdentifier("");
deviceWave4.setUpdateExpression("");
jPanel9.setLayout(borderLayout6);
deviceWave5.setOffsetNid(32);
deviceWave5.setIdentifier("");
deviceWave5.setUpdateExpression("");
jPanel10.setLayout(borderLayout7);
deviceWave6.setOffsetNid(38);
deviceWave6.setIdentifier("");
deviceWave6.setUpdateExpression("");
jPanel11.setLayout(borderLayout8);
deviceWave7.setOffsetNid(44);
deviceWave7.setIdentifier("");
deviceWave7.setUpdateExpression("");
jPanel12.setLayout(borderLayout9);
deviceWave8.setOffsetNid(50);
deviceWave8.setIdentifier("");
deviceWave8.setUpdateExpression("");
deviceChoice1.setChoiceIntValues(null);
deviceChoice1.setChoiceFloatValues(null);
deviceChoice1.setOffsetNid(3);
deviceChoice1.setLabelString("Control:");
deviceChoice1.setChoiceItems(new String[] {"CURRENT", "VOLTAGE", "OPEN LOOP"});
deviceChoice1.setUpdateIdentifier("");
deviceChoice1.setIdentifier("");
this.getContentPane().add(deviceButtons1, BorderLayout.SOUTH);
this.getContentPane().add(jPanel1, BorderLayout.NORTH);
jPanel1.add(jPanel2, null);
jPanel2.add(deviceField1, null);
jPanel1.add(jPanel4, null);
jPanel4.add(deviceField3, null);
jPanel4.add(deviceField2, null);
jPanel1.add(jPanel3, null);
jPanel3.add(deviceField5, null);
jPanel3.add(deviceChoice1, null);
this.getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
jTabbedPane1.add(jPanel5, "1");
jPanel5.add(deviceWave1, BorderLayout.CENTER);
jTabbedPane1.add(jPanel6, "2");
jPanel6.add(deviceWave2, BorderLayout.CENTER);
jTabbedPane1.add(jPanel7, "3");
jPanel7.add(deviceWave3, BorderLayout.CENTER);
jTabbedPane1.add(jPanel8, "4");
jPanel8.add(deviceWave4, BorderLayout.CENTER);
jTabbedPane1.add(jPanel9, "5");
jPanel9.add(deviceWave5, BorderLayout.CENTER);
jTabbedPane1.add(jPanel10, "6");
jPanel10.add(deviceWave6, BorderLayout.CENTER);
jTabbedPane1.add(jPanel11, "7");
jPanel11.add(deviceWave7, BorderLayout.CENTER);
jTabbedPane1.add(jPanel12, "8");
jPanel12.add(deviceWave8, BorderLayout.CENTER);
}
} | [
"peter.milne@d-tacq.com"
] | peter.milne@d-tacq.com |
15e745e81aadc539dd1ad08bf632fc317c8ba6f8 | 738aa986ed9e1c3953870019448987637e352ac0 | /app/src/androidTest/java/com/devbaltasarq/burguerbuildercomplexlistview/ExampleInstrumentedTest.java | 98c2050a3b76ef7d9492bce2ed9704cf84a67129 | [
"MIT"
] | permissive | Baltasarq/BurguerBuilderComplexListView | 632cd3ab48adc6d7b3576676ecb9c89663781806 | 31b225894b1f0a275514b256f3c7afec19f875f0 | refs/heads/master | 2021-07-09T13:39:20.402466 | 2017-10-10T10:23:06 | 2017-10-10T10:23:06 | 105,996,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.devbaltasarq.burguerbuildercomplexlistview;
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.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.devbaltasarq.burguerbuildercomplexlistview", appContext.getPackageName());
}
}
| [
"baltasarq@gmail.com"
] | baltasarq@gmail.com |
d99d0369c797bdc4b7571232d3cfeb8622f43610 | a5cf9067f926dbad032e5e1e68575bb3abf3295a | /src/main/java/com/hmarianno/course/domain/User.java | 2f97bc0336e8442230162b8f07d5cbbdaedb91e5 | [] | no_license | hmarianno/course-spring-boot-mongodb | 3788a28b317de3a5de2e678299d0ef9945ecb513 | c6e9c854981e252a815cb4d9f52e65f0db38ce02 | refs/heads/master | 2023-05-04T14:40:55.072997 | 2021-05-27T15:17:54 | 2021-05-27T15:17:54 | 369,009,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,786 | java | package com.hmarianno.course.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection="user") // se deixar apenas "@Document" o spring
// mapeia automaticamente a coleção, não é
// obrigatório informar (collection="user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
private String name;
private String email;
@DBRef(lazy = true)
private List<Post> posts = new ArrayList<>();
public User() {}
public User(String id, String name, String email) {
super();
this.id = id;
this.name = name;
this.email = email;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public List<Post> getPosts() {
return posts;
}
public void setPosts(List<Post> posts) {
this.posts = posts;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"hmarianno@gmail.com"
] | hmarianno@gmail.com |
a4503df7654b34c8a66fe40753e121708f0ecc90 | 6a0c1a3bc631954402480fe67067e61e3a62f7b1 | /src/com/kotenkov/programming_with_class/the_simplest_class_and_object/task_9/MainTask9.java | e9d30ffb4daa4dc327facb6d21a0f020c3944677 | [] | no_license | babushkaj/epamtraining | f0da4f8f5a05353f884b4dfadd5a0dfa2a259940 | 8ad3233ce09b60aa8e959d5ec94ce04608adcbbd | refs/heads/master | 2020-07-07T00:12:52.593672 | 2019-08-19T15:04:35 | 2019-08-19T15:04:35 | 193,384,005 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,447 | java | package com.kotenkov.programming_with_class.the_simplest_class_and_object.task_9;
// Создать класс Book, спецификация которого приведена ниже. Определить конструкторы, set- и get- методы и
// метод toString(). Создать второй класс, агрегирующий массив типа Book, с подходящими конструкторами и
// методами. Задать критерии выбора данных и вывести эти данные на консоль.
// Book: id, название, автор(ы), издательство, год издания, количество страниц, цена, тип переплета.
// Найти и вывести:
// a) список книг заданного автора;
// b) список книг, выпущенных заданным издательством;
// c) список книг, выпущенных после заданного года.
import com.kotenkov.programming_with_class.the_simplest_class_and_object.task_9.additional_class.Author;
import com.kotenkov.programming_with_class.the_simplest_class_and_object.task_9.additional_class.BookBinding;
import java.util.List;
public class MainTask9 {
public static void main(String[] args) {
Author author1 = new Author("Льюис", "Кэрролл");
Book book1 = new Book(1, "Алиса в Стране Чудес", author1, "Детская литература",
1988, 144, 8, BookBinding.SOFTCOVER);
Author author2 = new Author("Джоан", "Роулинг");
Book book2 = new Book(2, "Гарри Поттер и Философский камень", author2, "Росмэн",
2000, 400, 15, BookBinding.HARDCOVER);
Author author3 = new Author("Стивен", "Кинг");
Book book3 = new Book(3, "Оно", author3, "АСТ",
2016, 1245, 13, BookBinding.HARDCOVER);
Author author4 = new Author("Джеймс", "Чейз");
Book book4 = new Book(4, "Перстень Борджиа", author4, "Иностранка",
2018, 544, 12, BookBinding.HARDCOVER);
Author author5 = new Author("Элис", "Сиболд");
Book book5 = new Book(5, "Милые кости", author5, "Like book",
2017, 384, 10, BookBinding.HARDCOVER);
Book [] books = {book1, book2, book3, book4, book5};
int num = 5;
System.out.println("\nСоздаем Library на " + num + "книг...\n");
Library lib = new Library(5, books);
System.out.println("Книги автора " + author1);
List<Book> list = lib.getBooksByAuthor(author1);
for (Book b:list) {
System.out.println(b);
}
String publishingHouse = "Росмэн";
System.out.println("\nКниги издательства " + publishingHouse);
list = lib.getBooksByPublishingHouse(publishingHouse);
for (Book b:list) {
System.out.println(b);
}
int year = 2005;
System.out.println("\nКниги, выпущенные после " + year + " года");
list = lib.getBooksAfterYearOfPublishing(year);
for (Book b:list) {
System.out.println(b);
}
}
}
| [
"alexykotenkov@gmail.com"
] | alexykotenkov@gmail.com |
7df2a1fef8e4d3bc9d2530bb0a329e11d8d8c232 | 360c9535156e67834cbf6e988b80df11f6c26b61 | /heyu/heyu-item/heyu-item-interface/src/main/java/com/heyu/item/api/SpecificationApi.java | 33bd2a2e5d2c1e2d084fcb42f37d9f1ad3475cec | [] | no_license | 73nuts/spring-boot | b93c7313c746c410051a7d03d38d69437c1e3a4f | 201dd667e610ee3e12fcc6dde36e525c873dc01f | refs/heads/master | 2022-12-03T03:07:14.043175 | 2020-08-20T04:33:59 | 2020-08-20T04:33:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.heyu.item.api;
import com.heyu.item.pojo.SpecGroup;
import com.heyu.item.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/*
参数规格实现类
*/
@RequestMapping("spec")
public interface SpecificationApi {
//根据条件查询规格参数
@GetMapping("params")
public List<SpecParam> queryParams(
@RequestParam(value = "gid", required = false) Long gid,
@RequestParam(value = "cid", required = false) Long cid,
@RequestParam(value = "generic", required = false) Boolean generic,
@RequestParam(value = "searching", required = false) Boolean searching
);
//根据分类Id查询所有规格参数集合
@GetMapping("group/param/{cid}")
public List<SpecGroup> queryGroupWithParam(@PathVariable("cid") Long cid);
} | [
"2218572042@qq.com"
] | 2218572042@qq.com |
77a143ce0b9ae5fe45ed1ef520c34696a996daf7 | 037c37873da85fb228db99cf5fdddea6b941def5 | /lab4/exc2/src/main/java/exc2/demo/CarManagerService.java | f988df0291244b48bc76c412718f2dbaa4945962 | [] | no_license | alex-pt01/Software-Testing-and-Quality | c49b7101cf253b82d22c2a14cdfc7c445fd1c999 | 94a63c247589bdabd3254af3b54f790720faa9ce | refs/heads/main | 2023-05-01T22:51:33.246752 | 2021-05-23T18:25:10 | 2021-05-23T18:25:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package exc2.demo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
public class CarManagerService {
@Autowired
private CarRepository carRepository;
public List<Car> getAllCars() {
List<Car> cars = carRepository.findAll();
return cars;
}
public Car save(Car car) {
carRepository.save(car);
return car;
}
public Car getCarDetails(Long carID) {
return carRepository.findByCarId(carID);
}
}
| [
"aarodrigues@ua.pt"
] | aarodrigues@ua.pt |
3d91372a1c3e89d86e9897a2f72d4dcd4e3e6e4a | 2687dbd4ef1d2cfd4b0673596e6941245fbe83a9 | /quickfixj-master/quickfixj-core/src/main/java/quickfix/field/ResetEligibleVolumewithinLimitPrice.java | 295530631ac6147a3e378225b639cbf71d740a88 | [
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | chengang9527/tradingSystem | 9a79599f3341a64e8eb3595a59f2982bdd62296f | e8c9d971d81f22a896e0c2e29be413224b60bad7 | refs/heads/master | 2020-05-15T02:20:04.358193 | 2018-02-06T07:55:32 | 2018-02-06T07:55:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | /* Generated Java Source File */
/*******************************************************************************
* Copyright (c) quickfixengine.org All rights reserved.
*
* This file is part of the QuickFIX FIX Engine
*
* This file may be distributed under the terms of the quickfixengine.org
* license as defined by quickfixengine.org and appearing in the file
* LICENSE included in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* See http://www.quickfixengine.org/LICENSE for licensing information.
*
* Contact ask@quickfixengine.org if any conditions of this licensing
* are not clear to you.
******************************************************************************/
package quickfix.field;
import quickfix.IntField;
public class ResetEligibleVolumewithinLimitPrice extends IntField {
static final long serialVersionUID = 20050617;
public static final int FIELD = 3012;
public ResetEligibleVolumewithinLimitPrice() {
super(3012);
}
public ResetEligibleVolumewithinLimitPrice(int data) {
super(3012, data);
}
}
| [
"linsy@corp.sanjincapital.com"
] | linsy@corp.sanjincapital.com |
1c4463a2bc0d50419805966df0728847182a01b5 | 91df0aea3e64d0d06c0e797de8845119d0704377 | /spark-file/spark-file-biz/src/main/java/com/spark/platform/file/biz/config/MybatisPlusMetaHandler.java | 9a7731a22616762ed8ade3516c63772d95e8f41f | [
"Apache-2.0"
] | permissive | javalittleman/spark-platform | 736cf3644ffb2a7c268184b5071490ad1f847e1b | 02b4213d9d2547ae4d8ac7eb5810afa8401b8606 | refs/heads/master | 2023-03-11T17:07:46.434051 | 2021-02-25T14:25:16 | 2021-02-25T14:25:16 | 343,087,956 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | package com.spark.platform.file.biz.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.spark.platform.common.base.constants.GlobalsConstants;
import com.spark.platform.common.security.model.LoginUser;
import com.spark.platform.common.security.util.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* @ProjectName: spark-platform
* @Package: com.spark.platform.file.biz.config
* @ClassName: MybatisPlusMetaHandler
* @Author: wangdingfeng
* @Description: mybatis plus 插入更新监听
* @Date: 2020/11/6 9:45
* @Version: 1.0
*/
@Slf4j
@Component
public class MybatisPlusMetaHandler implements MetaObjectHandler {
/**
* 插入操作
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
//获取当前登录账号
String account = getAccount();
//放入当前操作者信息
this.setFieldValByName("creator",account,metaObject);
this.setFieldValByName("modifier",account,metaObject);
this.setFieldValByName("createDate", LocalDateTime.now(),metaObject);
this.setFieldValByName("modifyDate",LocalDateTime.now(),metaObject);
this.setFieldValByName("delFlag",0,metaObject);
}
/**
* 更新操作
* @param metaObject
*/
@Override
public void updateFill(MetaObject metaObject) {
//获取当前登录账号
String account = getAccount();
this.setFieldValByName("modifier",account,metaObject);
this.setFieldValByName("modifyDate", LocalDateTime.now(),metaObject);
}
/**
* 获取当前登录账号
* @return
*/
private String getAccount(){
LoginUser user = UserUtils.getLoginUser();
if(null == user){
return GlobalsConstants.DEFAULT_USER_SYSTEM;
}
return user.getUsername();
}
}
| [
"wangdingfeng@live.com"
] | wangdingfeng@live.com |
3bde5bbabd8ee90719b3937fe55e407cf5220739 | e6266b70d96ba7784fe09724381ed8ab4e0fef04 | /src/search/binarysearch/BinarySearchApi.java | d2d9ad4a3380339e1934418e0c984dd846cdcd5b | [] | no_license | JungHyunLyoo/Algorithm | 62ebd438a723f43a4f988e8dd5da6dcc125b4ed9 | 54f5daf9d8cecd8c29382a7b14702ef823fedebf | refs/heads/master | 2021-07-19T12:36:16.014906 | 2020-06-01T08:52:40 | 2020-06-01T08:52:40 | 175,006,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | java | package search.binarysearch;
import java.util.Arrays;
import java.util.Scanner;
public class BinarySearchApi {
static Scanner stdIn=new Scanner(System.in);
public static void main(String[] args) {
System.out.println("array size:");
int size=stdIn.nextInt();
int[] x=new int[size+1];
System.out.println("please insert number by asc:");
for(int i=0;i<size;i++) {
System.out.println("x["+i+"]:");
x[i]=stdIn.nextInt();
}
System.out.println("value to search:");
int key=stdIn.nextInt();
int result=Arrays.binarySearch(x, key);
if(result==-1) {
System.out.println("not found");
}
else {
System.out.println("index:"+result);
}
}
}
| [
"dkcmsadkcmsa@gmail.com"
] | dkcmsadkcmsa@gmail.com |
4e1fab7936a2d18e975838f1bb25696a126c9f7c | 0095a4a2a317884bff49fbde95d62851babcaec3 | /app/src/androidTest/java/edu/sdu/kz/baseapplication/ExampleInstrumentedTest.java | 73889c4175ed488610bc3345bebc51c5e99e62a7 | [] | no_license | orazbay/Notes | 83ca3432bc20ee98c5a589c4e998bb1d127ddb5d | 4085dcbfa411b60095e6dd3f159eced8cca9ac0f | refs/heads/master | 2020-03-18T10:18:49.036912 | 2018-05-25T00:56:31 | 2018-05-25T00:56:31 | 134,606,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package edu.sdu.kz.baseapplication;
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("edu.sdu.kz.baseapplication", appContext.getPackageName());
}
}
| [
"orazbay.n.n@gmail.com"
] | orazbay.n.n@gmail.com |
536ec41a0a61eef43223e68671d4f9bbcd478426 | a6e716a8480ec3bffa239e4b127e3965734bf14d | /POO/Aula09ProjetoLivro/src/aula09projetolivro/Livro.java | e6f16f76892b09999ec21d5cb7d91059f2dd9a6e | [
"MIT"
] | permissive | ascaniopy/java | cb1b6505b26abbe16938bc8f00bad62b545666d8 | 230914f7a8bb886a620e2ebccaf5e9736fcdada0 | refs/heads/main | 2023-08-14T16:05:04.222239 | 2021-10-20T12:42:22 | 2021-10-20T12:42:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,389 | java | package aula09projetolivro;
public class Livro implements Publicacao {
//ATRIBUTOS.
private String titulo;
private String autor;
private int totPaginas;
private int pagAtual;
private boolean aberto;
private Pessoa leitor; //Leitor é uma Classe de Pessoa.
//MÉTODOS
public String detalhes() {
return "Livro{" + "titulo = " + titulo + "\n, autor = "
+ autor + "\n, totPaginas = " + totPaginas
+ "\n, pagAtual = " + pagAtual + "\n, aberto = "
+ aberto + "\n, leitor = " + leitor.getNome() +
"\n, idade = " + leitor.getIdade() +
"\n, sexo = " + leitor.getSexo() + '}';
}
//MÉTODO CONSTRUTOR.
public Livro(String titulo, String autor, int totPaginas, Pessoa leitor) {
this.titulo = titulo;
this.autor = autor;
this.totPaginas = totPaginas;
this.aberto = false;
this.pagAtual = 0;
this.leitor = leitor;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public int getTotPaginas() {
return totPaginas;
}
public void setTotPaginas(int totPaginas) {
this.totPaginas = totPaginas;
}
public int getPagAtual() {
return pagAtual;
}
public void setPagAtual(int pagAtual) {
this.pagAtual = pagAtual;
}
public boolean isAberto() {
return aberto;
}
public void setAberto(boolean aberto) {
this.aberto = aberto;
}
public Pessoa getLeitor() {
return leitor;
}
public void setLeitor(Pessoa leitor) {
this.leitor = leitor;
}
//MÉTODOS ABSTRATOS.
@Override
public void abrir() {
this.aberto = true;
}
@Override
public void fechar() {
this.aberto = false;
}
@Override
public void folhear(int p) {
if (p > totPaginas) {
this.pagAtual = 0;
} else {
this.pagAtual = p;
}
}
@Override
public void avancarPag() {
this.pagAtual++;
}
@Override
public void voltarPag() {
this.pagAtual--;
}
}
| [
"ascanio.py@gmail.com"
] | ascanio.py@gmail.com |
9d2e116c052e7a687afd56f4ac8e2105ed85b1fe | f1433e4fbb7ca8983f96b1f9e6c2901896079bf2 | /TuanHK/android/app/src/main/java/com/tuanhk/demo/DemoView.java | 111d21b9341eca020abbd9c1da9dca6b2b56b963 | [] | no_license | HoangKimTuan/ResearchAndroidVNG | 4f4a45e66a5e46c35084265c790ac3cc59700224 | 858c1882606a8518545b2dac1694ca36219e7637 | refs/heads/master | 2021-09-20T12:09:26.042001 | 2018-08-09T11:31:43 | 2018-08-09T11:31:43 | 110,664,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 57 | java | package com.tuanhk.demo;
public interface DemoView {
}
| [
"hoangkimtuan1996@gmail.com"
] | hoangkimtuan1996@gmail.com |
1754d67cbc14cf0b258d8410de06161a239efaa1 | 287af364a7c56d1dd17e34fe890338c790727b8e | /store/src/main/java/org/ossg/store/model/serializer/impl/DocumentDayOfEventSerializer.java | b9c19b250798e359cb0eb8d57c913e5bd1688482 | [] | no_license | aleoncini/ossgx | 63ed2690bdac0f33231ff6c1865e7560de7a124d | 2289bffab80fbef035ef53e986cbad1715a18ff6 | refs/heads/master | 2022-12-30T15:31:23.427153 | 2020-09-30T12:32:00 | 2020-09-30T12:32:00 | 285,537,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package org.ossg.store.model.serializer.impl;
import javax.enterprise.context.ApplicationScoped;
import org.bson.Document;
import org.ossg.store.model.DayOfEvent;
import org.ossg.store.model.serializer.DayOfEventSerializer;
@ApplicationScoped
public class DocumentDayOfEventSerializer implements DayOfEventSerializer<Document> {
@Override
public Document serialize(DayOfEvent dayOfEvent) {
if (dayOfEvent == null
|| (dayOfEvent.getDay() == 0)
|| (dayOfEvent.getMonth() == 0)
|| (dayOfEvent.getYear() == 0)
) {
throw new IllegalArgumentException("DayOfEvent object contains invalid data");
}
return new Document("day", dayOfEvent.getDay())
.append("month", dayOfEvent.getMonth())
.append("year", dayOfEvent.getYear());
}
@Override
public DayOfEvent deserialize(Document document) {
int day = document.getInteger("day");
int month = document.getInteger("month");
int year = document.getInteger("year");
if (document == null
|| (day == 0)
|| (month == 0)
|| (year == 0)
) {
throw new IllegalArgumentException("Unable to deserialize the object. Document contains invalid data");
}
return new DayOfEvent().setDay(day).setMonth(month).setYear(year);
}
} | [
"andrea.leoncini@gmail.com"
] | andrea.leoncini@gmail.com |
50cabbe4a7353dd49fe744963bda0421d83f14a6 | b228e3f0a67b254edb80100a32514550fb9b8255 | /app/src/main/java/com/yl/baiduren/fragment/debt_manger_fragment/Debt_EnterPrise_Tabulation.java | 45e1bf809f2bb1b22e7350ab79354bf969d59d81 | [] | no_license | sunbeibei111466/baiduren | f02ec2a5f7b3aac367eb48512889c1463b7fc302 | 776970d98b9393ee5542bf2585aa247cc280610c | refs/heads/master | 2020-03-13T12:06:08.685955 | 2018-05-17T09:22:17 | 2018-05-17T09:22:17 | 131,112,483 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,117 | java | package com.yl.baiduren.fragment.debt_manger_fragment;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.cjj.MaterialRefreshLayout;
import com.cjj.MaterialRefreshListener;
import com.yl.baiduren.R;
import com.yl.baiduren.adapter.Debt_EnterPrise_Adapter;
import com.yl.baiduren.base.BaseEntity;
import com.yl.baiduren.base.BaseFragment;
import com.yl.baiduren.base.BaseObserver;
import com.yl.baiduren.base.BaseRequest;
import com.yl.baiduren.data.DataWarehouse;
import com.yl.baiduren.entity.request_body.Debt_PresonEntity;
import com.yl.baiduren.entity.result.DebtPersonList;
import com.yl.baiduren.service.RetrofitHelper;
import com.yl.baiduren.utils.Constant;
import com.yl.baiduren.utils.LUtils;
import com.yl.baiduren.utils.SecurityUtils;
import com.yl.baiduren.utils.UserInfoUtils;
import com.yl.baiduren.utils.Util;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.yl.baiduren.activity.debtmanagpreson.Debt_Person_Manger.childUserId;
/**
* Created by sunbeibei on 2017/12/6.
* 债事企业列表
*/
public class Debt_EnterPrise_Tabulation extends BaseFragment {
public static int pn = 1;
public static int ps = 8;
//2.是刷新的状态
private static final int REFRESH = 2;
//3.上啦刷新加载更多
private static final int LOADMORE = 3;
private int status = 1;
private MaterialRefreshLayout refreshLayout;
private RecyclerView recyclerView;
private Debt_EnterPrise_Adapter adapter;
private List<DebtPersonList.Mode> dataList;
private Handler handler = new Handler();
@Override
public int loadWindowLayout() {
return R.layout.debt_enterprise_tabulation;
}
@Override
public void initViews(View rootView) {
refreshLayout = rootView.findViewById(R.id.refresh_enterprise);
refreshLayout.setMaterialRefreshListener(refreshListener);
recyclerView = rootView.findViewById(R.id.debt_enterprise_recycler);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
adapter = new Debt_EnterPrise_Adapter(childUserId, getActivity());
}
@Override
public void onResume() {
super.onResume();
refreshLayout.postDelayed(new Runnable() {
@Override
public void run() {
refreshLayout.autoRefresh();
}
}, 50);
}
public void getHttp() {
//设置基础参数
if (UserInfoUtils.IsLogin(getActivity())) {
Debt_PresonEntity debtPresonEntity = new Debt_PresonEntity(DataWarehouse.getBaseRequest(getActivity()));
debtPresonEntity.setType(1);
debtPresonEntity.setPageNo(pn);
debtPresonEntity.setPageSize(ps);
if (childUserId != 0) {
debtPresonEntity.setChildUserId(childUserId);
}
BaseObserver<DebtPersonList> baseObserver = new BaseObserver<DebtPersonList>(getActivity()) {
@Override
protected void onSuccees(String code, DebtPersonList data, BaseRequest baseResponse) throws Exception {
if (code.equals("1")) {
if (data.getDataList().size() != 0) {
displayData(data);
dataNotNullHideImageView();
} else {
if (adapter.getList() != null && adapter.getList().size() != 0) {
dataNotNullHideImageView();
}else {
dataNullShowImageView();
}
}
refreshLayout.finishRefresh();
refreshLayout.finishRefreshLoadMore();
}
}
};
baseObserver.setStop(true);
String json = Util.toJson(debtPresonEntity);//转成json
LUtils.e("---json--", json);
String signature = SecurityUtils.md5Signature(json, SecurityUtils.privateKeyTest);//加密
RetrofitHelper.getInstance(getActivity()).getServer()
.getDebtPresonList(signature, RequestBody.create(MediaType.parse(Constant.JSON), json))
.compose(compose(this.<BaseEntity<DebtPersonList>>bindToLifecycle()))
.subscribe(baseObserver);
} else {
getActivity().finish();
}
}
//抽取的展示数据的方法
private void displayData(final DebtPersonList data) {
if (status == REFRESH) {
if (dataList != null) {
dataList.clear();
}
dataList = data.getDataList();
adapter.setDataList(dataList);
recyclerView.setAdapter(adapter);
}
if (status == LOADMORE) {
int size = dataList.size();
List<DebtPersonList.Mode> dataList2 = data.getDataList();
this.dataList.addAll(dataList2);
adapter.setDataList(dataList);
recyclerView.setAdapter(adapter);
recyclerView.scrollToPosition(size - 1);
adapter.notifyDataSetChanged();
}
}
private MaterialRefreshListener refreshListener = new MaterialRefreshListener() {
@Override
public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
status = REFRESH;
pn = 1;
getHttp();
}
@Override
public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
super.onRefreshLoadMore(materialRefreshLayout);
status = LOADMORE;
pn = pn + 1;
getHttp();
}
};
@Override
public void onDestroy() {
super.onDestroy();
pn = 1;
ps = 8;
}
}
| [
"930184501@qq.com"
] | 930184501@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.