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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6ed53565a80e37ea55cbf987e19e254855cc52cc | bc639d15bcc35b6e58f97ca02bee2dc66eba894b | /src/com/vmware/vim25/OvfCpuCompatibilityCheckNotSupported.java | e732253c88b4ba970bcb477d044a7f8cfbf99a89 | [
"BSD-3-Clause"
] | permissive | benn-cs/vijava | db473c46f1a4f449e52611055781f9cfa921c647 | 14fd6b5d2f1407bc981b3c56433c30a33e8d74ab | refs/heads/master | 2021-01-19T08:15:17.194988 | 2013-07-11T05:17:08 | 2013-07-11T05:17:08 | 7,495,841 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | /*================================================================================
Copyright (c) 2012 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class OvfCpuCompatibilityCheckNotSupported extends OvfImport {
} | [
"sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1"
] | sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1 |
3dfc73d90c67cee2c31cfd990d02fe75ad292957 | 0de4ea1d061d473511c4ad64e4ed2c464bf02aa0 | /codigos/InfoLibras/src/infolibras/gerentes/UsuarioGerente.java | c942c2f244c34a1f19cdb5a01a2bf22cd11070a1 | [] | no_license | Ismael-Machado/InfoLibras | f6d2704466590127a04e6c870d5223bac9f4e3f6 | db098efaa6e104ff0d6a554cbbf7ae40f28989dc | refs/heads/master | 2020-07-31T03:53:58.625775 | 2019-11-22T06:13:27 | 2019-11-22T06:13:27 | 210,474,365 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,343 | java | package infolibras.gerentes;
import java.util.List;
import javax.persistence.*;
import infolibras.entidades.*;
public class UsuarioGerente {
EntityManagerFactory emf;
EntityManager em;
public UsuarioGerente() {
emf = Persistence.createEntityManagerFactory("Infolibras");
em = emf.createEntityManager();
}
public void adicionar(Usuario u) {
em.getTransaction().begin();
em.persist(u);
em.getTransaction().commit();
}
public Usuario recuperar(int id) {
return em.find(Usuario.class, id);
}
public void atualizar(Usuario u) {
em.getTransaction().begin();
em.merge(u);
em.getTransaction().commit();
}
public void remover(Usuario u) {
em.getTransaction().begin();
em.remove(u);
em.getTransaction().commit();
}
public void encerrar() {
em.close();
emf.close();
}
@SuppressWarnings("unchecked")
public List<Usuario> recuperarTodos() {
return em.createNamedQuery("Usuario.todos").getResultList();
}
@SuppressWarnings("unchecked")
public List<Usuario> recuperarTodosPorNome(){
return em.createNamedQuery("Usuario.todosPorNome")
.getResultList();
}
@SuppressWarnings("unchecked")
public List<Usuario> recuperarTodosPorNomeContendo(String termo){
return em
.createNamedQuery("Usuario.todosPorNomeContendo")
.setParameter("termo", "%"+termo+"%")
.getResultList();
}
}
| [
"Ismael-Machado@users.noreply.github.com"
] | Ismael-Machado@users.noreply.github.com |
24198b7036ad28bba67596633ee3e9acbc254e10 | d02090542668af9210a7e2fbfdec3a6857816bee | /app/src/main/java/com/shashank/chattingapp/Adapters/GroupMessagesAdapter.java | d1d9b2294213b8a0dcfae4a1c8bb0fbca5dcb027 | [] | no_license | shashank11yadav/Chatting-App | 91876bd37040c19ed9e9f6ade2f05e7eb4ceb446 | 436fae2ee4a371b30f726b2053550deea9e3a3fd | refs/heads/master | 2023-05-06T00:23:28.974572 | 2021-05-31T12:00:05 | 2021-05-31T12:00:05 | 372,486,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,308 | java | package com.shashank.chattingapp.Adapters;
import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.github.pgreze.reactions.ReactionPopup;
import com.github.pgreze.reactions.ReactionsConfig;
import com.github.pgreze.reactions.ReactionsConfigBuilder;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.shashank.chattingapp.Models.Message;
import com.shashank.chattingapp.Models.User;
import com.shashank.chattingapp.R;
import com.shashank.chattingapp.databinding.DeleteDialogBinding;
import com.shashank.chattingapp.databinding.ItemReceiveBinding;
import com.shashank.chattingapp.databinding.ItemReceiveGroupBinding;
import com.shashank.chattingapp.databinding.ItemSentBinding;
import com.shashank.chattingapp.databinding.ItemSentGroupBinding;
import java.util.ArrayList;
public class GroupMessagesAdapter extends RecyclerView.Adapter {
Context context;
ArrayList<Message> messages;
final int ITEM_SENT = 1;
final int ITEM_RECEIVE = 2;
public GroupMessagesAdapter(Context context, ArrayList<Message> messages) {
this.context = context;
this.messages = messages;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if(viewType == ITEM_SENT) {
View view = LayoutInflater.from(context).inflate(R.layout.item_sent_group, parent, false);
return new SentViewHolder(view);
} else {
View view = LayoutInflater.from(context).inflate(R.layout.item_receive_group, parent, false);
return new ReceiverViewHolder(view);
}
}
@Override
public int getItemViewType(int position) {
Message message = messages.get(position);
if(FirebaseAuth.getInstance().getUid().equals(message.getSenderId())) {
return ITEM_SENT;
} else {
return ITEM_RECEIVE;
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
Message message = messages.get(position);
int reactions[] = new int[]{
R.drawable.ic_fb_like,
R.drawable.ic_fb_love,
R.drawable.ic_fb_laugh,
R.drawable.ic_fb_wow,
R.drawable.ic_fb_sad,
R.drawable.ic_fb_angry
};
ReactionsConfig config = new ReactionsConfigBuilder(context)
.withReactions(reactions)
.build();
ReactionPopup popup = new ReactionPopup(context, config, (pos) -> {
if (pos != -1) {
if (holder.getClass() == SentViewHolder.class) {
SentViewHolder viewHolder = (SentViewHolder) holder;
viewHolder.binding.feeling.setImageResource(reactions[pos]);
viewHolder.binding.feeling.setVisibility(View.VISIBLE);
} else {
ReceiverViewHolder viewHolder = (ReceiverViewHolder) holder;
viewHolder.binding.feeling.setImageResource(reactions[pos]);
viewHolder.binding.feeling.setVisibility(View.VISIBLE);
}
message.setFeeling(pos);
FirebaseDatabase.getInstance().getReference()
.child("public")
.child(message.getMessageId()).setValue(message);
}
return true; // true is closing popup, false is requesting a new selection
});
if(holder.getClass() == SentViewHolder.class) {
SentViewHolder viewHolder = (SentViewHolder)holder;
if(message.getMessage().equals("photo")) {
viewHolder.binding.image.setVisibility(View.VISIBLE);
viewHolder.binding.message.setVisibility(View.GONE);
Glide.with(context)
.load(message.getImageUrl())
.placeholder(R.drawable.placeholder)
.into(viewHolder.binding.image);
}
FirebaseDatabase.getInstance()
.getReference().child("users")
.child(message.getSenderId())
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if(snapshot.exists()) {
User user = snapshot.getValue(User.class);
viewHolder.binding.name.setText("@" + user.getName());
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
viewHolder.binding.message.setText(message.getMessage());
if(message.getFeeling() >= 0) {
viewHolder.binding.feeling.setImageResource(reactions[message.getFeeling()]);
viewHolder.binding.feeling.setVisibility(View.VISIBLE);
} else {
viewHolder.binding.feeling.setVisibility(View.GONE);
}
viewHolder.binding.message.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
popup.onTouch(v, event);
return false;
}
});
viewHolder.binding.image.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
popup.onTouch(v, event);
return false;
}
});
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
View view = LayoutInflater.from(context).inflate(R.layout.delete_dialog, null);
DeleteDialogBinding binding = DeleteDialogBinding.bind(view);
AlertDialog dialog = new AlertDialog.Builder(context)
.setTitle("Delete Message")
.setView(binding.getRoot())
.create();
binding.everyone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
message.setMessage("This message is removed.");
message.setFeeling(-1);
FirebaseDatabase.getInstance().getReference()
.child("public")
.child(message.getMessageId()).setValue(message);
dialog.dismiss();
}
});
binding.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseDatabase.getInstance().getReference()
.child("public")
.child(message.getMessageId()).setValue(null);
dialog.dismiss();
}
});
binding.cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
return false;
}
});
} else {
ReceiverViewHolder viewHolder = (ReceiverViewHolder)holder;
if(message.getMessage().equals("photo")) {
viewHolder.binding.image.setVisibility(View.VISIBLE);
viewHolder.binding.message.setVisibility(View.GONE);
Glide.with(context)
.load(message.getImageUrl())
.placeholder(R.drawable.placeholder)
.into(viewHolder.binding.image);
}
FirebaseDatabase.getInstance()
.getReference().child("users")
.child(message.getSenderId())
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if(snapshot.exists()) {
User user = snapshot.getValue(User.class);
viewHolder.binding.name.setText("@" + user.getName());
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
viewHolder.binding.message.setText(message.getMessage());
if(message.getFeeling() >= 0) {
//message.setFeeling(reactions[message.getFeeling()]);
viewHolder.binding.feeling.setImageResource(reactions[message.getFeeling()]);
viewHolder.binding.feeling.setVisibility(View.VISIBLE);
} else {
viewHolder.binding.feeling.setVisibility(View.GONE);
}
viewHolder.binding.message.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
popup.onTouch(v, event);
return false;
}
});
viewHolder.binding.image.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
popup.onTouch(v, event);
return false;
}
});
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
View view = LayoutInflater.from(context).inflate(R.layout.delete_dialog, null);
DeleteDialogBinding binding = DeleteDialogBinding.bind(view);
AlertDialog dialog = new AlertDialog.Builder(context)
.setTitle("Delete Message")
.setView(binding.getRoot())
.create();
binding.everyone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
message.setMessage("This message is removed.");
message.setFeeling(-1);
FirebaseDatabase.getInstance().getReference()
.child("public")
.child(message.getMessageId()).setValue(message);
dialog.dismiss();
}
});
binding.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseDatabase.getInstance().getReference()
.child("public")
.child(message.getMessageId()).setValue(null);
dialog.dismiss();
}
});
binding.cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
return false;
}
});
}
}
@Override
public int getItemCount() {
return messages.size();
}
public class SentViewHolder extends RecyclerView.ViewHolder {
ItemSentGroupBinding binding;
public SentViewHolder(@NonNull View itemView) {
super(itemView);
binding = ItemSentGroupBinding.bind(itemView);
}
}
public class ReceiverViewHolder extends RecyclerView.ViewHolder {
ItemReceiveGroupBinding binding;
public ReceiverViewHolder(@NonNull View itemView) {
super(itemView);
binding = ItemReceiveGroupBinding.bind(itemView);
}
}
} | [
"shashank.yadav3032@gmail.com"
] | shashank.yadav3032@gmail.com |
68149f7ea97170561bd250d157b7231794caf349 | 529d6b8423adbc52b39b688bd28c6e51736816ff | /app/src/main/java/com/nlpsample/NFLApplication.java | 7a95e4612318a57b7e817bc5de57546eb9d18071 | [] | no_license | nabeelazam/NRLSample | 8cd7585ba09aa3aa0a63396ef90d4c5114f0024b | 448f1b292e46c5fd126ac2354047c6efc164a54f | refs/heads/master | 2021-05-07T03:33:25.692923 | 2017-11-17T04:37:04 | 2017-11-17T04:37:04 | 110,962,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package com.nlpsample;
import android.app.Application;
public class NFLApplication extends Application {
private static NFLApplication mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized NFLApplication getInstance() {
return mInstance;
}
}
| [
"nabeelazam.esp@gmail.com"
] | nabeelazam.esp@gmail.com |
5af1789648b21ab3a4c09303409a712b296881c3 | bc3b8b9637e2c4a6eac801eb99502f9103b838e8 | /generated-java/gen/generated/data/Investigation.java | 99b33290b96500033ef185464969d860c011ea8e | [] | no_license | VladRassokhin/teamcity-rest-client-generated | eeb42d8ae7f52cc9dc2ba687dda89bdd45fd3094 | 1a6eac67c1b3f28f58ba288628d4fa4d49afab6b | refs/heads/master | 2023-08-29T11:51:14.435023 | 2015-09-09T14:56:56 | 2015-09-09T14:56:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,124 | java |
package generated.data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for investigation complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="investigation">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="assignee" type="{}user" minOccurs="0"/>
* <element name="assignment" type="{}comment" minOccurs="0"/>
* <element name="scope" type="{}problemScope" minOccurs="0"/>
* <element name="target" type="{}problemTarget" minOccurs="0"/>
* <element name="resolution" type="{}resolution" minOccurs="0"/>
* <element name="responsible" type="{}user" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="state" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="href" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "investigation", propOrder = {
"assignee",
"assignment",
"scope",
"target",
"resolution",
"responsible"
})
public class Investigation {
protected User assignee;
protected Comment assignment;
protected ProblemScope scope;
protected ProblemTarget target;
protected Resolution resolution;
protected User responsible;
@XmlAttribute(name = "id")
protected String id;
@XmlAttribute(name = "state")
protected String state;
@XmlAttribute(name = "href")
protected String href;
/**
* Gets the value of the assignee property.
*
* @return
* possible object is
* {@link User }
*
*/
public User getAssignee() {
return assignee;
}
/**
* Sets the value of the assignee property.
*
* @param value
* allowed object is
* {@link User }
*
*/
public void setAssignee(User value) {
this.assignee = value;
}
/**
* Gets the value of the assignment property.
*
* @return
* possible object is
* {@link Comment }
*
*/
public Comment getAssignment() {
return assignment;
}
/**
* Sets the value of the assignment property.
*
* @param value
* allowed object is
* {@link Comment }
*
*/
public void setAssignment(Comment value) {
this.assignment = value;
}
/**
* Gets the value of the scope property.
*
* @return
* possible object is
* {@link ProblemScope }
*
*/
public ProblemScope getScope() {
return scope;
}
/**
* Sets the value of the scope property.
*
* @param value
* allowed object is
* {@link ProblemScope }
*
*/
public void setScope(ProblemScope value) {
this.scope = value;
}
/**
* Gets the value of the target property.
*
* @return
* possible object is
* {@link ProblemTarget }
*
*/
public ProblemTarget getTarget() {
return target;
}
/**
* Sets the value of the target property.
*
* @param value
* allowed object is
* {@link ProblemTarget }
*
*/
public void setTarget(ProblemTarget value) {
this.target = value;
}
/**
* Gets the value of the resolution property.
*
* @return
* possible object is
* {@link Resolution }
*
*/
public Resolution getResolution() {
return resolution;
}
/**
* Sets the value of the resolution property.
*
* @param value
* allowed object is
* {@link Resolution }
*
*/
public void setResolution(Resolution value) {
this.resolution = value;
}
/**
* Gets the value of the responsible property.
*
* @return
* possible object is
* {@link User }
*
*/
public User getResponsible() {
return responsible;
}
/**
* Sets the value of the responsible property.
*
* @param value
* allowed object is
* {@link User }
*
*/
public void setResponsible(User value) {
this.responsible = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getState() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setState(String value) {
this.state = value;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
}
| [
"vladislav.rassokhin@jetbrains.com"
] | vladislav.rassokhin@jetbrains.com |
6c5d306128a5d8d2061d718c160bff92750a843f | 058d42f5b5f486d0c76370f42d2d4738cca8cbf7 | /bundles/org.insilico.core/src/org/insilico/core/handlers/CreateFileHandler.java | dd4a4a1255243076ed9f95e8e63938af62476bcb | [
"MIT"
] | permissive | draeger-lab/insilico | 467ff616cb59c405a062aece55352b731407c212 | e1ed15ed5ff67f32e6d12cf5467db44bbec374cc | refs/heads/master | 2022-11-16T18:30:00.326857 | 2020-03-20T15:09:10 | 2020-03-20T15:09:10 | 121,960,428 | 6 | 4 | MIT | 2020-06-23T10:26:35 | 2018-02-18T14:46:51 | Java | UTF-8 | Java | false | false | 1,015 | java | package org.insilico.core.handlers;
import java.io.InputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* Abstract base class for Handlers which wish to create a new file. Subclasses can override
* {@link CreateFileHandler#getUpdateFlags()} and {@link CreateFileHandler#getContent()} to provide
* the update flags and the content of the new file.
*
* @author roman
*
*/
abstract public class CreateFileHandler {
protected void createFile(IProject parent, IPath path, InputStream content, int flags, IProgressMonitor pm) throws CoreException {
IFile file = parent.getFile(path);
createFile(file, content, flags, pm);
}
protected void createFile(IFile file, InputStream content, int flags, IProgressMonitor pm) throws CoreException {
file.create(content, flags, pm);
}
}
| [
"roman-schulte@gmx.de"
] | roman-schulte@gmx.de |
b5e174d3ece9b8711350a4f615c796b1424b30be | d8bdd072c6483d2dba05048e5c79b2c644b8357d | /src/com/hub/controllers/SecurityController.java | b6c7ae1e8783c563b10818aff35d21b834740209 | [] | no_license | cdjordan29/designhub | 43c7e13e633d258fd116343abb4e0b9b7bdf4e0f | f50ef8e9fca465d5718e07d465031af9b67c4530 | refs/heads/master | 2020-03-17T08:29:15.202991 | 2018-05-15T01:15:04 | 2018-05-15T01:15:04 | 132,488,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java | package com.hub.controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
//@RequestMapping("/login")
public class SecurityController {
@RequestMapping(value="/login", method=RequestMethod.GET)
public ModelAndView login(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout,
@RequestParam(value = "sessionError", required = false) String sessionError) {
ModelAndView model = new ModelAndView();
if (error != null) {
model.addObject("error", "Invalid username and password!");
}
if(sessionError != null ){
model.addObject("sessionError", "Invalid session data, try refreshing your browser.");
}
if (logout != null) {
model.addObject("msg", "You've been logged out successfully.");
}
model.setViewName("login");
return model;
}
@RequestMapping(value="/logout", method = RequestMethod.GET)
public String logout (HttpServletRequest request, HttpServletResponse response) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null){
new SecurityContextLogoutHandler().logout(request, response, auth);
}
return "redirect:/login?logout";
}
} | [
"cjordan29@radford.edu"
] | cjordan29@radford.edu |
f813de46406527ae81751f0b66ad063f412fdfe0 | d66a4cbb0bb425b3d1bef9054e421a9ac1bf784b | /gmsc-app/app/src/main/java/cn/gmuni/sc/module/me/MeFragment.java | 50694d25a7092360f8b08559210cbba3d2bc6555 | [] | no_license | zhuxin3230213/android | a0300e991189ba87d3617b8e2e316b1b616b9b1c | 21c3faf7650de9c90cfe53e9af9bf200308e4282 | refs/heads/master | 2020-04-13T18:18:53.258699 | 2019-01-21T03:13:53 | 2019-01-21T03:13:53 | 161,720,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,534 | java | package cn.gmuni.sc.module.me;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
import cn.gmuni.sc.R;
import cn.gmuni.sc.base.BaseFragment;
import cn.gmuni.sc.model.entities.UserInfoEntity;
import cn.gmuni.sc.module.me.SignIn.SignInActivity;
import cn.gmuni.sc.module.me.me_market.MeMarketActivity;
import cn.gmuni.sc.module.me.message.MessageActivity;
import cn.gmuni.sc.module.me.personal_details.PersionalDetailsActivity;
import cn.gmuni.sc.module.schoolcard.SchoolCardActivity;
import cn.gmuni.sc.network.Network;
import cn.gmuni.sc.network.api.IMessageApi;
import cn.gmuni.sc.utils.BitMapUtil;
import cn.gmuni.sc.utils.ClickShake;
import cn.gmuni.sc.utils.MToast;
import cn.gmuni.sc.utils.SecurityUtils;
import cn.gmuni.sc.widget.CustomImageView;
/**
* A simple {@link Fragment} subclass.
*/
public class MeFragment extends BaseFragment {
@BindView(R.id.me_setting)
RelativeLayout settingView;
@BindView(R.id.me_school_card)
RelativeLayout schoolCardView;
@BindView(R.id.me_pay_fanpiao)
RelativeLayout fanpiaoView;
@BindView(R.id.me_pay_detail)
RelativeLayout payDetailView;
@BindView(R.id.me_school_name)
TextView schoolNameView;
@BindView(R.id.me_user_name)
TextView userNameView;
@BindView(R.id.me_avatar_img)
CustomImageView avatarView;
@BindView(R.id.me_school_information_icon_circular_round)
TextView me_school_information_icon_circular_round;
public static final int UPDATE_USERINFO_CODE = 1;
public static final int READ_MESSAGE_STATE = 2;
public MeFragment() {
// Required empty public constructor
}
@Override
public int getLayoutRes() {
return R.layout.fragment_me;
}
@Override
public void initView() {
UserInfoEntity entity = SecurityUtils.getUserInfo();
if (entity != null) {
schoolNameView.setText(entity.getSchoolName());
userNameView.setText(entity.getName());
if (null != entity.getAvatar() && !"".equals(entity.getAvatar())) {
avatarView.setImageBitmap(BitMapUtil.base64ToBitmap(entity.getAvatar()));
}
}
//获取消息列表有未读状态
getMessageState();
}
//获取消息列表状态
private void getMessageState() {
Network.request(Network.createApi(IMessageApi.class).getMessageState(), new Network.IResponseListener<Map<String, Object>>() {
@Override
public void onSuccess(Map<String, Object> data) {
if (data != null) {
if ("true".equals(String.valueOf(data.get("flag")))) {
//有未读消息,则显示小圆点
me_school_information_icon_circular_round.setVisibility(View.VISIBLE);
} else {
me_school_information_icon_circular_round.setVisibility(View.GONE);
}
} else {
me_school_information_icon_circular_round.setVisibility(View.GONE);
}
}
@Override
public void onFail(int code, String message) {
MToast.showShortToast("获取消息状态失败");
}
});
}
@OnClick({R.id.me_school_message, R.id.me_school_market, R.id.me_school_card, R.id.me_pay_fanpiao, R.id.me_pay_detail, R.id.me_setting,
R.id.me_school_xueji})
protected void OnItemClick(RelativeLayout view) {
if (!ClickShake.check(view.getId())) {
return;
}
switch (view.getId()) {
case R.id.me_school_message: {
startActivityForResult(new Intent(getContext(), MessageActivity.class), READ_MESSAGE_STATE);
break;
}
case R.id.me_school_market:{
startActivity(new Intent(getContext(),MeMarketActivity.class));
break;
}
case R.id.me_setting: {
startActivity(new Intent(getContext(), MeSettingActivity.class));
break;
}
case R.id.me_school_xueji: {
startActivity(new Intent(getContext(), StudentRollActivity.class));
break;
}
case R.id.me_school_card: {
startActivitySecurity(new Intent(getContext(), SchoolCardActivity.class));
break;
}
case R.id.me_pay_fanpiao: {
MToast.showLongToast("正在开发中");
break;
}
case R.id.me_pay_detail: {
MToast.showLongToast("正在开发中");
break;
}
}
}
@OnClick(R.id.me_edit)
protected void onEditClick(CustomImageView edit) {
startActivityForResult(new Intent(getContext(), PersionalDetailsActivity.class), UPDATE_USERINFO_CODE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
//如果修改了数据
if (requestCode == UPDATE_USERINFO_CODE) {
UserInfoEntity userInfo = SecurityUtils.getUserInfo();
userNameView.setText(userInfo.getName());
schoolNameView.setText(userInfo.getSchoolName());
if (null != userInfo.getAvatar() && !"".equals(userInfo.getAvatar())) {
avatarView.setImageBitmap(BitMapUtil.base64ToBitmap(userInfo.getAvatar()));
}
}
//消息阅读状态
if (resultCode == READ_MESSAGE_STATE) {
String iState = data.getStringExtra("iState");
if ("true".equals(iState)) {
me_school_information_icon_circular_round.setVisibility(View.VISIBLE);
} else {
me_school_information_icon_circular_round.setVisibility(View.GONE);
}
}
}
@OnClick({R.id.me_sign_in, R.id.me_sign_in_bt})
protected void onSignInClick(View v) {
startActivity(new Intent(getContext(), SignInActivity.class));
}
@Override
protected void managerArguments() {
}
public static MeFragment newInstance() {
MeFragment fragment = new MeFragment();
Bundle bundle = new Bundle();
fragment.setArguments(bundle);
return fragment;
}
}
| [
"zhuxin_123"
] | zhuxin_123 |
1f5c7779fffff543c0fb607413d8b6b625fcf5d4 | d36d5b620e7c999b7b62af27df46f62828e8cbb3 | /app/src/main/java/com/extra/saas/WelcomeAty.java | 5f503bb12b2b7a4477eb4e001db2aabc20c67e86 | [] | no_license | CNHTT/ENGNINETWOTWOZERO | 6aa5e4a4b3ec489877df7dea94f4438f47ca1b38 | f13d50bbcd0985ba123cd52486fb6839789501b0 | refs/heads/master | 2021-08-16T08:59:40.653651 | 2017-11-19T13:03:36 | 2017-11-19T13:03:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | package com.extra.saas;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
public class WelcomeAty extends AppCompatActivity {
@BindView(R.id.imageView)
ImageView imageView;
Disposable dis;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏标题
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏
setContentView(R.layout.activity_welcome_aty);
ButterKnife.bind(this);
Glide.with(this).load("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1511102993009&di=453775d011b9612599b9e7a7c98c5724&imgtype=0&src=http%3A%2F%2Fimg4q.duitang.com%2Fuploads%2Fitem%2F201504%2F23%2F20150423H4547_NSyJn.thumb.700_0.jpeg").into(imageView);
Observable.timer(3, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
dis=d;
}
@Override
public void onNext(Long value) {
}
@Override
public void onError(Throwable e) {
cancel();
}
@Override
public void onComplete() {
//完成时调用
toLogin();
}
});
}
private void toLogin() {
finish();
startActivity(new Intent(this,MainActivity.class));
}
/**
* 取消订阅
*/
public void cancel(){
if(dis!=null&&!dis.isDisposed()){
dis.dispose();
}
}
}
| [
"cnhttt@163.com"
] | cnhttt@163.com |
b79041529fc8a9c6601b465499b3c6d2ee321a9e | b6b1cf3bec73438d5652b6266f85567c4a300879 | /app/src/main/java/com/example/machine_task/BitmapUtils.java | 0774bef234776db1a756286986e676b29b1f0b14 | [] | no_license | akshayNagrale/Machine_Task | 58e032421c2db7c8c0099abadfbff601fb710f6b | a48645782084b3887997367da1bdb249616f5a67 | refs/heads/master | 2022-12-25T22:41:03.051610 | 2020-10-01T04:49:41 | 2020-10-01T04:49:41 | 300,147,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,804 | java | package com.example.machine_task;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import androidx.core.content.FileProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
class BitmapUtils {
private static final String FILE_PROVIDER_AUTHORITY = "com.example.android.fileprovider";
static Bitmap resamplePic(Context context, String imagePath) {
// Get device screen size information
DisplayMetrics metrics = new DisplayMetrics();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
manager.getDefaultDisplay().getMetrics(metrics);
int targetH = metrics.heightPixels;
int targetW = metrics.widthPixels;
// Get the dimensions of the original bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(imagePath, bmOptions);
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
// Determine how much to scale down the image
int scaleFactor = Math.min(photoW / targetW, photoH / targetH);
// Decode the image file into a Bitmap sized to fill the View
bmOptions.inJustDecodeBounds = false;
bmOptions.inSampleSize = scaleFactor;
return BitmapFactory.decodeFile(imagePath);
}
/**
* Creates the temporary image file in the cache directory.
*
* @return The temporary image file.
* @throws IOException Thrown if there is an error creating the file
*/
static File createTempImageFile(Context context) throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = context.getExternalCacheDir();
return File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
}
/**
* Deletes image file for a given path.
*
* @param context The application context.
* @param imagePath The path of the photo to be deleted.
*/
static boolean deleteImageFile(Context context, String imagePath) {
// Get the file
File imageFile = new File(imagePath);
// Delete the image
boolean deleted = imageFile.delete();
// If there is an error deleting the file, show a Toast
if (!deleted) {
String errorMessage = context.getString(R.string.error);
}
return deleted;
}
/**
* Helper method for adding the photo to the system photo gallery so it can be accessed
* from other apps.
*
* @param imagePath The path of the saved image
*/
private static void galleryAddPic(Context context, String imagePath) {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(imagePath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
context.sendBroadcast(mediaScanIntent);
}
/**
* Helper method for saving the image.
*
* @param context The application context.
* @param image The image to be saved.
* @return The path of the saved image.
*/
static String saveImage(Context context, Bitmap image) {
String savedImagePath = null;
// Create the new file in the external storage
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + ".jpg";
File storageDir = new File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
+ "/MyCamera");
boolean success = true;
if (!storageDir.exists()) {
success = storageDir.mkdirs();
}
// Save the new Bitmap
if (success) {
File imageFile = new File(storageDir, imageFileName);
savedImagePath = imageFile.getAbsolutePath();
try {
OutputStream fOut = new FileOutputStream(imageFile);
image.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
fOut.close();
} catch (Exception e) {
e.printStackTrace();
}
// Add the image to the system gallery
galleryAddPic(context, savedImagePath);
// Show a Toast with the save location
// String savedMessage = context.getString(R.string.saved_message, savedImagePath);
}
return savedImagePath;
}
/**
* Helper method for sharing an image.
*
* @param context The image context.
* @param imagePath The path of the image to be shared.
*/
static void shareImage(Context context, String imagePath) {
// Create the share intent and start the share activity
File imageFile = new File(imagePath);
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
Uri photoURI = FileProvider.getUriForFile(context, FILE_PROVIDER_AUTHORITY, imageFile);
shareIntent.putExtra(Intent.EXTRA_STREAM, photoURI);
context.startActivity(shareIntent);
}
}
| [
"akshaynagrale123@gmail.com"
] | akshaynagrale123@gmail.com |
fcd1f882e8694de96c0f6fe45cdecca5aa68fb49 | 982f6c3a3c006d2b03f4f53c695461455bee64e9 | /src/main/java/com/alipay/api/domain/AlipayInsMarketingCampaignPrizeSendModel.java | 000ff6ccdb5f7a41cb9a614444ed2738b770d417 | [
"Apache-2.0"
] | permissive | zhaomain/Alipay-Sdk | 80ffc0505fe81cc7dd8869d2bf9a894b823db150 | 552f68a2e7c10f9ffb33cd8e0036b0643c7c2bb3 | refs/heads/master | 2022-11-15T03:31:47.418847 | 2020-07-09T12:18:59 | 2020-07-09T12:18:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,007 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 保险营销活动发奖接口
*
* @author auto create
* @since 1.0, 2017-12-14 18:04:02
*/
public class AlipayInsMarketingCampaignPrizeSendModel extends AlipayObject {
private static final long serialVersionUID = 2521667421146469676L;
/**
* 账户id,如支付宝userId:2088102161835009
*/
@ApiField("account_id")
private String accountId;
/**
* 账号类型
*/
@ApiField("account_type")
private Long accountType;
/**
* 营销保险活动Id
*/
@ApiField("campaign_id")
private String campaignId;
/**
* 发奖规则因子
*/
@ApiListField("factors")
@ApiField("ins_mkt_factor_d_t_o")
private List<InsMktFactorDTO> factors;
/**
* 发奖接口幂等字段
*/
@ApiField("out_biz_no")
private String outBizNo;
/**
* 请求流水Id
*/
@ApiField("request_id")
private String requestId;
public String getAccountId() {
return this.accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public Long getAccountType() {
return this.accountType;
}
public void setAccountType(Long accountType) {
this.accountType = accountType;
}
public String getCampaignId() {
return this.campaignId;
}
public void setCampaignId(String campaignId) {
this.campaignId = campaignId;
}
public List<InsMktFactorDTO> getFactors() {
return this.factors;
}
public void setFactors(List<InsMktFactorDTO> factors) {
this.factors = factors;
}
public String getOutBizNo() {
return this.outBizNo;
}
public void setOutBizNo(String outBizNo) {
this.outBizNo = outBizNo;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
d4985d36fe6ffd60765f6b81b2ca6ce2341d351d | 83daf21be3227ce30b84bff78bb253dfb52d2e43 | /ZooplaAutomation/src/main/java/com/report/ExtentTestManager.java | 95121259c3b83007fbddb2b49942999fcbe4a99f | [] | no_license | studentqa2020/ZiaZooplaAutomation | 7e59befb3d84a2b6cbfcb514aef4860006cef092 | 404c9e76416fc1ffb9d65358c20479a7f05c7e75 | refs/heads/master | 2022-11-30T18:32:45.422358 | 2020-08-13T23:54:27 | 2020-08-13T23:54:27 | 287,402,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package com.report;
import java.util.HashMap;
import java.util.Map;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
public class ExtentTestManager {
static Map<Integer, ExtentTest> extentTestMap = new HashMap<Integer, ExtentTest>();
static ExtentReports extent = ExtentManager.getInstance();
public static synchronized ExtentTest getTest() {
return (ExtentTest) extentTestMap.get((int) (long) (Thread.currentThread().getId()));
}
public static synchronized void endTest() {
extent.flush();
}
public static synchronized ExtentTest startTest(String testName) {
ExtentTest test = extent.createTest(testName);
extentTestMap.put((int) (long) (Thread.currentThread().getId()), test);
return test;
}
}
| [
"Administrator@192.168.1.13"
] | Administrator@192.168.1.13 |
0468117e492e1975d2e400cfd08f71df09120baf | 719ebacd5488fe811e232d1f36ae69c688ae73c8 | /previousLabsGrp55/lab2-Odometry/SquareDriver.java | d188d226eab1b127275d1a3cfd223ce6d74f4c87 | [] | no_license | tliaresq/DPM-Team-13 | 78eb39694dfe04fad4286ad257f13135504f4133 | 13b1158d583e0957f3c01bbef15e2280dd2db0e4 | refs/heads/master | 2021-01-16T23:20:58.911433 | 2015-04-11T20:26:15 | 2015-04-11T20:26:15 | 61,638,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,500 | java | /*
* SquareDriver.java
*/
import lejos.nxt.*;
public class SquareDriver {
private static final int FORWARD_SPEED = 180;
private static final int ROTATE_SPEED = 150;
public static void drive(NXTRegulatedMotor leftMotor, NXTRegulatedMotor rightMotor,
double leftRadius, double rightRadius, double width) {
// reset the motors
for (NXTRegulatedMotor motor : new NXTRegulatedMotor[] { leftMotor, rightMotor }) {
motor.stop();
motor.setAcceleration(3000);
}
// wait 5 seconds
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// there is nothing to be done here because it is not expected that
// the odometer will be interrupted by another thread
}
for (int i = 0; i < 4; i++) {
// drive forward two tiles
leftMotor.setSpeed(FORWARD_SPEED);
rightMotor.setSpeed(FORWARD_SPEED);
leftMotor.rotate(convertDistance(leftRadius, 60.96), true);
rightMotor.rotate(convertDistance(rightRadius, 60.96), false);
// turn 90 degrees clockwise
leftMotor.setSpeed(ROTATE_SPEED);
rightMotor.setSpeed(ROTATE_SPEED);
leftMotor.rotate(convertAngle(leftRadius, width, 90.0), true);
rightMotor.rotate(-convertAngle(rightRadius, width, 90.0), false);
}
}
private static int convertDistance(double radius, double distance) {
return (int) ((180.0 * distance) / (Math.PI * radius));
}
private static int convertAngle(double radius, double width, double angle) {
return convertDistance(radius, Math.PI * width * angle / 360.0);
}
} | [
"cedric.bonjour@hotmail.fr"
] | cedric.bonjour@hotmail.fr |
288892a6639d12f15b257e5fe45b733a90429a6f | a10e10002b3ba599cd48e42fca34024f42482844 | /src/xlsx4j/java/org/xlsx4j/sml/CTCustomSheetViews.java | 4ffac5bcc26a54a4d4bcbfe2d7b33f1464359ae2 | [
"Apache-2.0"
] | permissive | nanofish/docx4j | ec113804302dfd47602ac98a942a7ef40ab5f6bc | 848c8876cae6aac38f75fed309740cdb12be3860 | refs/heads/master | 2021-01-23T21:01:30.782111 | 2013-01-28T10:53:45 | 2013-01-28T10:53:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,577 | java | /*
* Copyright 2010-2013, Plutext Pty Ltd.
*
* This file is part of xlsx4j, a component of docx4j.
docx4j is 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.xlsx4j.sml;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.ppp.Child;
/**
* <p>Java class for CT_CustomSheetViews complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CT_CustomSheetViews">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="customSheetView" type="{http://schemas.openxmlformats.org/spreadsheetml/2006/main}CT_CustomSheetView" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_CustomSheetViews", propOrder = {
"customSheetView"
})
public class CTCustomSheetViews implements Child
{
@XmlElement(required = true)
protected List<CTCustomSheetView> customSheetView;
@XmlTransient
private Object parent;
/**
* Gets the value of the customSheetView property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the customSheetView property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCustomSheetView().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTCustomSheetView }
*
*
*/
public List<CTCustomSheetView> getCustomSheetView() {
if (customSheetView == null) {
customSheetView = new ArrayList<CTCustomSheetView>();
}
return this.customSheetView;
}
/**
* Gets the parent object in the object tree representing the unmarshalled xml document.
*
* @return
* The parent object.
*/
public Object getParent() {
return this.parent;
}
public void setParent(Object parent) {
this.parent = parent;
}
/**
* This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
*
* @param parent
* The parent object in the object tree.
* @param unmarshaller
* The unmarshaller that generated the instance.
*/
public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
setParent(parent);
}
}
| [
"github@nanofish.org"
] | github@nanofish.org |
db87fcc2c30157c9d3cf5b8316d5faee0dd3bb44 | 57edb737df8e9de3822d4f08d0de81f028403209 | /spring-web/src/main/java/org/springframework/web/util/pattern/CaptureTheRestPathElement.java | 0a38c3b16f8723a3bc7c4648a43b1de31749368a | [
"Apache-2.0"
] | permissive | haoxianrui/spring-framework | 20d904fffe7ddddcd7d78445537f66e0b4cf65f5 | e5163351c47feb69483e79fa782eec3e4d8613e8 | refs/heads/master | 2023-05-25T14:27:18.935575 | 2020-10-23T01:04:05 | 2020-10-23T01:04:05 | 260,652,424 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,968 | java | /*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.web.util.pattern;
import java.util.List;
import org.springframework.http.server.PathContainer.Element;
import org.springframework.http.server.PathContainer.PathSegment;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.util.pattern.PathPattern.MatchingContext;
/**
* A path element representing capturing the rest of a path. In the pattern
* '/foo/{*foobar}' the /{*foobar} is represented as a {@link CaptureTheRestPathElement}.
*
* @author Andy Clement
* @since 5.0
*/
class CaptureTheRestPathElement extends PathElement {
private final String variableName;
/**
* Create a new {@link CaptureTheRestPathElement} instance.
*
* @param pos position of the path element within the path pattern text
* @param captureDescriptor a character array containing contents like '{' '*' 'a' 'b' '}'
* @param separator the separator used in the path pattern
*/
CaptureTheRestPathElement(int pos, char[] captureDescriptor, char separator) {
super(pos, separator);
this.variableName = new String(captureDescriptor, 2, captureDescriptor.length - 3);
}
@Override
public boolean matches(int pathIndex, MatchingContext matchingContext) {
// No need to handle 'match start' checking as this captures everything
// anyway and cannot be followed by anything else
// assert next == null
// If there is more data, it must start with the separator
if (pathIndex < matchingContext.pathLength && !matchingContext.isSeparator(pathIndex)) {
return false;
}
if (matchingContext.determineRemainingPath) {
matchingContext.remainingPathIndex = matchingContext.pathLength;
}
if (matchingContext.extractingVariables) {
// Collect the parameters from all the remaining segments
MultiValueMap<String, String> parametersCollector = null;
for (int i = pathIndex; i < matchingContext.pathLength; i++) {
Element element = matchingContext.pathElements.get(i);
if (element instanceof PathSegment) {
MultiValueMap<String, String> parameters = ((PathSegment) element).parameters();
if (!parameters.isEmpty()) {
if (parametersCollector == null) {
parametersCollector = new LinkedMultiValueMap<>();
}
parametersCollector.addAll(parameters);
}
}
}
matchingContext.set(this.variableName, pathToString(pathIndex, matchingContext.pathElements),
parametersCollector == null ? NO_PARAMETERS : parametersCollector);
}
return true;
}
private String pathToString(int fromSegment, List<Element> pathElements) {
StringBuilder buf = new StringBuilder();
for (int i = fromSegment, max = pathElements.size(); i < max; i++) {
Element element = pathElements.get(i);
if (element instanceof PathSegment) {
buf.append(((PathSegment) element).valueToMatch());
} else {
buf.append(element.value());
}
}
return buf.toString();
}
@Override
public int getNormalizedLength() {
return 1;
}
@Override
public int getWildcardCount() {
return 0;
}
@Override
public int getCaptureCount() {
return 1;
}
@Override
public String toString() {
return "CaptureTheRest(/{*" + this.variableName + "})";
}
@Override
public char[] getChars() {
return ("/{*" + this.variableName + "}").toCharArray();
}
}
| [
"1490493387@qq.com"
] | 1490493387@qq.com |
e946bb2d350ee54cdb610f504975ebe005d63197 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_b504608e8b8bcc3425818940c19ce6d9416879ae/Grid/6_b504608e8b8bcc3425818940c19ce6d9416879ae_Grid_s.java | 3dde96e2942f74509afd56df8fae3c07cf0623a5 | [] | 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 | 3,621 | java | package ep.common;
import ucar.ma2.Array;
import ucar.ma2.Index;
public class Grid {
public Array surface;
public float baseLon;
public float baseLat;
public float resLon;
public float resLat;
public long getSize() {
return surface.getSize();
}
public Array getSurface() {
return surface;
}
public void setSurface(Array surface) {
this.surface = surface;
}
public int[] getShape() {
return surface.getShape();
}
public Index getIndex() {
return surface.getIndex();
}
public void globalize() {
baseLon = 0;
baseLat = 0;
int[] shape = getShape();
resLat = 180.0f / shape[0];
resLon = 360.0f / shape[1];
}
private Grid cloneWithProperties() {
Grid ng = new Grid();
ng.baseLat = baseLat;
ng.baseLon = baseLon;
ng.resLat = resLat;
ng.resLon = resLon;
return ng;
}
public Grid empty() {
Grid ng = cloneWithProperties();
ng.surface = Array.factory(surface.getElementType(), surface.getShape());
return ng;
}
public Grid copy() {
Grid ng = cloneWithProperties();
ng.surface = surface.copy();
return ng;
}
public void floatScale(Grid g) {
if (g.getSize() != getSize()) {
throw new IllegalArgumentException("not equal gridding added: " + getSize() + " + " + g.getSize());
}
long size = getSize();
float[] faciend = (float[])getSurface().getStorage();
float[] factor = (float[])g.getSurface().getStorage();
for (int i = 0; i < size; ++i) {
faciend[i] *= factor[i];
}
}
public void floatPlusWithFactor(Grid g, Grid factor) {
if (g.getSize() != getSize()) {
throw new IllegalArgumentException("not equal gridding added: " + getSize() + " + " + g.getSize());
}
float[] addend = (float[])g.getSurface().getStorage();
float[] augend = (float[])g.getSurface().getStorage();
float[] f = (float[])g.getSurface().getStorage();
int size = addend.length;
for (int i = 0; i < size; ++i) {
augend[i] += addend[i] * f[i];
}
}
public void floatPlus(Grid g) {
if (g.getSize() != getSize()) {
throw new IllegalArgumentException("not equal gridding added: " + getSize() + " + " + g.getSize());
}
long size = getSize();
float[] addend = (float[])g.getSurface().getStorage();
float[] augend = (float[])surface.getStorage();
for (int i = 0; i < size; ++i) {
augend[i] += addend[i];
}
}
public void floatScale(float f) {
long size = getSize();
float[] array = (float[])surface.getStorage();
for (int i = 0; i < size; ++i) {
array[i] *= f;
}
}
public void floatScale2(Grid baseFactor, Grid targetFactor) {
if (getSize() != baseFactor.getSize())
throw new IllegalArgumentException("not equal grid added (base): " + getSize() + " + " + baseFactor.getSize());
if (getSize() != targetFactor.getSize())
throw new IllegalArgumentException("not equal grid added (target): " + getSize() + " + " + targetFactor.getSize());
int size = (int)getSize();
float[] cur = (float[])getSurface().getStorage();
float[] base = (float[])baseFactor.getSurface().getStorage();
float[] target = (float[])targetFactor.getSurface().getStorage();
for (int i = 0; i < size; ++i) {
if (base[i] == 0)
continue;
if (target[i] == 0) {
cur[i] = 0;
continue;
}
cur[i] = cur[i] * target[i] / base[i];
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3193fe9fb5bba469ac97e46350cc8a6aad68792b | 5d4335750ba6f773fbc2ae341698a8e68863c04a | /app/src/main/java/com/example/dicoding/PresidentData.java | cbe9cefd92421ee2b3e84fcf2a509c6d87d05277 | [] | no_license | bagus8787/android-studio | 80ed85efdd3ba7da40f1b575fb455519c28b9fc8 | 2fa4fefb1dffcd71dba3eef4ccc256990c451eb0 | refs/heads/master | 2020-05-18T04:43:03.519492 | 2019-04-30T05:13:23 | 2019-04-30T05:13:23 | 184,182,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package com.example.dicoding;
import java.util.ArrayList;
public class PresidentData {
public static String[][] data = new String[][]{
{"Soekarno", "Presiden Pertama RI", "https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Presiden_Sukarno.jpg/418px-Presiden_Sukarno.jpg"
},
{"Soeharto", "Presiden Kedua RI", "https://upload.wikimedia.org/wikipedia/commons/thumb/5/59/President_Suharto%2C_1993.jpg/418px-President_Suharto%2C_1993.jpg"
}
};
public static ArrayList<President> getListData(){
President president = null;
ArrayList<President> list = new ArrayList<>();
for (int i = 0; i <data.length; i++){
president = new President();
president.setName(data[i] [0]);
president.setRemarks(data[i][1]);
president.setPhoto(data[i][2]);
list.add(president);
}
return list;
}
}
| [
"bagusbagus2733@gmail.com"
] | bagusbagus2733@gmail.com |
1fcf699b14cd9755433974c991734208df0e9a81 | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/protocal/c/bpj.java | 383da6118f644e53bb604bf2e1f7d18cff6a6653 | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 2,234 | java | package com.tencent.mm.protocal.c;
import e.a.a.b;
import e.a.a.c.a;
import java.util.LinkedList;
public final class bpj extends bdf {
protected final int a(int i, Object... objArr) {
if (i == 0) {
a aVar = (a) objArr[0];
if (this.wJr == null) {
throw new b("Not all required fields were included: BaseResponse");
} else if (this.wJr == null) {
return 0;
} else {
aVar.fW(1, this.wJr.bke());
this.wJr.a(aVar);
return 0;
}
} else if (i == 1) {
if (this.wJr != null) {
r0 = e.a.a.a.fT(1, this.wJr.bke()) + 0;
} else {
r0 = 0;
}
return r0;
} else if (i == 2) {
e.a.a.a.a aVar2 = new e.a.a.a.a((byte[]) objArr[0], unknownTagHandler);
for (r0 = bdf.a(aVar2); r0 > 0; r0 = bdf.a(aVar2)) {
if (!super.a(aVar2, this, r0)) {
aVar2.cJE();
}
}
if (this.wJr != null) {
return 0;
}
throw new b("Not all required fields were included: BaseResponse");
} else if (i != 3) {
return -1;
} else {
e.a.a.a.a aVar3 = (e.a.a.a.a) objArr[0];
bpj com_tencent_mm_protocal_c_bpj = (bpj) objArr[1];
int intValue = ((Integer) objArr[2]).intValue();
switch (intValue) {
case 1:
LinkedList Jl = aVar3.Jl(intValue);
int size = Jl.size();
for (intValue = 0; intValue < size; intValue++) {
byte[] bArr = (byte[]) Jl.get(intValue);
com.tencent.mm.bq.a feVar = new fe();
e.a.a.a.a aVar4 = new e.a.a.a.a(bArr, unknownTagHandler);
for (boolean z = true; z; z = feVar.a(aVar4, feVar, bdf.a(aVar4))) {
}
com_tencent_mm_protocal_c_bpj.wJr = feVar;
}
return 0;
default:
return -1;
}
}
}
}
| [
"malin.myemail@163.com"
] | malin.myemail@163.com |
e4fd1e358be319c1916c371f584c1fdf8bdf7aad | d17bb0b755565904198481050a141c2d4f3a22be | /src/test/java/uk/gov/dwp/health/esao/verified/integration/cucumber/CucumberStepdefs.java | 4d444a35ed61353d405dcfdb28fa312e340c2325 | [
"MIT"
] | permissive | uk-gov-mirror/dwp.ms-robotics-drs-controller | 08705a0135cf1b635cf4dc182dac3d9e2edeb90c | 29784264ef8e7d9bb5e4835ce693a99c26f0facf | refs/heads/main | 2023-03-12T20:30:59.728130 | 2021-03-03T13:45:18 | 2021-03-03T13:45:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,521 | java | package uk.gov.dwp.health.esao.verified.integration.cucumber;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.sns.model.MessageAttributeValue;
import com.amazonaws.services.sqs.model.Message;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.junit.Rule;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.gov.dwp.health.crypto.CryptoConfig;
import uk.gov.dwp.health.crypto.CryptoDataManager;
import uk.gov.dwp.health.crypto.CryptoMessage;
import uk.gov.dwp.health.crypto.exception.CryptoException;
import uk.gov.dwp.health.esao.verified.items.ClaimReferenceItem;
import uk.gov.dwp.health.messageq.EventConstants;
import uk.gov.dwp.health.messageq.amazon.items.AmazonConfigBase;
import uk.gov.dwp.health.messageq.amazon.items.messages.SnsMessageClassItem;
import uk.gov.dwp.health.messageq.amazon.utils.AmazonQueueUtilities;
import uk.gov.dwp.health.messageq.items.event.MetaData;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public class CucumberStepdefs {
private static final Logger LOG = LoggerFactory.getLogger(CucumberStepdefs.class.getName());
private static final String VALID_INPUT_JSON = "{\"claim_ref\":\"%s\"}";
private HttpClient httpClient;
private HttpResponse response;
private String jsonResponse;
private AmazonQueueUtilities queueUtilities;
private CryptoDataManager awsKmsCryptoClass;
private List<Message> messageList;
private static final String LOCALSTACK_CONTAINER_HOST = "http://localstack";
@Rule
public WireMockRule caseServiceMock = new WireMockRule(wireMockConfig().port(3010));
@Before
public void setup() throws CryptoException {
// create local properties to negate KMS & SQS from needing to access Metadata Service for IAM role privs
System.setProperty("aws.accessKeyId", "this_is_my_system_property_key");
System.setProperty("aws.secretKey", "abcd123456789");
AmazonConfigBase snsConfig = new AmazonConfigBase();
snsConfig.setEndpointOverride(LOCALSTACK_CONTAINER_HOST + ":4575");
snsConfig.setPathStyleAccessEnabled(true);
snsConfig.setS3BucketName(null);
snsConfig.setRegion(Regions.US_EAST_1);
AmazonConfigBase sqsConfig = new AmazonConfigBase();
sqsConfig.setEndpointOverride(LOCALSTACK_CONTAINER_HOST + ":4576");
sqsConfig.setPathStyleAccessEnabled(true);
sqsConfig.setS3BucketName(null);
sqsConfig.setRegion(Regions.US_EAST_1);
queueUtilities = new AmazonQueueUtilities(sqsConfig, snsConfig);
CryptoConfig cryptoConfig = new CryptoConfig("alias/test_request_id");
cryptoConfig.setKmsEndpointOverride(LOCALSTACK_CONTAINER_HOST + ":4599");
awsKmsCryptoClass = new CryptoDataManager(cryptoConfig);
httpClient = HttpClientBuilder.create().build();
caseServiceMock.start();
}
@After
public void tearDown() {
caseServiceMock.stop();
}
@Given("^I POST claim reference \"([^\"]*)\" to \"([^\"]*)\"$")
public void iPOSTClaimReferenceTo(String claimRef, String endpoint) throws IOException {
performHttpPostWithUriOf(endpoint, String.format(VALID_INPUT_JSON, claimRef));
}
private void performHttpPostWithUriOf(String uri, String body) throws IOException {
HttpPost httpUriRequest = new HttpPost(uri);
httpUriRequest.setEntity(new StringEntity(body));
response = httpClient.execute(httpUriRequest);
HttpEntity responseEntity = response.getEntity();
jsonResponse = EntityUtils.toString(responseEntity);
}
@And("^The response code is (\\d+)$")
public void theResponseCodeIs(int responseCode) {
assertThat(response.getStatusLine().getStatusCode(), is(equalTo(responseCode)));
}
@And("^The response body has claim reference \"([^\"]*)\"$")
public void theResponseBodyHasClaimReference(String claimRef) throws IOException {
JsonNode json = new ObjectMapper().readTree(jsonResponse);
assertNotNull(json);
assertThat(json.get("claim_ref").asText(), is(equalTo(claimRef)));
}
@And("^The json node \"([^\"]*)\" exists and is (ARRAY|STRING|INTEGER)?$")
public void theJsonNodeExistsAndIsAn(String nodeName, String dataType) throws IOException {
JsonNode json = new ObjectMapper().readTree(jsonResponse);
assertNotNull(json);
assertNotNull(json.get(nodeName));
if (dataType.equalsIgnoreCase("ARRAY")) {
assertTrue(json.get(nodeName).isArray());
} else if (dataType.equalsIgnoreCase("STRING")) {
assertTrue(json.get(nodeName).isTextual());
} else if (dataType.equalsIgnoreCase("INTEGER")) {
assertTrue(json.get(nodeName).isInt());
}
}
@And(
"^I stub the case service to return (\\d+) for case submission \"([^\"]*)\" with return body from file \"([^\"]*)\"$")
public void iStubTheCaseServiceSubmissionToReturnWithReturnBodyFromFile(
int returnVal, String claimRef, String returnContents) throws Throwable {
caseServiceMock.stubFor(
get(urlEqualTo(String.format("/v1/cases/%s/application", claimRef)))
.willReturn(aResponse().withStatus(returnVal).withBody(String.format(FileUtils.readFileToString(new File(returnContents)), claimRef))));
}
@And(
"^I stub the case service to return (\\d+) for case application \"([^\"]*)\" with return body from file \"([^\"]*)\"$")
public void iStubTheCaseServiceApplicationToReturnWithReturnBodyFromFile(
int returnVal, String claimRef, String returnContents) throws Throwable {
caseServiceMock.stubFor(
get(urlEqualTo(String.format("/v1/cases/%s", claimRef)))
.willReturn(aResponse().withStatus(returnVal).withBody(String.format(FileUtils.readFileToString(new File(returnContents)), claimRef))));
}
@Given("^a TOPIC has been created called \"([^\"]*)\"$")
public void thatARabbitMQTOPICExchangeHasBeenCreatedCalled(String topicName) {
queueUtilities.createTopic(topicName);
}
@Then("^a queue named \"([^\"]*)\" with visibility timeout (\\d+) is created, purged and bound to topic \"([^\"]*)\" with routing key filter policy \"([^\"]*)\"$")
public void aQueueNamedHasBeenCreatedAndBoundToWithBindingKey(String queueName, int timeout, String topicName, String routingKey) {
queueUtilities.createQueue(queueName, timeout);
queueUtilities.unsubscribeQueueFromTopic(queueName, topicName);
queueUtilities.purgeQueue(queueName);
queueUtilities.subscribeQueueToTopicWithRoutingKeyPolicy(queueName, topicName, routingKey);
}
@Given("^There are (\\d+) pending messages in queue \"([^\"]*)\"$")
public void thereArePendingMessagesInQueue(int msgCount, String queueName) throws IOException {
int msgSize = queueUtilities.receiveMessages(queueName, queueUtilities.getS3Sqs()).size();
assertThat(String.format("there should be nothing in the queue %s", queueName), msgSize, is(equalTo(msgCount)));
}
@And("^I remove the next message from \"([^\"]*)\" waiting up to (\\d+) seconds$")
public void iTakeTheNextMessageFromAndThereArePendingMessagesLeftOnTheQueue(String queueName, int seconds) throws IOException, InterruptedException {
for (int index = 0; index < (seconds * 2); index++) {
messageList = queueUtilities.receiveMessages(queueName, queueUtilities.getS3Sqs());
if (!messageList.isEmpty()) {
break;
}
TimeUnit.MILLISECONDS.sleep(500);
if ((index % 2) == 0) {
LOG.debug("waiting for message visibility after {} seconds", (index / 2));
}
}
assertNotNull("queue contents are nulL", messageList);
queueUtilities.deleteMessageFromQueue(queueName, messageList.get(0).getReceiptHandle());
}
@Then(
"^I publish the (ENCRYPTED|CLEAR-TEXT)? json for claim ref \"([^\"]*)\" to exchange \"([^\"]*)\" with routing key \"([^\"]*)\", triggerItem \"([^\"]*)\"$")
public void iPublishACONTROLLERStyleJsonPayloadToExchangeWithRoutingKey(
String encrypt, String claimRef, String topicName, String routingKey, String trigger)
throws IOException, CryptoException {
String claimRefJson = new ObjectMapper().writeValueAsString(new ClaimReferenceItem(claimRef));
publishMessageFor(encrypt, claimRefJson, topicName, routingKey, trigger);
}
private void publishMessageFor(String encrypt, String messageContents, String topicName, String routingKey, String trigger)
throws IOException, CryptoException {
MetaData metaData = new MetaData(Collections.singletonList(trigger), routingKey);
Map<String, MessageAttributeValue> mapItems = new HashMap<>();
mapItems.put(EventConstants.TRIGGERED_BY_SERIALISED_LIST, new MessageAttributeValue().withStringValue(metaData.getTriggeredBySerialised()));
mapItems.put(EventConstants.MESSAGE_CREATED_DT_STRING, new MessageAttributeValue().withStringValue(metaData.getDateCreated()));
mapItems.put(EventConstants.ROUTING_KEY_MARKER, new MessageAttributeValue().withStringValue(routingKey));
if ((encrypt != null) && (encrypt.equalsIgnoreCase("encrypted"))) {
CryptoMessage cryptoMessage = awsKmsCryptoClass.encrypt(messageContents);
mapItems.put(EventConstants.KMS_DATA_KEY_MARKER, new MessageAttributeValue().withStringValue(cryptoMessage.getKey()));
messageContents = cryptoMessage.getMessage();
}
queueUtilities.publishMessageToTopic(topicName, mapItems, "test-subject", messageContents);
}
@And(
"^The received message contains a serialised ClaimReferenceItem with claim \"([^\"]*)\" and trigger \"([^\"]*)\"$")
public void thereIsOnlyOneMessageAndItContainsASerialisedClaimReferenceItemWithClaim(
String claimRef, String trigger) throws IOException, CryptoException {
SnsMessageClassItem snsMessageClassItem = testDecodeAndReturnFirstMessageBody();
assertThat(snsMessageClassItem.getMessageAttributes().get(EventConstants.TRIGGERED_BY_SERIALISED_LIST).getStringValue(), containsString(trigger));
assertTrue(snsMessageClassItem.getMessageAttributes().containsKey(EventConstants.TRIGGERED_BY_SERIALISED_LIST));
assertTrue(snsMessageClassItem.getMessageAttributes().containsKey(EventConstants.MESSAGE_CREATED_DT_STRING));
ClaimReferenceItem item = new ObjectMapper().readValue(snsMessageClassItem.getMessage(), ClaimReferenceItem.class);
assertNotNull(item);
assertThat(item.getClaimRef(), is(equalTo(claimRef)));
}
@And(
"^The received message is a DRS formatted case record with claim \"([^\"]*)\" and trigger \"([^\"]*)\"$")
public void thereIsOnlyOneMessageAndItContainsASerialisedDrsRecordWithClaim(
String claimRef, String trigger) throws IOException, CryptoException {
SnsMessageClassItem snsMessageClassItem = testDecodeAndReturnFirstMessageBody();
assertThat(snsMessageClassItem.getMessageAttributes().get(EventConstants.TRIGGERED_BY_SERIALISED_LIST).getStringValue(), containsString(trigger));
assertTrue(snsMessageClassItem.getMessageAttributes().containsKey(EventConstants.TRIGGERED_BY_SERIALISED_LIST));
assertTrue(snsMessageClassItem.getMessageAttributes().containsKey(EventConstants.MESSAGE_CREATED_DT_STRING));
JsonNode jsonNode = new ObjectMapper().readTree(snsMessageClassItem.getMessage());
assertTrue(jsonNode.get("metadata").isObject());
assertTrue(jsonNode.get("payload").isObject());
assertThat(jsonNode.get("metadata").get("claimRef").asText(), is(equalTo(claimRef)));
}
private SnsMessageClassItem testDecodeAndReturnFirstMessageBody()
throws IOException, CryptoException {
assertNotNull(messageList);
assertThat(messageList.size(), is(equalTo(1)));
assertNotNull(messageList.get(0));
SnsMessageClassItem snsMessageClass = new SnsMessageClassItem().buildMessageClassItem(messageList.get(0).getBody());
String msgContents = snsMessageClass.getMessage();
if (snsMessageClass.getMessageAttributes().get(EventConstants.KMS_DATA_KEY_MARKER) != null) {
CryptoMessage cryptoMessage = new CryptoMessage();
cryptoMessage.setKey(snsMessageClass.getMessageAttributes().get(EventConstants.KMS_DATA_KEY_MARKER).getStringValue());
cryptoMessage.setMessage(snsMessageClass.getMessage());
msgContents = awsKmsCryptoClass.decrypt(cryptoMessage);
}
snsMessageClass.setMessage(msgContents);
return snsMessageClass;
}
}
| [
"ef9823b80fb537aa52bd5de74e035b5c0e883f16"
] | ef9823b80fb537aa52bd5de74e035b5c0e883f16 |
99735a5675b00096dd0ec541923ad8e9af5a4981 | 2bdb52ddba36fcd1f8e6c1e0c928ed9cc3b58f8e | /gzzhwl/.svn/pristine/99/99735a5675b00096dd0ec541923ad8e9af5a4981.svn-base | 3ae905828d0f191dfdddab98a2cd2cc15c44644c | [] | no_license | tongcrane/gzzhwl | 844ba46bb1a05651ca099d819b0c83a3280f688c | 518aee3a8713c298897dd65910662fd771810109 | refs/heads/master | 2020-06-21T04:14:01.487055 | 2016-11-26T15:49:39 | 2016-11-26T15:49:39 | 74,811,586 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 512 | package com.gzzhwl.core.data.dao;
import java.util.List;
import java.util.Map;
import com.gzzhwl.core.data.model.PushDevice;
import com.gzzhwl.core.data.model.PushInfo;
/**
* 数据访问接口
*
*/
public interface PushInfoDao {
public final static String PREFIX = PushInfoDao.class.getName();
public <T, K, V> List<T> find(Map<String, Object> params);
public int insert(PushInfo pushInfo);
public int updateSelective(PushInfo pushInfo);
public int delInfoByToken(Map<String, Object> params);
}
| [
"root@localhost.localdomain"
] | root@localhost.localdomain | |
9d2d64507b4d5562f5adb96f9d113103185953a0 | e8364cd7471a423816451b769942d4d294787626 | /src/main/java/com/lulan/shincolle/entity/hostile/EntityRensouhouBoss.java | 6b666bf433ccb361169b28073f649a56777f81b0 | [] | no_license | IamAchang/ShinColle | 07fda02ead1e29f8aa104c893b1bae10a12ccb37 | 6eb64409f3d1c898579859213eb7863ddd74b5c1 | refs/heads/master | 2021-01-21T19:01:29.136866 | 2015-06-18T10:42:02 | 2015-06-18T10:42:02 | 37,653,597 | 0 | 0 | null | 2015-06-18T10:40:40 | 2015-06-18T10:40:40 | null | BIG5 | Java | false | false | 21,094 | java | package com.lulan.shincolle.entity.hostile;
import java.util.List;
import com.lulan.shincolle.ai.EntityAIShipRangeAttack;
import com.lulan.shincolle.ai.path.ShipMoveHelper;
import com.lulan.shincolle.ai.path.ShipPathEntity;
import com.lulan.shincolle.ai.path.ShipPathNavigate;
import com.lulan.shincolle.ai.path.ShipPathPoint;
import com.lulan.shincolle.entity.IShipAttackBase;
import com.lulan.shincolle.entity.IShipCannonAttack;
import com.lulan.shincolle.entity.other.EntityAbyssMissile;
import com.lulan.shincolle.handler.ConfigHandler;
import com.lulan.shincolle.network.S2CEntitySync;
import com.lulan.shincolle.network.S2CSpawnParticle;
import com.lulan.shincolle.proxy.CommonProxy;
import com.lulan.shincolle.reference.ID;
import com.lulan.shincolle.reference.Reference;
import com.lulan.shincolle.utility.EntityHelper;
import com.lulan.shincolle.utility.ParticleHelper;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityRensouhouBoss extends EntityMob implements IShipCannonAttack {
protected IShipAttackBase host; //host target
protected EntityLivingBase host2;
protected EntityLivingBase target; //onImpact target (for entity)
protected World world;
protected ShipPathNavigate shipNavigator; //水空移動用navigator
protected ShipMoveHelper shipMoveHelper;
//attributes
protected float atk; //damage
protected float atkSpeed; //attack speed
protected float atkRange; //attack range
protected float defValue; //def value
protected float movSpeed; //def value
protected float kbValue; //knockback value
//AI flag
protected int numAmmoLight;
protected int numAmmoHeavy;
//model display
/**EntityState: 0:HP State 1:Emotion 2:Emotion2*/
protected byte StateEmotion; //表情1
protected byte StateEmotion2; //表情2
protected int StartEmotion; //表情1 開始時間
protected int StartEmotion2; //表情2 開始時間
protected boolean headTilt;
public EntityRensouhouBoss(World world) {
super(world);
this.setSize(0.9F, 1.7F);
this.isImmuneToFire = true;
}
public EntityRensouhouBoss(World world, IShipAttackBase host, EntityLivingBase target) {
super(world);
this.world = world;
this.host = host;
this.host2 = (EntityLivingBase) host;
this.target = target;
this.isImmuneToFire = true;
shipNavigator = new ShipPathNavigate(this, worldObj);
shipMoveHelper = new ShipMoveHelper(this);
//basic attr
this.atk = 30F;
this.atkSpeed = 0.8F;
this.atkRange = host.getAttackRange();
this.defValue = host.getDefValue() * 0.5F;
this.movSpeed = 0.6F;
//AI flag
this.numAmmoLight = 6;
this.numAmmoHeavy = 0;
this.StateEmotion = 0;
this.StateEmotion2 = 0;
this.StartEmotion = 0;
this.StartEmotion2 = 0;
this.headTilt = false;
//設定發射位置
this.posX = host2.posX + rand.nextDouble() * 6D - 3D;
this.posY = host2.posY + 0.5D;
this.posZ = host2.posZ + rand.nextDouble() * 6D - 3D;
//check the place is safe to summon
if(!EntityHelper.checkBlockSafe(world, (int)posX, (int)posY, (int)posZ)) {
this.posX = host2.posX;
this.posY = host2.posY;
this.posZ = host2.posZ;
}
this.setPosition(this.posX, this.posY, this.posZ);
//設定基本屬性
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D);
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.movSpeed);
getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(this.atkRange + 32); //此為找目標, 路徑的範圍
getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.2D);
if(this.getHealth() < this.getMaxHealth()) this.setHealth(this.getMaxHealth());
//設定AI
this.setAIList();
}
@Override
public float getEyeHeight() {
return this.height;
}
//setup AI
protected void setAIList() {
this.clearAITasks();
this.clearAITargetTasks();
this.getNavigator().setEnterDoors(true);
this.getNavigator().setAvoidsWater(false);
this.getNavigator().setCanSwim(true);
this.tasks.addTask(1, new EntityAIShipRangeAttack(this));
this.setAttackTarget(target);
}
@Override
public boolean attackEntityFrom(DamageSource attacker, float atk) {
//disable
if(attacker.getDamageType() == "inWall") {
return false;
}
//set hurt face
if(this.getStateEmotion(ID.S.Emotion) != ID.Emotion.O_O) {
this.setStateEmotion(ID.S.Emotion, ID.Emotion.O_O, true);
}
//進行def計算
float reduceAtk = atk * (1F - this.defValue / 100F);
if(atk < 0) { atk = 0; }
//無敵的entity傷害無效
if(this.isEntityInvulnerable()) {
return false;
}
if(attacker.getSourceOfDamage() != null) {
Entity entity = attacker.getSourceOfDamage();
//不會對自己造成傷害
if(entity.equals(this)) {
return false;
}
//若掉到世界外, 則直接使該entity消失
if(attacker.getDamageType().equals("outOfWorld")) {
this.setDead();
return false;
}
}
return super.attackEntityFrom(attacker, reduceAtk);
}
@Override
public void onUpdate() {
super.onUpdate();
//client side
if(this.worldObj.isRemote) {
//有移動時, 產生水花特效
//(注意此entity因為設為非高速更新, client端不會更新motionX等數值, 需自行計算)
double motX = this.posX - this.prevPosX;
double motZ = this.posZ - this.prevPosZ;
double parH = this.posY - (int)this.posY;
if(motX != 0 || motZ != 0) {
ParticleHelper.spawnAttackParticleAt(this.posX + motX*1.5D, this.posY, this.posZ + motZ*1.5D,
-motX*0.5D, 0D, -motZ*0.5D, (byte)15);
}
}
//server side
else {
boolean setdead = false;
//owner消失(通常是server restart)
if(this.getOwner() == null) {
setdead = true;
}
else {
//超過60秒自動消失
if(this.ticksExisted > 1200) {
setdead = true;
}
//target is dead
if(this.getAttackTarget() == null || this.getAttackTarget().isDead) {
//change target
if(this.host != null && this.host.getTarget() != null &&
this.host.getTarget().isEntityAlive()) {
this.target = this.host.getTarget();
}
else {
setdead = true;
}
}
//防止溺死
if(this.isInWater() && this.ticksExisted % 100 == 0) {
this.setAir(300);
}
}
//is done
if(setdead) {
this.setDead();
}
}
}
@Override
public byte getStateEmotion(int id) {
return id == 1 ? StateEmotion : StateEmotion2;
}
@Override
public void setStateEmotion(int id, int value, boolean sync) {
switch(id) {
case 1:
StateEmotion = (byte) value;
break;
case 2:
StateEmotion2 = (byte) value;
break;
default:
break;
}
if(sync && !worldObj.isRemote) {
TargetPoint point = new TargetPoint(this.dimension, this.posX, this.posY, this.posZ, 32D);
CommonProxy.channelE.sendToAllAround(new S2CEntitySync(this, 4), point);
}
}
@Override
public boolean getStateFlag(int flag) { //hostile mob: for attack and headTile check
switch(flag) {
default:
return true;
case ID.F.HeadTilt:
return this.headTilt;
case ID.F.OnSightChase:
return false;
}
}
@Override
public void setStateFlag(int id, boolean flag) {
this.headTilt = flag;
}
@Override
public int getStartEmotion() {
return this.StartEmotion;
}
@Override
public int getStartEmotion2() {
return this.StartEmotion2;
}
@Override
public void setStartEmotion(int par1) {
this.StartEmotion = par1;
}
@Override
public void setStartEmotion2(int par1) {
this.StartEmotion2 = par1;
}
@Override
public int getTickExisted() {
return this.ticksExisted;
}
@Override
public int getAttackTime() {
return this.attackTime;
}
@Override
public boolean isAIEnabled() {
return true;
}
//clear AI
protected void clearAITasks() {
tasks.taskEntries.clear();
}
//clear target AI
protected void clearAITargetTasks() {
targetTasks.taskEntries.clear();
}
@Override
public EntityLivingBase getOwner() {
return this.host2;
}
@Override
public EntityLivingBase getAttackTarget() {
return this.target;
}
@Override
//light attack
public boolean attackEntityWithAmmo(Entity target) {
float atkLight = this.atk;
float kbValue = 0.001F;
//play cannon fire sound at attacker
playSound(Reference.MOD_ID+":ship-firesmall", ConfigHandler.fireVolume, 0.7F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
//此方法比getLook還正確 (client sync問題)
float distX = (float) (target.posX - this.posX);
float distY = (float) (target.posY - this.posY);
float distZ = (float) (target.posZ - this.posZ);
float distSqrt = MathHelper.sqrt_float(distX*distX + distY*distY + distZ*distZ);
distX = distX / distSqrt;
distY = distY / distSqrt;
distZ = distZ / distSqrt;
//發射者煙霧特效
TargetPoint point0 = new TargetPoint(this.dimension, this.posX, this.posY, this.posZ, 64D);
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this, 6, this.posX, this.posY+1.5D, this.posZ, distX, distY, distZ, true), point0);
//calc miss chance, if not miss, calc cri/multi hit
TargetPoint point = new TargetPoint(this.dimension, this.host2.posX, this.host2.posY, this.host2.posZ, 64D);
float missChance = 0.25F;
//calc miss chance
if(this.rand.nextFloat() < missChance) {
atkLight = 0; //still attack, but no damage
//spawn miss particle
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this.host2, 10, false), point);
}
else {
//roll cri -> roll double hit -> roll triple hit (triple hit more rare)
//calc critical
if(this.rand.nextFloat() < 0.1F) {
atkLight *= 1.5F;
//spawn critical particle
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this.host2, 11, false), point);
}
else {
//calc double hit
if(this.rand.nextFloat() < 0.1F) {
atkLight *= 2F;
//spawn double hit particle
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this.host2, 12, false), point);
}
else {
//calc double hit
if(this.rand.nextFloat() < 0.1F) {
atkLight *= 3F;
//spawn triple hit particle
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this.host2, 13, false), point);
}
}
}
}
//vs player = 25% dmg
if(target instanceof EntityPlayer) {
atkLight *= 0.25F;
//check friendly fire
if(!ConfigHandler.friendlyFire) {
atkLight = 0F;
}
else if(atkLight > 59F) {
atkLight = 59F; //same with TNT
}
}
//將atk跟attacker傳給目標的attackEntityFrom方法, 在目標class中計算傷害
//並且回傳是否成功傷害到目標
boolean isTargetHurt = target.attackEntityFrom(DamageSource.causeMobDamage(this).setProjectile(), atkLight);
//if attack success
if(isTargetHurt) {
//calc kb effect
if(kbValue > 0) {
target.addVelocity((double)(-MathHelper.sin(rotationYaw * (float)Math.PI / 180.0F) * kbValue),
0.02D, (double)(MathHelper.cos(rotationYaw * (float)Math.PI / 180.0F) * kbValue));
}
//display hit particle on target
TargetPoint point1 = new TargetPoint(this.dimension, target.posX, target.posY, target.posZ, 64D);
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(target, 9, false), point1);
}
//消耗彈藥計算
if(numAmmoLight > 0) {
numAmmoLight--;
if(numAmmoLight <= 0) {
this.setDead();
}
}
return isTargetHurt;
}
@Override
public boolean attackEntityWithHeavyAmmo(Entity target) {
//get attack value
float atkHeavy = this.atk;
//set knockback value (testing)
float kbValue = 0.08F;
//play cannon fire sound at attacker
this.playSound(Reference.MOD_ID+":ship-fireheavy", ConfigHandler.fireVolume, 0.7F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
//飛彈是否採用直射
boolean isDirect = false;
//計算目標距離
float tarX = (float)target.posX; //for miss chance calc
float tarY = (float)target.posY;
float tarZ = (float)target.posZ;
float distX = tarX - (float)this.posX;
float distY = tarY - (float)this.posY;
float distZ = tarZ - (float)this.posZ;
float distSqrt = MathHelper.sqrt_float(distX*distX + distY*distY + distZ*distZ);
float launchPos = (float)posY + height * 0.7F;
//超過一定距離/水中 , 則採用拋物線, 在水中時發射高度較低
if((distX*distX+distY*distY+distZ*distZ) < 36F) {
isDirect = true;
}
if(this.isInWater()) {
isDirect = true;
launchPos = (float)posY;
}
//calc miss chance, miss: add random offset(0~6) to missile target
float missChance = 0.25F; //max miss chance = 30%
//calc miss chance
if(this.rand.nextFloat() < missChance) {
atkHeavy = 0; //still attack, but no damage
//spawn miss particle
TargetPoint point = new TargetPoint(this.dimension, this.host2.posX, this.host2.posY, this.host2.posZ, 64D);
CommonProxy.channelP.sendToAllAround(new S2CSpawnParticle(this.host2, 10, false), point);
}
//spawn missile
EntityAbyssMissile missile = new EntityAbyssMissile(this.worldObj, this,
tarX, tarY+target.height*0.2F, tarZ, launchPos, atkHeavy, kbValue, isDirect, -1F);
this.worldObj.spawnEntityInWorld(missile);
//消耗彈藥計算
if(numAmmoHeavy > 0) {
numAmmoHeavy--;
if(numAmmoHeavy <= 0) {
this.setDead();
}
}
return true;
}
//水中跟岩漿中不會下沉
@Override
public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_) {
double d0;
if(this.isInWater() || this.handleLavaMovement()) {
this.moveFlying(p_70612_1_, p_70612_2_, 0.04F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8D;
this.motionY *= 0.8D;
this.motionZ *= 0.8D;
}
else {
float f2 = 0.91F;
if (this.onGround)
{
f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F;
}
float f3 = 0.16277136F / (f2 * f2 * f2);
float f4;
if (this.onGround)
{
f4 = this.getAIMoveSpeed() * f3;
}
else
{
f4 = this.jumpMovementFactor;
}
this.moveFlying(p_70612_1_, p_70612_2_, f4);
f2 = 0.91F;
if (this.onGround)
{
f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F;
}
if (this.isOnLadder())
{
float f5 = 0.15F;
if (this.motionX < (double)(-f5))
{
this.motionX = (double)(-f5);
}
if (this.motionX > (double)f5)
{
this.motionX = (double)f5;
}
if (this.motionZ < (double)(-f5))
{
this.motionZ = (double)(-f5);
}
if (this.motionZ > (double)f5)
{
this.motionZ = (double)f5;
}
this.fallDistance = 0.0F;
if (this.motionY < -0.15D)
{
this.motionY = -0.15D;
}
boolean flag = this.isSneaking();
if (flag && this.motionY < 0.0D)
{
this.motionY = 0.0D;
}
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.isCollidedHorizontally && this.isOnLadder())
{
this.motionY = 0.2D;
}
if (this.worldObj.isRemote && (!this.worldObj.blockExists((int)this.posX, 0, (int)this.posZ) || !this.worldObj.getChunkFromBlockCoords((int)this.posX, (int)this.posZ).isChunkLoaded))
{
if (this.posY > 0.0D)
{
this.motionY = -0.1D;
}
else
{
this.motionY = 0.0D;
}
}
else
{
this.motionY -= 0.08D;
}
this.motionY *= 0.9800000190734863D;
this.motionX *= (double)f2;
this.motionZ *= (double)f2;
}
this.prevLimbSwingAmount = this.limbSwingAmount;
d0 = this.posX - this.prevPosX;
double d1 = this.posZ - this.prevPosZ;
float f6 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;
if (f6 > 1.0F)
{
f6 = 1.0F;
}
this.limbSwingAmount += (f6 - this.limbSwingAmount) * 0.4F;
this.limbSwing += this.limbSwingAmount;
}
@Override
public float getAttackSpeed() {
return this.atkSpeed;
}
@Override
public float getAttackRange() {
return this.atkRange;
}
@Override
public float getMoveSpeed() {
return this.movSpeed;
}
@Override
public int getAmmoLight() {
return this.numAmmoLight;
}
@Override
public int getAmmoHeavy() {
return this.numAmmoHeavy;
}
@Override
public boolean hasAmmoLight() {
return this.numAmmoLight > 0;
}
@Override
public boolean hasAmmoHeavy() {
return false;
}
@Override
public void setAmmoLight(int num) {
this.numAmmoLight = num;
}
@Override
public void setAmmoHeavy(int num) {
this.numAmmoHeavy = num;
}
@Override
public float getAttackDamage() { //not used for rensouhou
return 0;
}
@Override
public EntityLivingBase getTarget() {
return this.getAttackTarget();
}
@Override
public boolean getIsRiding() {
return false;
}
@Override
public boolean getIsSprinting() {
return false;
}
@Override
public boolean getIsSitting() {
return false;
}
@Override
public boolean getIsSneaking() {
return false;
}
@Override
public ShipPathNavigate getShipNavigate() {
return this.shipNavigator;
}
@Override
public ShipMoveHelper getShipMoveHelper() {
return this.shipMoveHelper;
}
//update ship move helper
@Override
protected void updateAITasks() {
super.updateAITasks();
EntityHelper.updateShipNavigator(this);
}
@Override
public boolean canFly() {
return false;
}
@Override
public boolean canBreatheUnderwater() {
return true;
}
@Override
public boolean getIsLeashed() {
return false;
}
@Override
public int getLevel() {
return 150;
}
@Override
public boolean useAmmoLight() {
return true;
}
@Override
public boolean useAmmoHeavy() {
return false;
}
@Override
public EntityLivingBase getPlayerOwner() {
return this.host2;
}
@Override
public int getStateMinor(int id) {
return 0;
}
@Override
public void setStateMinor(int state, int par1) {}
@Override
public float getEffectEquip(int id) {
return 0.15F;
}
@Override
public float getDefValue() {
return defValue;
}
@Override
public void setEntitySit() {}
@Override
public float getModelRotate(int par1) {
return 0F;
}
@Override
public void setModelRotate(int par1, float par2) {}
}
| [
"zec_tails@yahoo.com.tw"
] | zec_tails@yahoo.com.tw |
8fe1e339d978453d71711cbaff5f8b37731b55af | 30eff8bef16492763e316de2076a65a4e412936a | /src/test/java/com/endava/cats/fuzzer/headers/TrailingSpacesInHeadersFuzzerTest.java | 26d4e884d9673a79a74bf23fb2daebfcf14d9197 | [
"Apache-2.0"
] | permissive | cailyoung/cats | 50987299e8fe87d4398c84691632379785917a95 | 16a7dbbe9f138f8af9fd18dc7dcfcf7a90475720 | refs/heads/master | 2023-04-18T13:45:48.935039 | 2020-12-08T19:18:18 | 2020-12-08T19:18:18 | 326,838,742 | 0 | 0 | Apache-2.0 | 2021-05-06T06:06:48 | 2021-01-05T00:06:49 | null | UTF-8 | Java | false | false | 1,442 | java | package com.endava.cats.fuzzer.headers;
import com.endava.cats.io.ServiceCaller;
import com.endava.cats.model.FuzzingStrategy;
import com.endava.cats.report.TestCaseListener;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
class TrailingSpacesInHeadersFuzzerTest {
@Mock
private ServiceCaller serviceCaller;
@Mock
private TestCaseListener testCaseListener;
private TrailingSpacesInHeadersFuzzer trailingSpacesInHeadersFuzzer;
@BeforeEach
void setup() {
trailingSpacesInHeadersFuzzer = new TrailingSpacesInHeadersFuzzer(serviceCaller, testCaseListener);
}
@Test
void givenANewTrailingSpacesInHeadersFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheTrailingSpacesInHeadersFuzzer() {
Assertions.assertThat(trailingSpacesInHeadersFuzzer.description()).isNotNull();
Assertions.assertThat(trailingSpacesInHeadersFuzzer.typeOfDataSentToTheService()).isNotNull();
Assertions.assertThat(trailingSpacesInHeadersFuzzer.fuzzStrategy().name()).isEqualTo(FuzzingStrategy.trail().name());
Assertions.assertThat(trailingSpacesInHeadersFuzzer.fuzzStrategy().getData()).isEqualTo(" ");
}
}
| [
"madalin.ilie@endava.com"
] | madalin.ilie@endava.com |
18d7efff1cd6f68ee576599d016a4dba8a8727c0 | 7362d2870595eece8f663f44ba861a0f0ae16fdc | /Lookation/src/com/lookation/controller/AdminLoginFormController.java | d3a201f6f2b703f1a534ff315182137a4584ce11 | [] | no_license | Rezalog/Spring_Project | 48e5d41cae6ffb8f4c77c27911b02ed4aca21d79 | 46df0c9e0ede3385fdef7e6291ae6b5e88ea52c2 | refs/heads/main | 2023-03-14T15:57:34.008156 | 2021-03-08T14:34:47 | 2021-03-08T14:34:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | /*========================================
# AdminLoginFormController
=======================================*/
package com.lookation.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
//※ Spring 이 제공하는 『Controller』 인터페이스를 구현함으로써
//사용자 정의 컨트롤러 클래스를 구성한다.
public class AdminLoginFormController implements Controller
{
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception
{
ModelAndView mav = new ModelAndView();
mav.setViewName("../WEB-INF/views/admin/loginFormAdmin.jsp");
return mav;
}
}
| [
"ahj32@hanmail.net"
] | ahj32@hanmail.net |
40353c53ab79c06bf69f90f5dcc7eb600277ea10 | 6fe8a54fd666170f5c882e3f997130eede0e8321 | /src/main/java/by/bookstore/web/servlet/book/FilterServlet.java | f5e63a0182e7c3aec93e55ebd17d3bac6b621993 | [] | no_license | Anya1107/bookstore-servlet | 0815c4d2673db3e502e3104f9df88728ee18f3bd | 19a1fcb03c6f877ef9258054b5e427beadeb8703 | refs/heads/main | 2023-02-25T13:53:17.993159 | 2021-01-25T18:40:24 | 2021-01-25T18:40:24 | 332,846,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,361 | java | package by.bookstore.web.servlet.book;
import by.bookstore.entity.Book;
import by.bookstore.entity.Category;
import by.bookstore.repository.inmemory.InMemoryBookRepository;
import by.bookstore.service.BookService;
import by.bookstore.service.BookServiceImpl;
import by.bookstore.service.CategoryService;
import by.bookstore.service.CategoryServiceImpl;
import by.bookstore.web.servlet.Constants;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(Constants.FILTER_BOOK_URL)
public class FilterServlet extends HttpServlet {
private BookService bookService=new BookServiceImpl(InMemoryBookRepository.getInstance());
private CategoryService categoryService = new CategoryServiceImpl();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String id = req.getParameter("id");
Category byId = categoryService.findById(Integer.parseInt(id));
Book[] byCategory = bookService.findByCategory(byId);
req.setAttribute("books", byCategory);
getServletContext().getRequestDispatcher(Constants.FILTER_BOOK_PAGE_PATH).forward(req,resp);
}
}
| [
"murzenok.anya@mail.ru"
] | murzenok.anya@mail.ru |
6cf13c2dc3af6403ade13156648532d174d2db87 | 83902c48497db67ccddb352c094bcd0433f933a4 | /src/main/java/kr/or/ddit/tag/service/TagService.java | 2e39fe78408535e82cb785e3690068bb91c22117 | [] | no_license | wjdgns88/springBoard | cd8808f4985fd61eeb292a7cbf4afa8fdf1847f0 | c5f3c95e68db7e7b674f7bfa5b114ccd9e412c8b | refs/heads/master | 2020-03-26T13:30:40.455199 | 2018-08-16T06:00:03 | 2018-08-16T06:00:03 | 144,942,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package kr.or.ddit.tag.service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import kr.or.ddit.tag.dao.TagDao;
import kr.or.ddit.tag.dao.TagDaoInf;
import kr.or.ddit.tag.model.TagVo;
@Service("tagService")
public class TagService implements TagServiceInf {
@Resource(name="tagDao")
TagDaoInf tagDao;
@Override
public List<TagVo> selectTag(int post_id) {
return tagDao.selectTag(post_id);
}
@Override
public int insertTag(TagVo tag) {
return tagDao.insertTag(tag);
}
@Override
public int deleteTag(int tag_id) {
return tagDao.deleteTag(tag_id);
}
}
| [
"wjdgns88@daum.net"
] | wjdgns88@daum.net |
1b58c15b5d459f7b2c80af3f53cc1e425a8be047 | 2a8908a16d54110d1dca214ed03830f1ad818402 | /src/main/java/com/ensa/absence/controller/ModuleController.java | f648a976cbb30e6c2182d91758bcd10fbc5971a6 | [] | no_license | nwflte/gestion-absence-backend | 4154d80b02fb8b2a2e08f1989199e48954e15ac1 | f7fb1d039f018855b7f61c800ab43b692bc8a50e | refs/heads/master | 2022-11-01T13:01:48.562031 | 2020-01-21T20:53:11 | 2020-01-21T20:53:11 | 227,430,624 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package com.ensa.absence.controller;
import com.ensa.absence.payload.CreateModuleRequest;
import com.ensa.absence.payload.ModuleResponse;
import com.ensa.absence.service.ModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/modules")
public class ModuleController {
@Autowired
private ModuleService moduleService;
@GetMapping("/professeur/{profId}")
public List<ModuleResponse> getModulesOfProf(@PathVariable(value = "profId", required = true) Long profId){
return moduleService.getModulesOfProf(profId);
}
@GetMapping
public List<ModuleResponse> getModules(){
return moduleService.getModuleResponses();
}
@PostMapping("/")
@PreAuthorize("hasRole('SCOLARITE')")
public ModuleResponse createModule(@RequestBody CreateModuleRequest request) {
return moduleService.saveModule(request);
}
}
| [
"naoufal450@gmail.com"
] | naoufal450@gmail.com |
2cfb9cb221080a6e6b6a4fc9bb21f1bfe035b89c | 7dcfe2dd33ac9a2926c60988a840c0194b2f9642 | /src/org/json/zip/Keep.java | 46c814cdddf28f76a6e6be9633a9f5e3822bc2a5 | [
"MIT"
] | permissive | ferranti/planetcrypto_bitcoin | f53106a5ec5c127778217e9b70dd8e829469b09a | 9aeed810272d871f095310b7d06d201381e84b89 | refs/heads/master | 2016-09-11T08:45:02.945797 | 2014-06-30T05:26:46 | 2014-06-30T05:26:46 | 21,340,287 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,132 | java | /*
* The MIT License
*
* Copyright 2014 Halcyon <support@planetcrypto.com A2A1A088>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.json.zip;
import java.util.HashMap;
import org.json.Kim;
/*
Copyright (c) 2013 JSON.org
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 shall be used for Good, not Evil.
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.
*/
/**
* A keep is a data structure that associates strings (or substrings) with
* numbers. This allows the sending of small integers instead of strings.
*
* @author JSON.org
* @version 2013-05-03
*/
class Keep implements None, PostMortem {
private int capacity;
protected int length;
private Object[] list;
private HashMap<Object, Integer> map;
private int power;
private long[] ticks;
public Keep(int bits) {
this.capacity = 1 << bits;
this.length = 0;
this.power = 0;
this.ticks = new long[this.capacity];
this.list = new Object[this.capacity];
this.map = new HashMap<Object, Integer>(this.capacity);
}
/**
* When an item ages, its use count is reduced by at least half.
*
* @param ticks
* The current use count of an item.
* @return The new use count for that item.
*/
public static long age(long ticks) {
return ticks >= 32 ? 16 : ticks / 2;
}
/**
* Return the number of bits required to contain an integer based on the
* current length of the keep. As the keep fills up, the number of bits
* required to identify one of its items goes up.
*/
public int bitsize() {
while (1 << this.power < this.length) {
this.power += 1;
}
return this.power;
}
/**
* Increase the usage count on an integer value.
*/
public void tick(int integer) {
this.ticks[integer] += 1;
}
/**
* Compact the keep. A keep may contain at most this.capacity elements.
* The keep contents can be reduced by deleting all elements with low use
* counts, and by reducing the use counts of the survivors.
*/
private void compact() {
int from = 0;
int to = 0;
while (from < this.capacity) {
Object key = this.list[from];
long usage = age(this.ticks[from]);
if (usage > 0) {
this.ticks[to] = usage;
this.list[to] = key;
this.map.put(key, to);
to += 1;
} else {
this.map.remove(key);
}
from += 1;
}
if (to < this.capacity) {
this.length = to;
} else {
this.map.clear();
this.length = 0;
}
this.power = 0;
}
/**
* Find the integer value associated with this key, or nothing if this key
* is not in the keep.
*
* @param key
* An object.
* @return An integer
*/
public int find(Object key) {
Object o = this.map.get(key);
return o instanceof Integer ? ((Integer) o).intValue() : none;
}
public boolean postMortem(PostMortem pm) {
Keep that = (Keep) pm;
if (this.length != that.length) {
JSONzip.log(this.length + " <> " + that.length);
return false;
}
for (int i = 0; i < this.length; i += 1) {
boolean b;
if (this.list[i] instanceof Kim) {
b = this.list[i].equals(that.list[i]);
} else {
Object o = this.list[i];
Object q = that.list[i];
if (o instanceof Number) {
o = o.toString();
}
if (q instanceof Number) {
q = q.toString();
}
b = o.equals(q);
}
if (!b) {
JSONzip.log("\n[" + i + "]\n " + this.list[i] + "\n "
+ that.list[i] + "\n " + this.ticks[i] + "\n "
+ that.ticks[i]);
return false;
}
}
return true;
}
/**
* Register a value in the keep. Compact the keep if it is full. The next
* time this value is encountered, its integer can be sent instead.
* @param value A value.
*/
public void register(Object value) {
if (JSONzip.probe) {
int integer = find(value);
if (integer >= 0) {
JSONzip.log("\nDuplicate key " + value);
}
}
if (this.length >= this.capacity) {
compact();
}
this.list[this.length] = value;
this.map.put(value, this.length);
this.ticks[this.length] = 1;
if (JSONzip.probe) {
JSONzip.log("<" + this.length + " " + value + "> ");
}
this.length += 1;
}
/**
* Return the value associated with the integer.
* @param integer The number of an item in the keep.
* @return The value.
*/
public Object value(int integer) {
return this.list[integer];
}
}
| [
"halcyon@phobos.planetcrypto.com"
] | halcyon@phobos.planetcrypto.com |
c31e4406b9d89217297a8a1beda8db1aca701eb7 | b4ab5bb09348b8cf8606d8725569f816255d43e8 | /tiendacomputo/src/main/java/usmp/computo/tiendacomputo/repository/UsuarioRepository.java | c22b50d23c3d9181f04a39bfce6cefc00f2799d6 | [] | no_license | Machiavelick/EquipoComputo | 6da7d75797a2ea52150ad9d4c35416a3f03292de | e2ee5c2b624834861c92d62f976ec44825179bff | refs/heads/main | 2023-04-19T14:32:21.159431 | 2021-05-06T18:13:38 | 2021-05-06T18:13:38 | 358,465,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package usmp.computo.tiendacomputo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import usmp.computo.tiendacomputo.domain.Usuario;
@Repository
public interface UsuarioRepository extends JpaRepository<Usuario,Integer>{
} | [
"jaimesupo@gmail.com"
] | jaimesupo@gmail.com |
b0ef3d5823fd975c366a7b3cf3f5871797b7a6f9 | 5b644e2fc7d5616364df77683c7d838f208754bd | /src/main/java/com/mitch/gamem/blocks/BoxBlock.java | 6f1b4d8258ce01e68a773c79f46e9f2c46324a5b | [] | no_license | insou22/GameM | 2168eaddd616d07691b5ad67b595cf78396d9fd8 | 55052ee8532448a29aca5914841c4311dcaec6f8 | refs/heads/master | 2020-12-24T18:22:40.852360 | 2016-05-16T00:37:24 | 2016-05-16T00:37:24 | 58,463,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package com.mitch.gamem.blocks;
import static org.fusesource.jansi.Ansi.Color.*;
import static org.fusesource.jansi.Ansi.ansi;
public class BoxBlock extends Block {
public void render(int line, boolean player) {
switch (line) {
case 1:
System.out.print(ansi().fg(YELLOW).a("┏━━━┓"));
break;
case 2:
System.out.print(ansi().fg(YELLOW).a("┃ ╳ ┃"));
break;
case 3:
System.out.print(ansi().fg(YELLOW).a("┗━━━┛"));
break;
}
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
c1ce565ff8de63d50a080392282f80a0c085a57f | 78f284cd59ae5795f0717173f50e0ebe96228e96 | /factura-negocio/src/cl/stotomas/factura/negocio/ia_20/copy2/copy/TestingHab.java | 1769dd64168f244d184e501267fa0542ba71ec54 | [] | no_license | Pattricio/Factura | ebb394e525dfebc97ee2225ffc5fca10962ff477 | eae66593ac653f85d05071b6ccb97fb1e058502d | refs/heads/master | 2020-03-16T03:08:45.822070 | 2018-05-07T15:29:25 | 2018-05-07T15:29:25 | 132,481,305 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,150 | java | package cl.stotomas.factura.negocio.ia_20.copy2.copy;
import java.util.*;
public class TestingHab {
private int id;
private String nombre;
private String apellido;
private int edad;
/**
* Constructor vacío
*/
public TestingHab()
{
id = 1;
nombre = "Edward";
apellido = "Dammus";
edad = 22;
}
/**
* Constructor con parametros
*/
public TestingHab(int id, String nombre, String apellido, int edad)
{
this.id = id;
this.nombre = nombre;
this.apellido = apellido;
setEdad(edad);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
/**
* Método que acepte que la edad debe ser mayor a 15
*/
public void edadMayor(int edad)
{
if(edad > 15)
{
System.out.println("Admitido");
}
else
{
System.out.println("Edad debe ser mayor a 15");
}
}
/**
* Método que me valide el segundo nombre
*/
public void validarNombre(String nombre)
{
StringTokenizer token = new StringTokenizer(nombre);
if(token.countTokens() == 2)
{
System.out.println("Ingresaste 2 nombres");
}else
{
System.out.println("Error");
}
}
/**
* Método que me pregunte por la edad y por el nombre
*/
public void NombreEdad(String nombre, int edad)
{
System.out.println("Cual es tu nombre y tu edad");
if(nombre.equals(nombre))
{
System.out.println("Su nombre es: " +getNombre());
}else if(edad == 13)
{
this.edad = 100; // cambia la edad a 100
System.out.println("Su edad es:" +getEdad());
}
}
/**
* Instanciar una persona
*/
public void Persona(Object o)
{
if(o.getClass() == TestingHab.class)
{
System.out.println(o);
}
}
}
| [
"Adriana Molano@DESKTOP-GQ96FK8"
] | Adriana Molano@DESKTOP-GQ96FK8 |
25b34b36ad24f0d080055d36a79122b835274594 | ef34c799560ab22c596faf7b156818aacc708df0 | /app/lib/src/main/java/com/otaliastudios/transcoder/internal/Logger.java | 5a774d1e0e11d21912bb3ce63b7b98362ec82d2e | [] | no_license | icekloud/screen_recording_payload | f9c0295e03163254b96bfad1bb00fb65168543cf | cc24bfb3890e0e3181d66ceb6d7e20fb7b46c880 | refs/heads/main | 2023-02-07T17:21:22.241717 | 2020-12-29T09:37:38 | 2020-12-29T09:37:38 | 324,109,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,651 | java | package com.otaliastudios.transcoder.internal;
import androidx.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class Logger {
public final static int LEVEL_VERBOSE = 0;
@SuppressWarnings("WeakerAccess")
public final static int LEVEL_INFO = 1;
@SuppressWarnings("WeakerAccess")
public final static int LEVEL_WARNING = 2;
@SuppressWarnings("WeakerAccess")
public final static int LEVEL_ERROR = 3;
private static int sLevel;
/**
* Interface of integers representing log levels.
* @see #LEVEL_VERBOSE
* @see #LEVEL_INFO
* @see #LEVEL_WARNING
* @see #LEVEL_ERROR
*/
@SuppressWarnings("WeakerAccess")
@IntDef({LEVEL_VERBOSE, LEVEL_INFO, LEVEL_WARNING, LEVEL_ERROR})
@Retention(RetentionPolicy.SOURCE)
public @interface LogLevel {}
private String mTag;
public Logger(@NonNull String tag) {
mTag = tag;
}
/**
* Sets the log sLevel for logcat events.
*
* @see #LEVEL_VERBOSE
* @see #LEVEL_INFO
* @see #LEVEL_WARNING
* @see #LEVEL_ERROR
* @param logLevel the desired log sLevel
*/
public static void setLogLevel(@LogLevel int logLevel) {
sLevel = logLevel;
}
private boolean should(int messageLevel) {
return sLevel <= messageLevel;
}
public void v(String message) { v(message, null); }
public void i(String message) { i(message, null); }
public void w(String message) { w(message, null); }
public void e(String message) { e(message, null); }
@SuppressWarnings("WeakerAccess")
public void v(String message, @Nullable Throwable error) {
log(LEVEL_VERBOSE, message, error);
}
public void i(String message, @Nullable Throwable error) {
log(LEVEL_INFO, message, error);
}
public void w(String message, @Nullable Throwable error) {
log(LEVEL_WARNING, message, error);
}
public void e(String message, @Nullable Throwable error) {
log(LEVEL_ERROR, message, error);
}
private void log(int level, String message, @Nullable Throwable throwable) {
if (!should(level)) return;
switch (level) {
case LEVEL_VERBOSE: Log.v(mTag, message, throwable); break;
case LEVEL_INFO: Log.i(mTag, message, throwable); break;
case LEVEL_WARNING: Log.w(mTag, message, throwable); break;
case LEVEL_ERROR: Log.e(mTag, message, throwable); break;
}
}
}
| [
"56815769+icekloud@users.noreply.github.com"
] | 56815769+icekloud@users.noreply.github.com |
89cd5c6e43aab0afe23e467b020b1eba36bd9222 | 1a07940c52d16f2071f7cf0c9c9c6ae7ef540b0c | /JAX-WSClient/src/com/nor/utils/SeleniumUtils.java | 01ad931d651d8c0f62d58a935d20b7de76791d2f | [] | no_license | prasannarhegde2015/StudyJavaSeleniumTestNG | 0027bb140f97e1ecc97b779fe98fabbca6c1be10 | d6d2d367976e90b28f8e73e256271e77bb02f7f9 | refs/heads/master | 2021-01-17T15:16:50.369319 | 2017-10-26T11:26:32 | 2017-10-26T11:26:32 | 51,161,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,307 | java | package com.nor.utils;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.NoSuchFrameException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SeleniumUtils {
public void clickElem( WebElement el,String elname)
{
try
{
el.click();
System.out.println("Element was clicked: "+elname);
}
catch(NoSuchElementException ex)
{
System.out.println("No Such Elelment exception"+ex);
}
catch(StaleElementReferenceException ex)
{
System.out.println("Stale Elelment exception"+ex);
}
catch(Exception ex)
{
System.out.println("Other Expcetion"+ex);
}
}
public void enterValue(WebElement el,String elname,String val)
{
try
{
el.clear();
el.sendKeys(val);
System.out.println("Value "+val+"set in : "+elname);
}
catch(NoSuchElementException ex)
{
System.out.println("No Such Elelment exception"+ex);
}
catch(StaleElementReferenceException ex)
{
System.out.println("Stale Elelment exception"+ex);
}
catch(Exception ex)
{
System.out.println("Other Expcetion"+ex);
}
}
public void Switchtoframe(WebDriver dr, WebElement el)
{
WebDriverWait wt = new WebDriverWait(dr, 500);
try
{
System.out.println("Sel Utils: Switch to Farme");
wt.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(el));
}
catch(NoSuchFrameException ex)
{
System.out.println("No Such Frame"+ex);
}
}
public void SwitchtoDelfault(WebDriver dr)
{
try
{
System.out.println("Sel Utils Switch to default");
dr.switchTo().defaultContent();
}
catch(Exception ex)
{
System.out.println("No Such Frame"+ex);
}
}
public void waitforPresenseofElement( WebDriver drv,final WebElement el)
{
System.out.println("Sel Utils: Wait for Elm to be present");
WebDriverWait wt = new WebDriverWait(drv, 500);
wt.until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver drv) {
try {
el.isDisplayed();
return true;
} catch (NoSuchElementException e) {
return false;
} catch(StaleElementReferenceException e)
{
return false;
}
}
});
}
public void waitforpgload(WebDriver drv) throws InterruptedException
{
String status = (String) ((JavascriptExecutor)drv).executeScript("return document.readyState");
System.out.println("** status*"+status);
if (status == null)
{
System.out.println("** status....chck*"+status);
status = "Blank";
}
while( status.equals("complete") == false)
{
status = (String) ((JavascriptExecutor)drv).executeScript("return document.readyState");
if (status == null)
{
System.out.println("** status....chck*"+status);
status = "Blank";
}
System.out.println("** Page complete "+ status);
Thread.sleep(1000);
}
System.out.println("** Out of Page Load");
}
}
| [
"prasannarhegde@gmail.com"
] | prasannarhegde@gmail.com |
e970eb0ab8199edc4ba0a512450bdb34aea1eb56 | 8ab9d0e4ccd780452399f5509d3724cc4748d1b5 | /src/ar/edu/unicen/exa/intia/imgProc/mobile/utils/AlgTransformacionUtils.java | fdb49dead87433fb7aa21a2b875e367d3ce3012c | [] | no_license | danieldaf/tesis | 1d394f7e238fffe01e7e06778f41bac3c00b31fb | 288cfcca2e263b98c37626fb175433b96203e354 | refs/heads/master | 2020-05-17T00:56:10.515958 | 2013-11-07T10:46:47 | 2013-11-07T10:46:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | package ar.edu.unicen.exa.intia.imgProc.mobile.utils;
import java.util.ArrayList;
import java.util.List;
import ar.edu.unicen.exa.intia.imgProc.mobile.dto.AlgTransformacion;
import ar.edu.unicen.exa.intia.imgProc.mobile.dto.AlgTransformacionEnum;
import ar.edu.unicen.exa.intia.imgProc.mobile.tests.ConversorClasesAnalogas;
import ar.edu.unicen.exa.intia.imgProc.mobile.tests.exceptions.InputValidationException;
import ar.edu.unicen.exa.intia.imgProc.mobile.tests.input.ImageTransformation;
public class AlgTransformacionUtils {
public static String getLabelEjeX(AlgTransformacion tx) {
if (tx.getTipo() == AlgTransformacionEnum.BRIGHTNESS)
return "Ajuste de Brillo";
else if (tx.getTipo() == AlgTransformacionEnum.GAUSSIAN_BLUR)
return "Ajuste de Foco";
else if (tx.getTipo() == AlgTransformacionEnum.ROTATION)
return "Angulo de Rotacion";
else if (tx.getTipo() == AlgTransformacionEnum.SCALING)
return "Factor de Escala";
return "";
}
public static String getLabelEjeY(AlgTransformacion tx) {
return "% Coincidencias";
}
public static List<String> getTicksEjeX(AlgTransformacion tx) {
List<String> result = new ArrayList<String>();
try {
ImageTransformation txAnalogo = ConversorClasesAnalogas.armarAlgTransformacionAnalogo(tx);
List<Double> steps = txAnalogo.getConfigArguments();
for (Double step : steps) {
result.add(""+step.doubleValue());
}
} catch (InputValidationException e) {
e.printStackTrace();
}
return result;
}
public static List<String> getTicksEjeY(AlgTransformacion tx) {
List<String> result = new ArrayList<String>();
for (double v=0; v<=100.0; v+=10.0) {
result.add(""+v);
}
return result;
}
}
| [
"daniel@monnia.sofy"
] | daniel@monnia.sofy |
566cb86fc9fc3ff823c29b43e9e7dfa2e97a174e | 7516031178fb1476a75c45fa3c744676b4caa437 | /src/main/java/com/sys/org/web/rest/SectorResource.java | a3bf8f2dbb1b549f2f0b9574a6748f47e63adcbe | [] | no_license | munubulu7/smartfca | 362b162995a6826fe5d3ffac3be4547c1b24206d | 6b8e46fb6e272f701b0bef493d9e452574cb55fe | refs/heads/master | 2022-12-19T03:32:51.893480 | 2017-10-15T04:06:33 | 2017-10-15T04:06:33 | 103,473,102 | 0 | 2 | null | 2020-09-18T10:17:06 | 2017-09-14T02:02:52 | Java | UTF-8 | Java | false | false | 4,321 | java | package com.sys.org.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.sys.org.domain.Sector;
import com.sys.org.repository.SectorRepository;
import com.sys.org.web.rest.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Sector.
*/
@RestController
@RequestMapping("/api")
public class SectorResource {
private final Logger log = LoggerFactory.getLogger(SectorResource.class);
private static final String ENTITY_NAME = "sector";
private final SectorRepository sectorRepository;
public SectorResource(SectorRepository sectorRepository) {
this.sectorRepository = sectorRepository;
}
/**
* POST /sectors : Create a new sector.
*
* @param sector the sector to create
* @return the ResponseEntity with status 201 (Created) and with body the new sector, or with status 400 (Bad Request) if the sector has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/sectors")
@Timed
public ResponseEntity<Sector> createSector(@RequestBody Sector sector) throws URISyntaxException {
log.debug("REST request to save Sector : {}", sector);
if (sector.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new sector cannot already have an ID")).body(null);
}
Sector result = sectorRepository.save(sector);
return ResponseEntity.created(new URI("/api/sectors/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /sectors : Updates an existing sector.
*
* @param sector the sector to update
* @return the ResponseEntity with status 200 (OK) and with body the updated sector,
* or with status 400 (Bad Request) if the sector is not valid,
* or with status 500 (Internal Server Error) if the sector couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/sectors")
@Timed
public ResponseEntity<Sector> updateSector(@RequestBody Sector sector) throws URISyntaxException {
log.debug("REST request to update Sector : {}", sector);
if (sector.getId() == null) {
return createSector(sector);
}
Sector result = sectorRepository.save(sector);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, sector.getId().toString()))
.body(result);
}
/**
* GET /sectors : get all the sectors.
*
* @return the ResponseEntity with status 200 (OK) and the list of sectors in body
*/
@GetMapping("/sectors")
@Timed
public List<Sector> getAllSectors() {
log.debug("REST request to get all Sectors");
return sectorRepository.findAll();
}
/**
* GET /sectors/:id : get the "id" sector.
*
* @param id the id of the sector to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the sector, or with status 404 (Not Found)
*/
@GetMapping("/sectors/{id}")
@Timed
public ResponseEntity<Sector> getSector(@PathVariable Long id) {
log.debug("REST request to get Sector : {}", id);
Sector sector = sectorRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(sector));
}
/**
* DELETE /sectors/:id : delete the "id" sector.
*
* @param id the id of the sector to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/sectors/{id}")
@Timed
public ResponseEntity<Void> deleteSector(@PathVariable Long id) {
log.debug("REST request to delete Sector : {}", id);
sectorRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
| [
"dbshspaul@gmail.com"
] | dbshspaul@gmail.com |
0fe0fd06ad50b37eb5498bd56c9b22a90cc3e91b | 2ff66e7232374f247f3742e69a1d0584dd599bea | /app/src/main/java/com/tekraiders/wherehouse/wherehouse/tabs/SlidingTabsLayout.java | baabef8711a111e7fbb179515c4be0ffa40bdfcd | [] | no_license | SahajRana/whereHouse | b7dd5b9ba3cb95b7b7e0fcb8b9759b9367c0a3c2 | f78bfc543141cc9ba9fdcaf5efa663aed68e2e31 | refs/heads/master | 2020-05-24T19:03:21.885216 | 2017-03-27T09:10:17 | 2017-03-27T09:10:17 | 84,872,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,962 | java | package com.tekraiders.wherehouse.wherehouse.tabs;
/**
* Created by Sahaj on 2/11/2016.
*/
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.content.Context;
import android.graphics.Typeface;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tekraiders.wherehouse.wherehouse.R;
/**
* To be used with ViewPager to provide a tab indicator component which give constant feedback as to
* the user's scroll progress.
* <p/>
* To use the component, simply add it to your view hierarchy. Then in your
* {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call
* {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for.
* <p/>
* The colors can be customized in two ways. The first and simplest is to provide an array of colors
* via {@link #setSelectedIndicatorColors(int...)}. The
* alternative is via the {@link TabColorizer} interface which provides you complete control over
* which color is used for any individual position.
* <p/>
* The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
* providing the layout ID of your custom layout.
*/
public class SlidingTabsLayout extends HorizontalScrollView {
/**
* Allows complete control over the colors drawn in the tab layout. Set with
* {@link #setCustomTabColorizer(TabColorizer)}.
*/
public interface TabColorizer {
/**
* @return return the color of the indicator used when {@code position} is selected.
*/
int getIndicatorColor(int position);
}
private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16;
private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
private int mTitleOffset;
private int mTabViewLayoutId;
private int mTabViewTextViewId;
private boolean mDistributeEvenly;
private ViewPager mViewPager;
private SparseArray<String> mContentDescriptions = new SparseArray<String>();
private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
private final SlidingTabStrip mTabStrip;
public SlidingTabsLayout(Context context) {
this(context, null);
}
public SlidingTabsLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SlidingTabsLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// Disable the Scroll Bar
setHorizontalScrollBarEnabled(false);
// Make sure that the Tab Strips fills this View
setFillViewport(true);
mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
mTabStrip = new SlidingTabStrip(context);
addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
/**
* Set the custom {@link TabColorizer} to be used.
* <p/>
* If you only require simple custmisation then you can use
* {@link #setSelectedIndicatorColors(int...)} to achieve
* similar effects.
*/
public void setCustomTabColorizer(TabColorizer tabColorizer) {
mTabStrip.setCustomTabColorizer(tabColorizer);
}
public void setDistributeEvenly(boolean distributeEvenly) {
mDistributeEvenly = distributeEvenly;
}
/**
* Sets the colors to be used for indicating the selected tab. These colors are treated as a
* circular array. Providing one color will mean that all tabs are indicated with the same color.
*/
public void setSelectedIndicatorColors(int... colors) {
mTabStrip.setSelectedIndicatorColors(colors);
}
/**
* Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabsLayout} you are
* required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so
* that the layout can update it's scroll position correctly.
*
* @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
*/
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
mViewPagerPageChangeListener = listener;
}
/**
* Set the custom layout to be inflated for the tab views.
*
* @param layoutResId Layout id to be inflated
* @param textViewId id of the {@link TextView} in the inflated view
*/
public void setCustomTabView(int layoutResId, int textViewId) {
mTabViewLayoutId = layoutResId;
mTabViewTextViewId = textViewId;
}
/**
* Sets the associated view pager. Note that the assumption here is that the pager content
* (number of tabs and tab titles) does not change after this call has been made.
*/
public void setViewPager(ViewPager viewPager) {
mTabStrip.removeAllViews();
mViewPager = viewPager;
if (viewPager != null) {
viewPager.setOnPageChangeListener(new InternalViewPagerListener());
populateTabStrip();
}
}
/**
* Create a default view to be used for tabs. This is called if a custom tab view is not set via
* {@link #setCustomTabView(int, int)}.
*/
protected TextView createDefaultTabView(Context context) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
outValue, true);
textView.setBackgroundResource(outValue.resourceId);
textView.setAllCaps(true);
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding);
return textView;
}
private void populateTabStrip() {
final PagerAdapter adapter = mViewPager.getAdapter();
final View.OnClickListener tabClickListener = new TabClickListener();
for (int i = 0; i < adapter.getCount(); i++) {
View tabView = null;
TextView tabTitleView = null;
if (mTabViewLayoutId != 0) {
// If there is a custom tab view layout id set, try and inflate it
tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
false);
tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
}
if (tabView == null) {
tabView = createDefaultTabView(getContext());
}
if (tabTitleView == null && TextView.class.isInstance(tabView)) {
tabTitleView = (TextView) tabView;
}
if (mDistributeEvenly) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
lp.width = 0;
lp.weight = 1;
}
tabTitleView.setText(adapter.getPageTitle(i));
tabView.setOnClickListener(tabClickListener);
String desc = mContentDescriptions.get(i, null);
if (desc != null) {
tabView.setContentDescription(desc);
}
mTabStrip.addView(tabView);
if (i == mViewPager.getCurrentItem()) {
tabView.setSelected(true);
}
// tabTitleView.setTextColor(getResources().getColorStateList(R.color.tab_color));
// tabTitleView.setTextSize(12);
}
}
public void setContentDescription(int i, String desc) {
mContentDescriptions.put(i, desc);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mViewPager != null) {
scrollToTab(mViewPager.getCurrentItem(), 0);
}
}
private void scrollToTab(int tabIndex, int positionOffset) {
final int tabStripChildCount = mTabStrip.getChildCount();
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
return;
}
View selectedChild = mTabStrip.getChildAt(tabIndex);
if (selectedChild != null) {
int targetScrollX = selectedChild.getLeft() + positionOffset;
if (tabIndex > 0 || positionOffset > 0) {
// If we're not at the first child and are mid-scroll, make sure we obey the offset
targetScrollX -= mTitleOffset;
}
scrollTo(targetScrollX, 0);
}
}
private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
private int mScrollState;
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
int tabStripChildCount = mTabStrip.getChildCount();
if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
return;
}
mTabStrip.onViewPagerPageChanged(position, positionOffset);
View selectedTitle = mTabStrip.getChildAt(position);
int extraOffset = (selectedTitle != null)
? (int) (positionOffset * selectedTitle.getWidth())
: 0;
scrollToTab(position, extraOffset);
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageScrolled(position, positionOffset,
positionOffsetPixels);
}
}
@Override
public void onPageScrollStateChanged(int state) {
mScrollState = state;
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageScrollStateChanged(state);
}
}
@Override
public void onPageSelected(int position) {
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mTabStrip.onViewPagerPageChanged(position, 0f);
scrollToTab(position, 0);
}
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
mTabStrip.getChildAt(i).setSelected(position == i);
}
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageSelected(position);
}
}
}
private class TabClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
if (v == mTabStrip.getChildAt(i)) {
mViewPager.setCurrentItem(i);
return;
}
}
}
}
}
| [
"sahaj9917730102@gmail.com"
] | sahaj9917730102@gmail.com |
7ea826c9168b1d4df603796a23fd38a97df2e8b6 | a8d0de70686af34572d1c458e969f4c2f7ba2cc8 | /src/test/java/pages/DealsPage.java | 8437ab3a3147296d3c84989f7c4679f48251d378 | [] | no_license | narayanabarnana/SeFramework | bdf133976502abb93f98c499ee4a5802d675288e | 992ceedb71dd70081259b3d118a98d389410b985 | refs/heads/master | 2020-03-25T23:23:44.133376 | 2018-10-04T09:55:26 | 2018-10-04T09:55:26 | 144,272,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | package pages;
import java.util.List;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
public class DealsPage {
final WebDriver driver;
public DealsPage(WebDriver driver)
{
this.driver=driver;
}
// @FindBy(how = How.XPATH, using = "//table[@class='datacard']//tr")
// public static List<WebElement> WebTable_productsrow;
@FindBy(how = How.XPATH, using = "//table[@class='datacard']//tbody//tr")
public static List<WebElement> WebTable_productsrow;
@FindBy(how = How.XPATH, using = "//a[contains(text(),'Deals')]")
public static WebElement btn_Deals;
////a[contains(text(),'New Contact')]
@FindBy(how = How.XPATH, using = "//a[contains(text(),'Products')]")
public static WebElement btn_Products;
////i[@class='fa fa-money' and @title='Deals']
@FindBy(how = How.XPATH, using = "//i[@class='fa fa-money' and @title='Deals']")
public static List<WebElement> link_Deals;
}
| [
"narayana.barnana@capgemini.com"
] | narayana.barnana@capgemini.com |
68519e79605d8c9c833963aacb880bb3d5fc7ac4 | 44e52beeaffc1e753153d085c144e3c7aecfd329 | /src/main/java/com/opendota/matchDetail/KillsPerMin.java | 785f04ec1e972a36e1f96446d751437dee7849dc | [] | no_license | gbitz/dotaStats | 4d237d62862d4cb7d243bd583a416d08ce10f474 | 15aade32ba3e9f50bcaa7165fe008aba323f9182 | refs/heads/master | 2020-04-21T15:12:29.766679 | 2019-05-14T02:16:40 | 2019-05-14T02:16:40 | 169,661,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.opendota.matchDetail;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
/**
* The type Kills per min.
*/
@Generated("com.robohorse.robopojogenerator")
public class KillsPerMin{
@JsonProperty("pct")
private double pct;
@JsonProperty("raw")
private double raw;
/**
* Set pct.
*
* @param pct the pct
*/
public void setPct(double pct){
this.pct = pct;
}
/**
* Get pct double.
*
* @return the double
*/
public double getPct(){
return pct;
}
/**
* Set raw.
*
* @param raw the raw
*/
public void setRaw(double raw){
this.raw = raw;
}
/**
* Get raw double.
*
* @return the double
*/
public double getRaw(){
return raw;
}
@Override
public String toString(){
return
"KillsPerMin{" +
"pct = '" + pct + '\'' +
",raw = '" + raw + '\'' +
"}";
}
} | [
"gbitzer@madisoncollege.edu"
] | gbitzer@madisoncollege.edu |
ac9c9e51ace72a148fba66595794d7a58a9bafc8 | 67e14ec35298fb096aed0e12d952444d9be4793e | /src/main/java/com/cr/start/App.java | a56a748585587482e8ddebc034cce2a7c8a8d8e1 | [] | no_license | Kamehameha010/Airline-Managment-System | 89f1d8998ba4c549d9432e34fbde9197e99536b2 | 5b8bf3d3b6e159b1e5f41ede52cbf38bcd7c94ae | refs/heads/main | 2023-08-23T17:23:59.644571 | 2021-10-25T03:54:40 | 2021-10-25T03:54:40 | 355,350,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.cr.start;
import com.cr.view.internal.main.MainView;
public class App {
public static void main(String[] args) {
var r = new MainView();
r.setVisible(true);
}
}
| [
"mizukaze_010@hotmail.com"
] | mizukaze_010@hotmail.com |
eaf3eaa41ff582c2816bd8903e8e18b1899e7cff | b3e0f93aae7b2d62e1a5ecada627096051a49884 | /src/main/java/com/kadasoftware/delfos/repository/SprintRepository.java | d708233bd64eeef575727e6202e8575f85eb0f30 | [] | no_license | ernestomendez/delfos | 7277160e5e675f61858e52e78158992cae589064 | 7ca204b378fadd2ab682373dc13a8c95b1334a9f | refs/heads/master | 2020-12-25T15:08:51.551845 | 2017-02-04T02:24:46 | 2017-02-04T02:24:46 | 67,840,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | package com.kadasoftware.delfos.repository;
import com.kadasoftware.delfos.domain.Sprint;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.time.LocalDate;
import java.util.List;
/**
* Spring Data MongoDB repository for the Sprint entity.
*/
@SuppressWarnings("unused")
public interface SprintRepository extends MongoRepository<Sprint,String> {
List<Sprint> findByProjectAndStartDateBeforeAndEndDateAfter(String project, LocalDate day, LocalDate other);
}
| [
"nernesto@gmail.com"
] | nernesto@gmail.com |
424a7fae64eff39608323a1a49e1d7518608c3ea | 43ea91f3ca050380e4c163129e92b771d7bf144a | /services/drs/src/main/java/com/huaweicloud/sdk/drs/v3/model/QueryDataGuardMonitorResponse.java | b8cf70c9b460264c669157fe6a6e087192b8bf37 | [
"Apache-2.0"
] | permissive | wxgsdwl/huaweicloud-sdk-java-v3 | 660602ca08f32dc897d3770995b496a82a1cc72d | ee001d706568fdc7b852792d2e9aefeb9d13fb1e | refs/heads/master | 2023-02-27T14:20:54.774327 | 2021-02-07T11:48:35 | 2021-02-07T11:48:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,275 | java | package com.huaweicloud.sdk.drs.v3.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.function.Consumer;
import java.util.Objects;
/**
* 容灾监控数据响应体
*/
public class QueryDataGuardMonitorResponse {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="bandwidth")
private String bandwidth;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="cpuUsed_percent")
private String cpuUsedPercent;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="dst_delay")
private Long dstDelay;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="dst_io")
private String dstIo;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="dst_normal")
private Boolean dstNormal;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="dst_offset")
private String dstOffset;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="dst_rps")
private String dstRps;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="mem_used_inMB")
private String memUsedInMB;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="node_mem_inMB")
private Long nodeMemInMB;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="node_offset")
private String nodeOffset;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="node_volume_inGB")
private Long nodeVolumeInGB;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="sr_delay")
private Long srDelay;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="sr_offset")
private String srOffset;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="src_io")
private String srcIo;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="src_normal")
private Boolean srcNormal;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="src_rps")
private String srcRps;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="trans_inMB")
private String transInMB;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="trans_lines")
private String transLines;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="volume_used_inGB")
private String volumeUsedInGB;
public QueryDataGuardMonitorResponse withBandwidth(String bandwidth) {
this.bandwidth = bandwidth;
return this;
}
/**
* 带宽。
* @return bandwidth
*/
public String getBandwidth() {
return bandwidth;
}
public void setBandwidth(String bandwidth) {
this.bandwidth = bandwidth;
}
public QueryDataGuardMonitorResponse withCpuUsedPercent(String cpuUsedPercent) {
this.cpuUsedPercent = cpuUsedPercent;
return this;
}
/**
* cpu百分比。
* @return cpuUsedPercent
*/
public String getCpuUsedPercent() {
return cpuUsedPercent;
}
public void setCpuUsedPercent(String cpuUsedPercent) {
this.cpuUsedPercent = cpuUsedPercent;
}
public QueryDataGuardMonitorResponse withDstDelay(Long dstDelay) {
this.dstDelay = dstDelay;
return this;
}
/**
* 目标库时延。
* @return dstDelay
*/
public Long getDstDelay() {
return dstDelay;
}
public void setDstDelay(Long dstDelay) {
this.dstDelay = dstDelay;
}
public QueryDataGuardMonitorResponse withDstIo(String dstIo) {
this.dstIo = dstIo;
return this;
}
/**
* 目标io。
* @return dstIo
*/
public String getDstIo() {
return dstIo;
}
public void setDstIo(String dstIo) {
this.dstIo = dstIo;
}
public QueryDataGuardMonitorResponse withDstNormal(Boolean dstNormal) {
this.dstNormal = dstNormal;
return this;
}
/**
* 目标库连接状态。
* @return dstNormal
*/
public Boolean getDstNormal() {
return dstNormal;
}
public void setDstNormal(Boolean dstNormal) {
this.dstNormal = dstNormal;
}
public QueryDataGuardMonitorResponse withDstOffset(String dstOffset) {
this.dstOffset = dstOffset;
return this;
}
/**
* 目标库offSet位点。
* @return dstOffset
*/
public String getDstOffset() {
return dstOffset;
}
public void setDstOffset(String dstOffset) {
this.dstOffset = dstOffset;
}
public QueryDataGuardMonitorResponse withDstRps(String dstRps) {
this.dstRps = dstRps;
return this;
}
/**
* 目标rps。
* @return dstRps
*/
public String getDstRps() {
return dstRps;
}
public void setDstRps(String dstRps) {
this.dstRps = dstRps;
}
public QueryDataGuardMonitorResponse withMemUsedInMB(String memUsedInMB) {
this.memUsedInMB = memUsedInMB;
return this;
}
/**
* 内存使用。
* @return memUsedInMB
*/
public String getMemUsedInMB() {
return memUsedInMB;
}
public void setMemUsedInMB(String memUsedInMB) {
this.memUsedInMB = memUsedInMB;
}
public QueryDataGuardMonitorResponse withNodeMemInMB(Long nodeMemInMB) {
this.nodeMemInMB = nodeMemInMB;
return this;
}
/**
* node内存总大小。
* @return nodeMemInMB
*/
public Long getNodeMemInMB() {
return nodeMemInMB;
}
public void setNodeMemInMB(Long nodeMemInMB) {
this.nodeMemInMB = nodeMemInMB;
}
public QueryDataGuardMonitorResponse withNodeOffset(String nodeOffset) {
this.nodeOffset = nodeOffset;
return this;
}
/**
* 迁移实例offSet位点。
* @return nodeOffset
*/
public String getNodeOffset() {
return nodeOffset;
}
public void setNodeOffset(String nodeOffset) {
this.nodeOffset = nodeOffset;
}
public QueryDataGuardMonitorResponse withNodeVolumeInGB(Long nodeVolumeInGB) {
this.nodeVolumeInGB = nodeVolumeInGB;
return this;
}
/**
* node磁盘总大小。
* @return nodeVolumeInGB
*/
public Long getNodeVolumeInGB() {
return nodeVolumeInGB;
}
public void setNodeVolumeInGB(Long nodeVolumeInGB) {
this.nodeVolumeInGB = nodeVolumeInGB;
}
public QueryDataGuardMonitorResponse withSrDelay(Long srDelay) {
this.srDelay = srDelay;
return this;
}
/**
* 源库时延。
* @return srDelay
*/
public Long getSrDelay() {
return srDelay;
}
public void setSrDelay(Long srDelay) {
this.srDelay = srDelay;
}
public QueryDataGuardMonitorResponse withSrOffset(String srOffset) {
this.srOffset = srOffset;
return this;
}
/**
* 源库offSet位点。
* @return srOffset
*/
public String getSrOffset() {
return srOffset;
}
public void setSrOffset(String srOffset) {
this.srOffset = srOffset;
}
public QueryDataGuardMonitorResponse withSrcIo(String srcIo) {
this.srcIo = srcIo;
return this;
}
/**
* 源io。
* @return srcIo
*/
public String getSrcIo() {
return srcIo;
}
public void setSrcIo(String srcIo) {
this.srcIo = srcIo;
}
public QueryDataGuardMonitorResponse withSrcNormal(Boolean srcNormal) {
this.srcNormal = srcNormal;
return this;
}
/**
* 源库连接状态。
* @return srcNormal
*/
public Boolean getSrcNormal() {
return srcNormal;
}
public void setSrcNormal(Boolean srcNormal) {
this.srcNormal = srcNormal;
}
public QueryDataGuardMonitorResponse withSrcRps(String srcRps) {
this.srcRps = srcRps;
return this;
}
/**
* 源rps。
* @return srcRps
*/
public String getSrcRps() {
return srcRps;
}
public void setSrcRps(String srcRps) {
this.srcRps = srcRps;
}
public QueryDataGuardMonitorResponse withTransInMB(String transInMB) {
this.transInMB = transInMB;
return this;
}
/**
* 迁移数据量。
* @return transInMB
*/
public String getTransInMB() {
return transInMB;
}
public void setTransInMB(String transInMB) {
this.transInMB = transInMB;
}
public QueryDataGuardMonitorResponse withTransLines(String transLines) {
this.transLines = transLines;
return this;
}
/**
* 迁移数据行数。
* @return transLines
*/
public String getTransLines() {
return transLines;
}
public void setTransLines(String transLines) {
this.transLines = transLines;
}
public QueryDataGuardMonitorResponse withVolumeUsedInGB(String volumeUsedInGB) {
this.volumeUsedInGB = volumeUsedInGB;
return this;
}
/**
* 磁盘使用。
* @return volumeUsedInGB
*/
public String getVolumeUsedInGB() {
return volumeUsedInGB;
}
public void setVolumeUsedInGB(String volumeUsedInGB) {
this.volumeUsedInGB = volumeUsedInGB;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
QueryDataGuardMonitorResponse queryDataGuardMonitorResponse = (QueryDataGuardMonitorResponse) o;
return Objects.equals(this.bandwidth, queryDataGuardMonitorResponse.bandwidth) &&
Objects.equals(this.cpuUsedPercent, queryDataGuardMonitorResponse.cpuUsedPercent) &&
Objects.equals(this.dstDelay, queryDataGuardMonitorResponse.dstDelay) &&
Objects.equals(this.dstIo, queryDataGuardMonitorResponse.dstIo) &&
Objects.equals(this.dstNormal, queryDataGuardMonitorResponse.dstNormal) &&
Objects.equals(this.dstOffset, queryDataGuardMonitorResponse.dstOffset) &&
Objects.equals(this.dstRps, queryDataGuardMonitorResponse.dstRps) &&
Objects.equals(this.memUsedInMB, queryDataGuardMonitorResponse.memUsedInMB) &&
Objects.equals(this.nodeMemInMB, queryDataGuardMonitorResponse.nodeMemInMB) &&
Objects.equals(this.nodeOffset, queryDataGuardMonitorResponse.nodeOffset) &&
Objects.equals(this.nodeVolumeInGB, queryDataGuardMonitorResponse.nodeVolumeInGB) &&
Objects.equals(this.srDelay, queryDataGuardMonitorResponse.srDelay) &&
Objects.equals(this.srOffset, queryDataGuardMonitorResponse.srOffset) &&
Objects.equals(this.srcIo, queryDataGuardMonitorResponse.srcIo) &&
Objects.equals(this.srcNormal, queryDataGuardMonitorResponse.srcNormal) &&
Objects.equals(this.srcRps, queryDataGuardMonitorResponse.srcRps) &&
Objects.equals(this.transInMB, queryDataGuardMonitorResponse.transInMB) &&
Objects.equals(this.transLines, queryDataGuardMonitorResponse.transLines) &&
Objects.equals(this.volumeUsedInGB, queryDataGuardMonitorResponse.volumeUsedInGB);
}
@Override
public int hashCode() {
return Objects.hash(bandwidth, cpuUsedPercent, dstDelay, dstIo, dstNormal, dstOffset, dstRps, memUsedInMB, nodeMemInMB, nodeOffset, nodeVolumeInGB, srDelay, srOffset, srcIo, srcNormal, srcRps, transInMB, transLines, volumeUsedInGB);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class QueryDataGuardMonitorResponse {\n");
sb.append(" bandwidth: ").append(toIndentedString(bandwidth)).append("\n");
sb.append(" cpuUsedPercent: ").append(toIndentedString(cpuUsedPercent)).append("\n");
sb.append(" dstDelay: ").append(toIndentedString(dstDelay)).append("\n");
sb.append(" dstIo: ").append(toIndentedString(dstIo)).append("\n");
sb.append(" dstNormal: ").append(toIndentedString(dstNormal)).append("\n");
sb.append(" dstOffset: ").append(toIndentedString(dstOffset)).append("\n");
sb.append(" dstRps: ").append(toIndentedString(dstRps)).append("\n");
sb.append(" memUsedInMB: ").append(toIndentedString(memUsedInMB)).append("\n");
sb.append(" nodeMemInMB: ").append(toIndentedString(nodeMemInMB)).append("\n");
sb.append(" nodeOffset: ").append(toIndentedString(nodeOffset)).append("\n");
sb.append(" nodeVolumeInGB: ").append(toIndentedString(nodeVolumeInGB)).append("\n");
sb.append(" srDelay: ").append(toIndentedString(srDelay)).append("\n");
sb.append(" srOffset: ").append(toIndentedString(srOffset)).append("\n");
sb.append(" srcIo: ").append(toIndentedString(srcIo)).append("\n");
sb.append(" srcNormal: ").append(toIndentedString(srcNormal)).append("\n");
sb.append(" srcRps: ").append(toIndentedString(srcRps)).append("\n");
sb.append(" transInMB: ").append(toIndentedString(transInMB)).append("\n");
sb.append(" transLines: ").append(toIndentedString(transLines)).append("\n");
sb.append(" volumeUsedInGB: ").append(toIndentedString(volumeUsedInGB)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"hwcloudsdk@huawei.com"
] | hwcloudsdk@huawei.com |
4b9744bce2add9bfb67b861f5bd698d9880876f1 | 96b8691d9c006010d616dadf77e3619e384ca31c | /jiaozivideoplayer/src/main/java/com/dawn/jiaozivideoplayer/JZMediaInterface.java | ba310461451b40093124a1fdfbc4b3c9e76f9c52 | [] | no_license | bisummer/VideoPlay | 34784b4c1eff9eabe8b8880c653e9c42de6ad578 | f36f305dfb2245b5853f1ae5fedfc02875aa3f97 | refs/heads/master | 2021-09-19T07:36:02.907531 | 2018-07-25T08:40:08 | 2018-07-25T08:40:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package com.dawn.jiaozivideoplayer;
import android.view.Surface;
/**
* Created by Nathen on 2017/11/7.
* 自定义播放器
*/
public abstract class JZMediaInterface {
public Object currentDataSource;//正在播放的当前url或uri
/**
* 第一个是url的map
* 第二个是loop
* 第三个是header
* 第四个是context
*/
public Object[] dataSourceObjects;//包含了地址的map(多分辨率用),context,loop,header等
public abstract void start();
public abstract void prepare();
public abstract void pause();
public abstract boolean isPlaying();
public abstract void seekTo(long time);
public abstract void release();
public abstract long getCurrentPosition();
public abstract long getDuration();
public abstract void setSurface(Surface surface);
public abstract void setVolume(float leftVolume, float rightVolume);
}
| [
"z_dawn@163.com"
] | z_dawn@163.com |
2e4dfc1b6e657ad5d0ad77a1fcbc9c8ed0b6490a | 6b615a77d1205445205a044fef3664bb5bd5dea1 | /src/main/java/br/edu/infnet/at_pb_auxiliar_nicholas_joao/AtPbAuxiliarNicholasJoaoApplication.java | 15280b723fc10d4cb4c70707280d5b57ab5e200a | [] | no_license | JoaoPeSousa/pb_auxilia_nicholas_joao | b90366b872bd2e111a61f4a2604956fc06d7e904 | 74d0f09d136592c0966328e1351b3427c5ac1c54 | refs/heads/master | 2023-05-29T15:36:13.459508 | 2021-06-20T16:29:25 | 2021-06-20T16:29:25 | 378,693,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package br.edu.infnet.at_pb_auxiliar_nicholas_joao;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AtPbAuxiliarNicholasJoaoApplication {
public static void main(String[] args) {
SpringApplication.run(AtPbAuxiliarNicholasJoaoApplication.class, args);
}
}
| [
"joaopedrodeoliveirasousa@gmail.com"
] | joaopedrodeoliveirasousa@gmail.com |
29b70e4147cc61c2c3b9fc6e5bb2875df3d1562a | cf952fcc4b02ae84fa73a6b9f17f28e34df4c217 | /src/main/java/homework_13/storage/IdGenerator.java | 7b53b36ccce1c4294f36c06474cdb665404f8a68 | [] | no_license | AinuraAkhmetova/epam_homeworks | 554cc55d286e686ce8ee975073630cf79f28fc1a | 93d05165894a7eeafc0602add8641485ec238570 | refs/heads/master | 2020-11-25T00:04:29.564184 | 2020-02-05T10:28:30 | 2020-02-05T10:28:30 | 227,855,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package homework_13.storage;
public final class IdGenerator {
private IdGenerator() {
}
private static Long id = 0L;
public static Long generateId() {
return ++id;
}
}
| [
"ainura220998@gmail.com"
] | ainura220998@gmail.com |
2adae27a96a85fd750ac17bbc9224cf45bf65d93 | c317b527ee695f5f4a33763e3e6b23b767fcae03 | /and_week2_1/src/com/example/and_week2_1/CustomAdapter.java | 688da41e22ff29fee4e197945fe083ef8d2eca03 | [] | no_license | cocagolau/NEXT_13-03_Development-Experience-Project_Android | 79c5e475462137212a84b9910e591776444ef0fb | 582ed987df54e3a9ffbd0e1cd4f0a0f15af2ebcb | refs/heads/master | 2016-09-05T09:09:23.029846 | 2014-07-07T12:29:09 | 2014-07-07T12:29:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,758 | java | package com.example.and_week2_1;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class CustomAdapter extends ArrayAdapter<ListData>{
private Context context;
private int layoutResourseId;
private ArrayList<ListData> listData;
public CustomAdapter (Context context, int layoutResourseId, ArrayList<ListData> listData) {
super(context, layoutResourseId, listData);
this.context = context;
this.layoutResourseId = layoutResourseId;
this.listData = listData;
}
@Override
public View getView (int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourseId, parent, false);
}
TextView tvText1 = (TextView) row.findViewById(R.id.custom_row_textView1);
TextView tvText2 = (TextView) row.findViewById(R.id.custom_row_textView2);
tvText1.setText(listData.get(position).getTitle());
tvText2.setText(listData.get(position).getText());
ImageView imgView = (ImageView) row.findViewById(R.id.custom_row_imageView);
try {
InputStream is = context.getAssets().open("sam/"+listData.get(position).getImage());
Drawable d = Drawable.createFromStream(is, null);
imgView.setImageDrawable(d);
}
catch (IOException e) {
Log.e("customAdapter", e.getMessage());
}
return row;
}
}
| [
"cocagolau@gmail.com"
] | cocagolau@gmail.com |
81919307a739cd3b66c9c02f6c92b32470e51567 | abc9bf2262c06543bfb243e66b5230eeca0ed091 | /appbooksqlite/app/src/test/java/com/example/thanatos/appbooksqlite/ExampleUnitTest.java | f2991e92b7b4b79c41e0bbf4b27a41537fd161fe | [] | no_license | thanatos9516/AndroidStudioProjects | 982193d385e59d6b4aa987c9c0f602eeeee832cc | fe764bed5eb26e997f99c7357108c8b1f76b146b | refs/heads/master | 2021-09-12T11:05:33.193462 | 2018-04-16T08:07:22 | 2018-04-16T08:07:22 | 125,800,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package com.example.thanatos.appbooksqlite;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"chepe352013@gmail.com"
] | chepe352013@gmail.com |
145295f8301e9b42dfa2310bd7ec0c2d34799871 | a35f1f92980ca7d1ab820d2eeacd71d33a078dde | /app/src/main/java/com/laioffer/tinnews/ui/search/SearchNewsAdapter.java | 2e7e16c0377b4562efae4da9e0f9997855eeaaea | [] | no_license | DongDongZh/TinNews | 7a57d343c9a5008ae4f26d25daf12f292055dbaa | d2a6bf1bcd8b906c8ba7295196c953c4dc1485c2 | refs/heads/main | 2023-03-27T00:14:35.664174 | 2021-03-30T23:18:15 | 2021-03-30T23:18:15 | 353,170,478 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,774 | java | package com.laioffer.tinnews.ui.search;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.laioffer.tinnews.databinding.SearchNewsItemBinding;
import com.laioffer.tinnews.model.Article;
import java.util.ArrayList;
import java.util.List;
import com.laioffer.tinnews.R;
import com.squareup.picasso.Picasso;
public class SearchNewsAdapter extends RecyclerView.Adapter<SearchNewsAdapter.SearchNewsViewHolder> {
interface ItemCallback {
void onOpenDetails(Article article);
}
private ItemCallback itemCallback;
public void setItemCallback(ItemCallback itemCallback) {
this.itemCallback = itemCallback;
}
// 1. Supporting data:
private List<Article> articles = new ArrayList<>();
public void setArticles(List<Article> newsList) {
articles.clear();
articles.addAll(newsList);
// every time a new list is set, we call notifyDataSetChanged to let the adapter refresh and re-render the data.
notifyDataSetChanged();
}
// 2. Adapter overrides:
@NonNull
@Override
// provide generated item views
public SearchNewsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.search_news_item, parent, false);
return new SearchNewsViewHolder(view);
}
@Override
// bind data with a view
public void onBindViewHolder(@NonNull SearchNewsViewHolder holder, int position) {
Article article = articles.get(position);
holder.favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
holder.itemTitleTextView.setText(article.title);
Picasso.get().load(article.urlToImage).into(holder.itemImageView);
holder.itemView.setOnClickListener(v -> itemCallback.onOpenDetails(article));
}
@Override
// current data collection size
public int getItemCount() {
return articles.size();
}
// 3. SearchNewsViewHolder: holding the view references
public static class SearchNewsViewHolder extends RecyclerView.ViewHolder {
ImageView favoriteImageView;
ImageView itemImageView;
TextView itemTitleTextView;
public SearchNewsViewHolder(@NonNull View itemView) {
super(itemView);
SearchNewsItemBinding binding = SearchNewsItemBinding.bind(itemView);
favoriteImageView = binding.searchItemFavorite;
itemImageView = binding.searchItemImage;
itemTitleTextView = binding.searchItemTitle;
}
}
}
| [
"ddzhang2018@gmail.com"
] | ddzhang2018@gmail.com |
3434145ca35800dc3dd27f221d575a3ea7f0c314 | 76beac15220a28f273bd5971f5e970cef8d5b7c6 | /Rep2.java | 64df4c0fa46cb01996d8b079eb78c4904403775a | [] | no_license | manish-rajpal/javalearning | c617ef5922075dfa08f4be17bd5577fdfbf9e525 | cdbc26c02780a0902b66e5b61e9be3d0aec31902 | refs/heads/master | 2022-12-19T02:25:57.098333 | 2020-09-25T12:45:29 | 2020-09-25T12:45:29 | 298,562,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | import java.util.Scanner;
public class Rep2 {
public static void main(String[] args) {
int[] numbers = {4, 5, 6, 78, 8};
//int[] numbers2 = {4, 5, 6, 78, 8, 23, 34, 45, 56, 34};
printOneArray(numbers);
doubleUpArray(numbers);
}
public static void printOneArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
public static void doubleUpArray(int[] array) {
int[] array2 = new int[array.lenght*2];
System.out.println(array2); }
}
}
}
| [
"rajpalmanish@gmail.com"
] | rajpalmanish@gmail.com |
0cf7f578b9361a992b2d6fe60d42a54677471e06 | d5d33f6b083bcfd332ba580a5133e1081e3f2a87 | /ch04/src/p117/SwitchExample.java | 7058846c2220add6d04a1722299d55d7c267ab5f | [] | no_license | yec46/java | b540d7d0b58c7f0b1cef68f27a377b253550e4cb | 039ad37b059820f4436f4f7eb9a542980357bb06 | refs/heads/master | 2020-08-19T13:32:40.501288 | 2019-11-04T03:04:47 | 2019-11-04T03:04:47 | 215,924,275 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 693 | java | package p117;
/*
* 날짜 : 2019.10.14
* 이름 : 박성
* 내용 : p117
*/
public class SwitchExample
{
public static void main(String[] args)
{
int num=(int)(Math.random()*6)+1;
switch(num)
{
case 1:
System.out.println("1번이 나왔습니다.");
break;
case 2:
System.out.println("2번이 나왔습니다.");
break;
case 3:
System.out.println("3번이 나왔습니다.");
break;
case 4:
System.out.println("4번이 나왔습니다.");
break;
case 5:
System.out.println("5번이 나왔습니다.");
break;
default:
System.out.println("6번이 나왔습니다.");
break;
}
}
}
| [
"java@DESKTOP-T5J9FJA"
] | java@DESKTOP-T5J9FJA |
d783d47e4249ec50dbd4b4eedbfa6a8a0811409e | d1ca3cecc12b0e0bf6856ad79e8ff03fbdf40905 | /config/config-server-encryption/src/main/java/org/yann/icloud/config/server/encryption/ConfigServerEncryptionApplication.java | f2396d1fcde1169649630f6013f6b9d335bc725f | [] | no_license | HooYann/icloud | a5788e01011be1d4d4136c95c3b717ec4b592d98 | be43708bfab12bb0e41d79335b53abccffc12282 | refs/heads/master | 2020-06-22T21:17:24.610202 | 2019-10-16T10:23:58 | 2019-10-16T10:23:58 | 198,401,852 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package org.yann.icloud.config.server.encryption;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class ConfigServerEncryptionApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerEncryptionApplication.class, args);
}
}
| [
"huyy2b@sina.com"
] | huyy2b@sina.com |
14dcfe99be81cc6a1fe59f4befcc77732b21269e | 464fc564f5053a605a5930cf3161f93d3489001e | /src/main/java/com/fun/project/admin/system/entity/user/UserRole.java | 678d194e30e8a34bb1a8414031534e5a18bbdaee | [] | no_license | yukaril/fun-boot | 25825c0ee34918186518fad1853d573b20651f53 | eac13bbde765264733d0f6894a8d7754baa76407 | refs/heads/master | 2020-09-26T09:18:05.607317 | 2019-12-03T12:46:10 | 2019-12-03T12:46:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package com.fun.project.admin.system.entity.user;
import lombok.Data;
/**
* 用户和角色关联 sys_user_role
* @author DJun
*/
@Data
public class UserRole {
/** 用户ID */
private Long userId;
/** 角色ID */
private Long roleId;
}
| [
"mr.djun@qq.com"
] | mr.djun@qq.com |
c482bc432dd6f6a9f6b7777ae1d99be1070b66f2 | 639e12503eb994d09eece1b4da811f842e785420 | /src/main/java/BOJ/JGeun/p2900/BOJ2941.java | cdce4676fd7239776ae9a8e7e34cd5236374706f | [] | no_license | Heewookji/BOJ | 17fa9536852ace44949a196ef158e14910f92593 | 0262d83cdf7b3435d75c7ef4253b24b2e4201a5a | refs/heads/master | 2023-01-03T15:53:42.703006 | 2020-11-04T13:22:17 | 2020-11-04T13:22:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package BOJ.JGeun.p2900;
import java.util.Scanner;
public class BOJ2941 {
static String[] cro = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="};
static String[] sub = {"A", "B", "C", "D", "E", "F", "G", "H"};
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String word = sc.nextLine();
word = changeToCro(word);
System.out.println(word.length());
}
private static String changeToCro(String word){
for(int i=0; i<8; i++)
word = word.replace(cro[i], sub[i]);
return word;
}
}
| [
"pjk8926@gmail.com"
] | pjk8926@gmail.com |
ad6bafccfdd293d8e67a0eef90cdb6f37751280b | 62674b96bba9116f65b5613877ab4b80da47aba1 | /src/com/cafeto/icecream/resources/IceCreamResource.java | bb2fb7b5be0c37d169666a23b7ae01ff710a106c | [] | no_license | gomezpirry/Cafeto_IceCreams | efe1aa1fcddfec82512f123bee997434fc17309c | db7498374b34e22a271f7afdfe52444f9391e7b2 | refs/heads/master | 2021-01-10T10:53:33.881679 | 2016-01-18T05:17:59 | 2016-01-18T05:17:59 | 49,693,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package com.cafeto.icecream.resources;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.JAXBElement;
import com.cafeto.icecream.model.IceCream;
import com.cafeto.icecream.model.IceCreamService;
public class IceCreamResource {
@Context
UriInfo uriInfo;
@Context
Request request;
String id;
IceCreamService creamService;
public IceCreamResource(UriInfo uriInfo, Request request, String id) {
this.uriInfo = uriInfo;
this.request = request;
this.id = id;
creamService = new IceCreamService();
}
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public IceCream getIceCream() {
IceCream cream = creamService.getIceCream(id);
return cream;
}
@GET
@Produces(MediaType.TEXT_XML)
public IceCream getIceCreamAsHtml() {
IceCream cream = creamService.getIceCream(id);
return cream;
}
@PUT
@Consumes(MediaType.APPLICATION_XML)
public Response putIceCream(JAXBElement<IceCream> creamElement) {
IceCream cream = creamElement.getValue();
Response response;
if (creamService.getIceCreams().containsKey(cream.getId())) {
response = Response.noContent().build();
} else {
response = Response.created(uriInfo.getAbsolutePath()).build();
}
creamService.createIceCream(cream);
return response;
}
@DELETE
public void deleteIceCream() {
creamService.deleteIceCream(id);
}
} | [
"gomezpirry@hotmail.com"
] | gomezpirry@hotmail.com |
36af659850a1b28009ed4052de7c70c93e995e66 | 9e12898cf63e754ac58c15ce1ae603ad60805fdd | /cloudalibaba-consumer-nacos-order84/src/main/java/com/hello/springcloud/alibaba/alibaba/controller/CircleBreakerController.java | b88701c25117505a532847be9e124a584179a5ba | [] | no_license | liudaolunhui/cloudboot3 | 7d784bdea5fce4693c32d1236bf541ef9fab5be8 | d477693652b763a111b8cf3c3f8ede3f1c8bd324 | refs/heads/main | 2023-03-19T02:43:01.557427 | 2021-02-15T02:49:08 | 2021-02-15T02:49:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,888 | java | package com.hello.springcloud.alibaba.alibaba.controller;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.hello.springcloud.alibaba.alibaba.service.PaymentService;
import com.hello.springcloud.alibaba.entities.CommonResult;
import com.hello.springcloud.alibaba.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
/**
* @author zrj
* @date 2021/2/11
* @since V1.0
**/
@Slf4j
@RestController
public class CircleBreakerController {
public static final String SERVICE_URL = "http://nacos-payment-provider";
@Resource
private RestTemplate restTemplate;
@RequestMapping("/consumer/fallback/{id}")
//@SentinelResource(value = "fallback") //没有配置
//@SentinelResource(value = "fallback",fallback = "handlerFallback") //fallback只负责业务异常
//@SentinelResource(value = "fallback",blockHandler = "blockHandler") //blockHandler只负责sentinel控制台配置违规
@SentinelResource(value = "fallback", fallback = "handlerFallback", blockHandler = "blockHandler",
exceptionsToIgnore = {IllegalArgumentException.class})
public CommonResult<Payment> fallback(@PathVariable Long id) {
CommonResult<Payment> result = restTemplate.getForObject( SERVICE_URL + "/paymentSQL/" + id, CommonResult.class, id );
if (id == 4) {
throw new IllegalArgumentException( "IllegalArgumentException,非法参数异常...." );
} else if (result.getData() == null) {
throw new NullPointerException( "NullPointerException,该ID没有对应记录,空指针异常" );
}
return result;
}
//本例是fallback
public CommonResult handlerFallback(@PathVariable Long id, Throwable e) {
Payment payment = new Payment( id, "null" );
return new CommonResult<>( 444, "兜底异常handlerFallback,exception内容 " + e.getMessage(), payment );
}
//本例是blockHandler
public CommonResult blockHandler(@PathVariable Long id, BlockException blockException) {
Payment payment = new Payment( id, "null" );
return new CommonResult<>( 445, "blockHandler-sentinel限流,无此流水: blockException " + blockException.getMessage(), payment );
}
/**
* OpenFeign
*/
@Resource
private PaymentService paymentService;
@GetMapping(value = "/consumer/paymentSQL/{id}")
public CommonResult<Payment> paymentSQL(@PathVariable("id") Long id) {
return paymentService.paymentSQL( id );
}
}
| [
"854530110@qq.com"
] | 854530110@qq.com |
b76a91f4cffa4e1a82bd872857807b570b261f20 | 48f0b3e029b304bf2cfb64419aad795445862856 | /Coral/dk.itu.sdg.language.xwpf.resource.xwpf/src-gen/dk/itu/sdg/language/xwpf/resource/xwpf/IXwpfHoverTextProvider.java | 3f65438daab0ca4e29882f024b1ab9ebb9ec65b7 | [] | no_license | jreimone/refactory | 09dda0718d5d8117f858d3e4497e8c1371530518 | 837f1ca3d8537250d024ead3be3ba95f7845409e | refs/heads/master | 2021-07-18T15:34:02.469855 | 2021-02-23T07:55:25 | 2021-02-23T07:55:25 | 56,208,480 | 2 | 1 | null | 2020-10-13T06:52:33 | 2016-04-14T05:01:02 | Java | UTF-8 | Java | false | false | 1,320 | java | /**
* Copyright 2012
* Rolf-Helge Pfeiffer (IT University Copenhagen)
* Jan Reimann (TU Dresden, Software Technology Group)
* Mirko Seifert (DevBoost GmbH)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dk.itu.sdg.language.xwpf.resource.xwpf;
public interface IXwpfHoverTextProvider {
/**
* Returns the hoves text that is shown when the mouse pointer rests over the
* given object. The hover text can contain HTML.
*/
public String getHoverText(org.eclipse.emf.ecore.EObject object);
/**
* Returns the hoves text that is shown when the mouse pointer rests over a
* reference to the given object. The hover text can contain HTML.
*/
public String getHoverText(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EObject referencedObject);
}
| [
"jreimone@users.noreply.github.com"
] | jreimone@users.noreply.github.com |
0f6f32e8eb7eacce341b68ee7cf788e8cf4741f3 | 8e401bd0b3b03d6361d821f110c91b385a4e73df | /Web/Mars/src/java/com/turtleworks/model/dao/BrandDAO.java | c5d239094d1a9f3ef5a4d3fa30add5565ae6f924 | [] | no_license | turtlesoftpy/JavaDevelop | 9d2427a345fda4404e08416fdf1fa40a28e90eb7 | 116e5d6e626224aeebdb05ef06819fb324d8a09b | refs/heads/master | 2021-01-12T09:31:53.221263 | 2016-12-12T18:47:45 | 2016-12-12T18:47:45 | 76,183,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | 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.turtleworks.model.dao;
import java.sql.SQLException;
import java.util.List;
import com.turtleworks.model.dto.Brand;
/**
*
* @author José Acuña
*/
public interface BrandDAO {
public void addBrand(Brand theBrand) throws SQLException;
public void updateBrand(Brand theBrand) throws SQLException;
public void deleteBrand(Short brandId) throws SQLException;
public Brand getBrand(Short brandId) throws SQLException;
public List<Brand> searchBrands(String brandName) throws SQLException;
public List<Brand> getAllBrands() throws SQLException;
}
| [
"turtlesoftpy@gmail.com"
] | turtlesoftpy@gmail.com |
09dbe2afb4fa2b4cb623fa9cf1c4e7320240c1ed | 1a01f79f50066c6faf3718b541bd7c7c5fa63f1f | /minecraft_server/pixelmon/comm/PixelmonDataPacket.java | 1ea0a48f009b22743fd4a96b025a3ddbcd512e1a | [] | no_license | Tashafi/Pixelmon | 01a799d470ab4e105538e5df3f91ca582e8ed91c | 9b3c8858fc2d3b9db4a621ebffc1b6fc0565776e | refs/heads/master | 2020-04-07T19:08:40.778999 | 2012-07-29T04:37:06 | 2012-07-29T04:37:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,657 | java | package pixelmon.comm;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import pixelmon.database.BaseStats;
import pixelmon.database.DatabaseStats;
import pixelmon.entities.pixelmon.helpers.PixelmonEntityHelper;
import pixelmon.enums.EnumType;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.DataWatcher;
import net.minecraft.src.MathHelper;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet;
import net.minecraft.src.forge.ISpawnHandler;
import net.minecraft.src.forge.IThrowableEntity;
import net.minecraft.src.forge.MinecraftForge;
import net.minecraft.src.forge.NetworkMod;
public class PixelmonDataPacket extends PixelmonPacket {
public int modID;
public int pokemonID;
public int nationalPokedexNumber;
public String name;
public String nickname;
public int lvl;
public int hp;
public int health;
public boolean isMale;
public boolean isFainted;
public int order;
public int numMoves;
public EnumType type1;
public EnumType type2;
public int HP;
public int Speed;
public int Attack;
public int Defence;
public int SpecialAttack;
public int SpecialDefence;
public int nextLvlXP;
public int boxNumber=0;
public boolean isShiny;
public PixelmonMovesetDataPacket[] moveset = new PixelmonMovesetDataPacket[4];
public PixelmonDataPacket() {
}
public PixelmonDataPacket(NBTTagCompound p, NetworkMod mod, EnumPackets packetType) {
this.packetType = packetType;
modID = MinecraftForge.getModID(mod);
pokemonID = p.getInteger("pixelmonID");
BaseStats b = DatabaseStats.GetBaseStats(p.getString("Name"));
nationalPokedexNumber = b.nationalPokedexNumber;
name = p.getString("Name");
nickname = p.getString("Nickname");
lvl = p.getInteger("Level");
nextLvlXP = p.getInteger("EXPToNextLevel");
hp = p.getInteger("StatsHP");
health = p.getShort("Health");
isMale = p.getBoolean("IsMale");
isFainted = p.getBoolean("IsFainted");
isShiny = p.getBoolean("IsShiny");
order = p.getInteger("PixelmonOrder");
numMoves = p.getInteger("PixelmonNumberMoves");
for (int i =0; i < numMoves; i++){
moveset[i] = PixelmonMovesetDataPacket.createPacket(p,i);
}
type1 = b.Type1;
type2 = b.Type2;
HP = p.getInteger("StatsHP");
Speed = p.getInteger("StatsSpeed");
Attack = p.getInteger("StatsAttack");
Defence = p.getInteger("StatsDefence");
SpecialAttack = p.getInteger("StatsSpecialAttack");
SpecialDefence = p.getInteger("StatsSpecialDefence");
if (p.hasKey("BoxNumber"))
boxNumber = p.getInteger("BoxNumber");
}
public PixelmonDataPacket(PixelmonEntityHelper p, NetworkMod mod, EnumPackets packetType) {
this.packetType = packetType;
modID = MinecraftForge.getModID(mod);
pokemonID = p.getPokemonId();
nationalPokedexNumber = p.stats.BaseStats.nationalPokedexNumber;
name = p.getName();
nickname = p.nickname;
lvl = p.getLvl().getLevel();
nextLvlXP = p.getLvl().getExpToNextLevel();
hp = p.stats.HP;
health = p.getHealth();
isMale = p.isMale;
isFainted = p.isFainted;
isShiny = p.getIsShiny();
order = 0;
if (p.moveset.size() ==0) p.loadMoveset();
numMoves = p.moveset.size();
for (int i =0; i < numMoves; i++){
moveset[i] = PixelmonMovesetDataPacket.createPacket(p.moveset,i);
}
type1 = p.getType().get(0);
if (p.getType().size()==1) type2 = EnumType.Mystery;
else type2 = p.getType().get(1);
HP = p.stats.HP;
Speed = p.stats.Speed;
Attack = p.stats.Attack;
Defence = p.stats.Defence;
SpecialAttack = p.stats.SpecialAttack;
SpecialDefence = p.stats.SpecialDefence;
}
public void writeData(DataOutputStream data) throws IOException {
data.writeInt(modID);
data.writeInt(pokemonID);
data.writeShort(nationalPokedexNumber);
Packet.writeString(name, data);
Packet.writeString(nickname, data);
data.writeShort(lvl);
data.writeShort(nextLvlXP);
data.writeShort(hp);
data.writeShort(health);
data.writeBoolean(isMale);
data.writeBoolean(isFainted);
data.writeShort(order);
data.writeShort(numMoves);
for (int i=0; i < numMoves; i++){
moveset[i].writeData(data);
}
data.writeShort(type1.getIndex());
data.writeShort(type2.getIndex());
data.writeShort(HP);
data.writeShort(Speed);
data.writeShort(Attack);
data.writeShort(Defence);
data.writeShort(SpecialAttack);
data.writeShort(SpecialDefence);
data.writeShort(boxNumber);
data.writeBoolean(isShiny);
}
public void readData(DataInputStream data) throws IOException {
modID = data.readInt();
pokemonID = data.readInt();
nationalPokedexNumber = data.readShort();
name = Packet.readString(data, 64);
nickname = Packet.readString(data, 64);
lvl = data.readShort();
nextLvlXP = data.readShort();
hp = data.readShort();
health = data.readShort();
isMale = data.readBoolean();
isFainted = data.readBoolean();
order = data.readShort();
numMoves = data.readShort();
for (int i=0; i < numMoves; i++){
moveset[i] = new PixelmonMovesetDataPacket();
moveset[i].readData(data);
}
type1 = EnumType.parseType(data.readShort());
type2 = EnumType.parseType(data.readShort());
HP = data.readShort();
Speed = data.readShort();
Attack = data.readShort();
Defence = data.readShort();
SpecialAttack = data.readShort();
SpecialDefence = data.readShort();
boxNumber = data.readShort();
isShiny = data.readBoolean();
}
@Override
public int getID() {
return packetType.getIndex();
}
}
| [
"malc.geddes@gmail.com"
] | malc.geddes@gmail.com |
bf09aa16d497c9d5d93429c9f761971e4430e7f6 | 4f2ed6dd839c6bf3fcc0ba7df0b8a601c17a601b | /include_KLU/app/src/main/java/com/klef/includeklu/de1.java | 40b1ade96893f9ec1b021d337d8ef4fc8a9af30f | [] | no_license | hemanth-431/Sample-Android-App-WorkSpace | 78addb2bd8921c0dd928af277dfc9200055c4882 | a6546d651dde2d403f7983390f1e5395b4b17fe5 | refs/heads/master | 2023-06-16T03:28:13.142502 | 2021-07-14T15:42:21 | 2021-07-14T15:42:21 | 385,994,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.klef.includeklu;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class de1 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_de1);
}
}
| [
"bandlavhemanth@gmail.com"
] | bandlavhemanth@gmail.com |
035dba1c80e6312295c4cb1a67188aa3212960dc | 51d86acf98cc4ffe61dac1f6054ebb733817eea3 | /tower-rule/src/main/java/com/tower/service/rule/ICallback.java | 1fed111d9f4436029e444a6e28dd4e54f123fd92 | [] | no_license | archlevel/tower | a8d083b6043ce48c545136036fc77fded63efa58 | 09dc664ec94ad65be35ab69fe7094ad45e12635e | refs/heads/master | 2022-12-23T12:58:05.557027 | 2020-04-17T00:46:32 | 2020-04-17T00:46:32 | 37,564,400 | 48 | 53 | null | 2016-07-20T05:40:11 | 2015-06-17T00:58:53 | Java | UTF-8 | Java | false | false | 94 | java | package com.tower.service.rule;
public interface ICallback<T> {
public void execute(T t);
}
| [
"zhugongping@mogoroom.com"
] | zhugongping@mogoroom.com |
513036b47c8ac739892576d2008ed17473d8812b | 4e5d61b632c452dafbfbe2bf47cfb1247877c729 | /Java Repository/Servlet/src/_08_Listener/request/ServletRequestListenMe.java | 1c1bc5853b8ab322dc444912e5de43ff91472b79 | [] | no_license | tugcankoparan/Java-EE-Spring-Framework | 520c943d472afe6266ddf15ed91dd3120c1768c0 | ca565dfd29287b33d61acfe477d6980ad69c0866 | refs/heads/master | 2020-03-30T11:16:10.432834 | 2018-10-18T17:19:46 | 2018-10-18T17:19:46 | 151,164,255 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package _08_Listener.request;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ServletRequestListenMe extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("Check Eclipse Console!");
}
}
| [
"tugcankoparan10@gmail.com"
] | tugcankoparan10@gmail.com |
1c9ddbdc94e9c8f9ef075e6c090c874855fdb8d8 | 3e80043aae6baeadbaa490276dc513b9a758dcd8 | /app/src/main/java/me/edanel/fulishe/Utils/JsonUtils.java | 3e86ce908747d0162c898d3c16c8e156aea57798 | [
"MIT"
] | permissive | digideskio/dbMeizi | a74607418ad4a98073d8fb812154b0c9153bbc43 | f5ef13097a3d22a787f671d1b49ab15a5dd6c2d4 | refs/heads/master | 2021-01-13T15:55:01.159271 | 2015-03-29T12:59:17 | 2015-03-29T12:59:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package me.edanel.fulishe.Utils;
import com.google.gson.Gson;
/**
* Created by Eggplant on 15-1-24.
*/
public class JsonUtils {
private static Gson gson;
private static JsonUtils instance;
/**
* gson 单例
*
* @return
*/
public static JsonUtils getInstance() {
if (gson == null) {
gson = new Gson();
}
return instance;
}
/**
* Json数据解析到Bean
*
* @param data
* @param Jclass
* @param <E>
* @return
*/
public static <E> E Json2Bean(String data, Class<E> Jclass) {
E e = null;
if (gson != null) {
e = gson.fromJson(data, Jclass);
}
return e;
}
}
| [
"hackdww@qq.com"
] | hackdww@qq.com |
fc7f66a4daa9425d3989720a87003aecafaa36da | 5fe9a241e31ccb8b503b12d9f3645c460db1e7c8 | /src/main/java/com/mitrais/chipper/temankondangan/backendapps/model/json/NotificationDataWrapper.java | 186c800c72f1d6157b10d5ce91692209be16750d | [] | no_license | chipper-dev/temankondangan-backend | 86f9c45509a635dd4df49e9de9f2162db6d61207 | 1d4e769a01e8f090659c8ddcb27747327dd8bb2a | refs/heads/master | 2021-05-18T08:17:28.832368 | 2020-08-28T03:28:33 | 2020-08-28T03:28:33 | 251,193,010 | 2 | 0 | null | 2020-08-28T03:28:35 | 2020-03-30T03:35:42 | Java | UTF-8 | Java | false | false | 435 | java | package com.mitrais.chipper.temankondangan.backendapps.model.json;
import com.mitrais.chipper.temankondangan.backendapps.model.Notification;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@Builder
@NoArgsConstructor
public class NotificationDataWrapper {
List<Notification> notifications;
Integer unreadCount;
}
| [
"yuliawanrizka.syafaat@mitrais.com"
] | yuliawanrizka.syafaat@mitrais.com |
27f92995af0dd7fe3c2485796bac5dc1db4bbce5 | 66eff605847124222cd5593ff8d712e68f78cc55 | /manifold-core-parent/manifold/src/main/java/manifold/util/JsonUtil.java | c2afcaac1500a9315c74731b13eb7bb5f06089ee | [
"Apache-2.0"
] | permissive | foolsh/manifold | f39d938cd1a2d7e03359395ccb412ea3895cba5a | 5b2710292c9babb597ded10112fd5b68acd8aede | refs/heads/master | 2020-06-23T19:22:24.071499 | 2019-07-24T04:04:37 | 2019-07-24T04:04:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,561 | java | /*
* Copyright (c) 2018 - Manifold Systems LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package manifold.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.Map;
import javax.script.Bindings;
/**
*/
public class JsonUtil
{
public static String makeIdentifier( String name )
{
String identifier = ReservedWordMapping.getIdentifierForName( name );
if( !identifier.equals( name ) )
{
return identifier;
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < name.length(); i++ )
{
char c = name.charAt( i );
if( i == 0 && Character.isDigit( c ) )
{
sb.append( '_' ).append( c );
}
else if( c == '_' || c == '$' || Character.isLetterOrDigit( c ) )
{
sb.append( c );
}
else
{
sb.append( '_' );
}
}
identifier = makeCorrections( sb );
return identifier;
}
private static String makeCorrections( StringBuilder sb )
{
String identifier = sb.toString();
if( isAllUnderscores( identifier ) )
{
identifier = "_" + identifier.length();
}
return identifier;
}
private static boolean isAllUnderscores( String result )
{
for( int i = 0; i < result.length(); i++ )
{
if( result.charAt( i ) != '_' )
{
return false;
}
}
return true;
}
/**
* Serializes this Map instance to a JSON formatted String
*/
public static String toJson( Map thisMap )
{
StringBuilder sb = new StringBuilder();
toJson( thisMap, sb, 0 );
return sb.toString();
}
/**
* Serializes this Map instance into a JSON formatted StringBuilder with the specified indent of spaces
*/
public static void toJson( Map thisMap, StringBuilder sb, int indent )
{
int iKey = 0;
if( isNewLine( sb ) )
{
indent( sb, indent );
}
sb.append( "{\n" );
if( thisMap.size() > 0 )
{
for( Object key : thisMap.keySet() )
{
indent( sb, indent + 2 );
sb.append( '\"' ).append( key ).append( '\"' ).append( ": " );
Object value = thisMap.get( key );
if( value instanceof Map )
{
toJson( (Map)value, sb, indent + 2 );
}
else if( value instanceof Iterable )
{
listToJson( sb, indent + 2, (Iterable)value );
}
else
{
appendValue( sb, value );
}
appendCommaNewLine( sb, iKey < thisMap.size() - 1 );
iKey++;
}
}
indent( sb, indent );
sb.append( "}" );
}
/**
* Build a JSON string from the specified {@code value}. The {@code value} must be a valid JSON value:
* <lu>
* <li>primitive, boxed primitive, or {@code String}</li>
* <li>{@code Iterable} of JSON values</li>
* <li>{@code Map} of JSON values</li>
* </lu>
* @return A JSON String reflecting the specified {@code value}
*/
public static String toJson( Object value )
{
StringBuilder target = new StringBuilder();
toJson( target, 0, value );
return target.toString();
}
/**
* Build a JSON string in the specified {@code target} from the specified {@code value} with the provided left
* {@code margin}. The {@code value} must be a valid JSON value:
* <lu>
* <li>primitive, boxed primitive, or {@code String}</li>
* <li>{@code Iterable} of JSON values</li>
* <li>{@code Map} of JSON values</li>
* </lu>
*/
public static void toJson( StringBuilder target, int margin, Object value )
{
if( value instanceof Pair )
{
value = ((Pair)value).getSecond();
}
if( value instanceof Map )
{
toJson( ((Map)value), target, margin );
}
else if( value instanceof Iterable )
{
listToJson( target, margin, (Iterable)value );
}
else
{
appendValue( target, value );
}
}
private static boolean isNewLine( StringBuilder sb )
{
return sb.length() > 0 && sb.charAt( sb.length() - 1 ) == '\n';
}
public static void listToJson( StringBuilder sb, int indent, Iterable value )
{
sb.append( '[' );
int i = 0;
for( Iterator iter = value.iterator(); iter.hasNext(); )
{
Object comp = iter.next();
if( i == 0 )
{
sb.append( "\n" );
}
if( comp instanceof Map )
{
toJson( (Map)comp, sb, indent + 2 );
}
else if( comp instanceof Iterable )
{
listToJson( sb, indent + 2, (Iterable)comp );
}
else
{
indent( sb, indent + 2 );
appendValue( sb, comp );
}
appendCommaNewLine( sb, iter.hasNext() );
i++;
}
indent( sb, indent );
sb.append( "]" );
}
/**
* Serializes a JSON-compatible List into a JSON formatted StringBuilder with the specified indent of spaces
*/
public static String listToJson( Iterable list )
{
StringBuilder sb = new StringBuilder();
listToJson( sb, 0, list );
return sb.toString();
}
private static void appendCommaNewLine( StringBuilder sb, boolean bComma )
{
if( bComma )
{
sb.append( ',' );
}
sb.append( "\n" );
}
private static void indent( StringBuilder sb, int indent )
{
int i = 0;
while( i < indent )
{
sb.append( ' ' );
i++;
}
}
public static StringBuilder appendValue( StringBuilder sb, Object comp )
{
if( comp instanceof String )
{
sb.append( '\"' );
sb.append( ManEscapeUtil.escapeForJavaStringLiteral( (String)comp ) );
sb.append( '\"' );
}
else if( comp instanceof Integer ||
comp instanceof Long ||
comp instanceof Double ||
comp instanceof Float ||
comp instanceof Short ||
comp instanceof Character ||
comp instanceof Byte ||
comp instanceof Boolean )
{
sb.append( comp );
}
else if( comp == null )
{
sb.append( "null" );
}
else
{
throw new IllegalStateException( "Unsupported expando type: " + comp.getClass() );
}
return sb;
}
public static String toXml( Object jsonValue )
{
StringBuilder sb = new StringBuilder();
toXml( jsonValue, "object", sb, 0 );
return sb.toString();
}
public static void toXml( Object jsonValue, String name, StringBuilder target, int indent )
{
if( jsonValue instanceof Map )
{
toXml( (Map)jsonValue, name, target, indent );
}
else if( jsonValue instanceof Iterable )
{
toXml( (Iterable)jsonValue, name, target, indent );
}
else
{
toXml( String.valueOf( jsonValue ), name, target, indent );
}
}
/**
* Serializes this {@link Map} instance into an XML formatted StringBuilder {@code target}
* with the specified {@code indent} of spaces.
*
* @param name The name of the root element to nest the Map XML
* @param target A {@link StringBuilder} to write the XML in
* @param indent The margin of spaces to indent the XML
*/
private static void toXml( Map bindings, String name, StringBuilder target, int indent )
{
indent( target, indent );
target.append( '<' ).append( name );
if( bindings.size() > 0 )
{
target.append( ">\n" );
for( Object key: bindings.keySet() )
{
Object value = bindings.get( key );
if( value instanceof Pair )
{
value = ((Pair)value).getSecond();
}
if( value instanceof Map )
{
toXml( (Map)value, key.toString(), target, indent + 2 );
}
else if( value instanceof Iterable )
{
toXml( (Iterable)value, key.toString(), target, indent + 2 );
}
else
{
toXml( String.valueOf( value ), key.toString(), target, indent + 2 );
}
}
indent( target, indent );
target.append( "</" ).append( name ).append( ">\n" );
}
else
{
target.append( "/>\n" );
}
}
private static void toXml( Iterable value, String name, StringBuilder target, int indent )
{
indent( target, indent );
target.append( "<" ).append( name );
Iterator iter = value.iterator();
if( iter.hasNext() )
{
target.append( ">\n" );
while( iter.hasNext() )
{
Object comp = iter.next();
if( comp instanceof Pair )
{
comp = ((Pair)comp).getSecond();
}
if( comp instanceof Bindings )
{
toXml( ((Bindings)comp), "li", target, indent + 4 );
}
else if( comp instanceof Iterable )
{
toXml( ((Iterable)comp), "li", target, indent + 4 );
}
else
{
indent( target, indent + 4 );
target.append( "<li>" ).append( comp ).append( "</li>\n" );
}
}
indent( target, indent + 2 );
target.append( "</" ).append( name ).append( ">\n" );
}
else
{
target.append( "/>\n" );
}
}
private static void toXml( String value, String name, StringBuilder target, int indent )
{
indent( target, indent );
target.append( '<' ).append( name ).append( ">" );
target.append( value );
target.append( "</" ).append( name ).append( ">\n" );
}
public static <E extends Map<String, Object>> Object deepCopyValue( Object value, Function<Integer, E> bindingsSupplier )
{
if( value instanceof Map )
{
Map<String, Object> dataMap = (Map)value;
Map<String, Object> copy = bindingsSupplier.apply( dataMap.size() );
dataMap.forEach( ( k, v ) -> copy.put( k, deepCopyValue( v, bindingsSupplier ) ) );
return copy;
}
if( value instanceof Iterable )
{
//noinspection unchecked
Iterable<Object> list = (Iterable<Object>)value;
List<Object> copy = new ArrayList<>();
list.forEach( e -> copy.add( deepCopyValue( e, bindingsSupplier ) ) );
return copy;
}
return value;
}
}
| [
"rsmckinney@hotmail.com"
] | rsmckinney@hotmail.com |
99e656535da10a2cad0e63302eb6c769e9a7d099 | ebc0fcb133fb3fe6f4f9b833122bfc3658ecc6db | /tdw.refactoring.video-rental-shop-it/src/test/java/net/demengel/refactoring/vrs/it/driver/TableChecker.java | 8978548fceb478b47ac82dd2a2d172107351595d | [] | no_license | ndemengel/tdw.refactoring.video-rental-shop | 5f5e7455465b59e1b16747e68e1d796ad6ebdb48 | 63a3008bef77494b0f614cc2ee243bdd90b86d08 | refs/heads/master | 2020-05-17T17:20:56.538557 | 2012-11-04T17:35:47 | 2012-11-04T17:35:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,717 | java | package net.demengel.refactoring.vrs.it.driver;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Lists.newArrayList;
import static java.util.Arrays.asList;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assert.fail;
import java.util.List;
import com.google.common.base.Predicate;
public class TableChecker<TC extends TableChecker<TC>> {
private static final String NL = System.getProperty("line.separator");
private final String tableContentDescription;
private String descriptionSoFar;
private List<String[]> matchingLines;
private boolean firstCheck = true;
TableChecker(String tableContentDescription, String[][] tableContents, int expectedColumnCount) {
assertThat(tableContents).as(tableContentDescription).isNotEmpty();
assertThat(tableContents[0]).as("number of columns for " + tableContentDescription).hasSize(expectedColumnCount);
this.tableContentDescription = tableContentDescription;
this.descriptionSoFar = "no " + tableContentDescription + " with ";
this.matchingLines = asList(tableContents);
}
public final TC withColumn(String columnName, final int columnIndex, final String expectedValue) {
String checkDescription = columnName + " = " + expectedValue;
if (firstCheck) {
firstCheck = false;
}
else {
descriptionSoFar += " and ";
}
descriptionSoFar += checkDescription;
List<String[]> newMatchingLines = keepLinesWhereColumnHasValue(columnIndex, expectedValue);
if (newMatchingLines.isEmpty()) {
fail(errorDescriptionFrom(checkDescription));
}
matchingLines = newMatchingLines;
@SuppressWarnings("unchecked")
TC thisChecker = (TC) this;
return thisChecker;
}
private List<String[]> keepLinesWhereColumnHasValue(final int columnIndex, final String expectedValue) {
List<String[]> newMatchingLines = newArrayList(filter(matchingLines, new Predicate<String[]>() {
public boolean apply(String[] row) {
return row[columnIndex].equals(expectedValue);
}
}));
return newMatchingLines;
}
private String errorDescriptionFrom(String checkDescription) {
StringBuilder sb = new StringBuilder(descriptionSoFar).append(NL).append(NL);
sb.append(tableContentDescription + " before filtering for ").append(checkDescription).append(":").append(NL);
for (String[] line : matchingLines) {
sb.append(" ").append(asList(line)).append(NL);
}
return sb.toString();
}
}
| [
"nicolas.demengel@gmail.com"
] | nicolas.demengel@gmail.com |
420bc6cb4c0ae4dc8713d0476d4e14d2e3255c9a | f59d84e41033cd653ea2b0eaefec457b00ddbbb5 | /src/g39189/gameover/model/Game.java | 3dc6f9828d2319c001c0b1c60c5138513e017a7b | [] | no_license | Astalaseven/GameOver | 3080c569367b83897f21d46f20feb9422a410b47 | 64c6225cc2a0fe44043479ece2ef41ee5a7b012a | refs/heads/master | 2020-04-06T04:22:19.117586 | 2014-09-20T13:58:36 | 2014-09-20T13:58:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,414 | java | package g39189.gameover.model;
import java.util.ArrayList;
/**
* Cette classe représente une partie. Une partie se finit
* lorsqu’un joueur trouve la princesse de sa couleur et une clé.
*
* @author Bovyn Gatien - 39189
*/
public class Game
{
/**
* Nombre minimal de joueurs nécessaires
*/
public final static int MIN_PLAYER = 2;
/**
* Nombre maximal de joueurs nécessaires
*/
public final static int MAX_PLAYER = 4;
private Dungeon dungeon;
private int idCurrent;
private int idWinner;
private boolean jokerUsed;
private boolean keyFound;
private DungeonPosition lastPosition;
private ArrayList<Player> players;
private boolean princessFound;
private BarbarianState stateCurrent;
/**
* Initialise une partie.
*
* @param names
* noms des joueurs
* @throws GameOverException
* si le nb de joueurs n’est pas compris
* entre 2 et 4 inclus.
*/
public Game(String... names) throws GameOverException
{
players = new ArrayList<>();
for (String info : names)
{
if (info == null)
{
break;
}
boolean beginner = info.endsWith(" débutant");
String name = info.replace(" débutant", "");
Player player = new Player(name, beginner);
players.add(player);
}
if ((players.size() < MIN_PLAYER) || (players.size() > MAX_PLAYER))
{
throw new GameOverException("Nombre de concurrents invalide");
}
dungeon = Dungeon.getInstance();
idCurrent = 0;
idWinner = -1;
jokerUsed = false;
keyFound = false;
lastPosition = players.get(0).getInitPosition();
princessFound = false;
stateCurrent = BarbarianState.READY_TO_GO;
}
/**
* Retourne le joueur courant.
*
* @return le joueur actuel
*/
public Player getCurrentPlayer()
{
return players.get(idCurrent);
}
/**
* Retourne l’état du joueur.
*
* @return l’état du joueur
*/
public BarbarianState getCurrentState()
{
return stateCurrent;
}
/**
* Retourne le donjon.
*
* @return le plateau de jeu
*/
public Dungeon getDungeon()
{
return dungeon;
}
/**
* Retourne la dernière position.
*
* @return la dernière position
*/
public DungeonPosition getLastPosition()
{
return lastPosition;
}
/**
* Retourne le joueur gagnant.
*
* @return le joueur gagnant si la partie est finie, sinon null
*/
public Player getWinner()
{
return (isOver() ? players.get(idWinner) : null);
}
/**
* Indique si la partie est finie.
*
* @return vrai si le joueur a trouvé une clé et sa princesse, faux sinon
*/
public boolean isOver()
{
return (idWinner != -1);
}
/**
* Passe au joueur suivant.
*/
public void nextPlayer()
{
++idCurrent;
if (idCurrent >= players.size())
{
idCurrent = 0;
}
dungeon.hideAll();
jokerUsed = false;
keyFound = false;
lastPosition = getCurrentPlayer().getInitPosition();
princessFound = false;
stateCurrent = BarbarianState.READY_TO_GO;
}
/**
* Exécute le coup d’un joueur.
*
* @param dir
* la direction vers laquelle le joueur souhaite se déplacer
* @param weapon
* l’arme choisie par le joueur
* @return faux si le joueur ne peut pas vaincre la carte dévoilée, vrai
* sinon
* @throws GameOverException
* si la partie est finie ou si la carte sur laquelle le joueur
* se déplace a déjà été retournée
*/
public BarbarianState play(Direction dir, WeaponType weapon)
throws GameOverException
{
if (isOver())
{
throw new GameOverException("La partie est finie");
}
if ((stateCurrent != BarbarianState.CONTINUE)
&& (stateCurrent != BarbarianState.READY_TO_GO))
{
throw new GameOverException("Le joueur ne peut pas jouer");
}
// Si la partie n’est pas finie, fait le mouvement
DungeonPosition newPos = lastPosition.move(dir);
Room room = dungeon.getRoom(newPos);
if (!room.isHidden())
{
throw new GameOverException("Carte déjà retournée");
}
lastPosition = newPos;
stateCurrent = play(lastPosition, weapon);
// Si le joueur a trouvé une clé et sa princesse, il a gagné et
// la partie est finie
if (keyFound && princessFound)
{
idWinner = idCurrent;
stateCurrent = BarbarianState.WIN;
}
return stateCurrent;
}
private BarbarianState play(DungeonPosition pos, WeaponType weapon)
throws GameOverException
{
lastPosition = pos;
Player player = getCurrentPlayer();
Room room = dungeon.getRoom(lastPosition);
if (!room.isHidden())
{
throw new GameOverException("Carte déjà retournée");
}
stateCurrent = BarbarianState.CONTINUE;
switch (room.getType())
{
case BLORK:
stateCurrent = playBlork(room, weapon);
break;
case GATE:
stateCurrent = BarbarianState.BEAM_ME_UP;
break;
case KEY:
keyFound = true;
break;
case PRINCESS:
if (room.getColor() == player.getColor())
{
princessFound = true;
}
break;
default:
break;
}
if (stateCurrent != BarbarianState.JOKER)
{
dungeon.show(lastPosition);
}
return stateCurrent;
}
private BarbarianState playBlork(Room room, WeaponType weapon)
{
if (room.getWeapon() == null)
{
stateCurrent = BarbarianState.MOVE_BLORK;
}
// Si le joueur n’a pas la bonne arme, il perd son tour
else if (room.getWeapon() != weapon)
{
// sauf s’il a un joker
if (getCurrentPlayer().isBeginner() && !jokerUsed)
{
stateCurrent = BarbarianState.JOKER;
}
else
{
stateCurrent = BarbarianState.GAMEOVER;
}
}
return stateCurrent;
}
/** Traite le cas où le joker est activé et que le joueur peut
* retenter sa chance avec une autre arme.
*
* @param weapon l’arme du joueur
* @return le nouvel état du jeu
* @throws GameOverException si une erreur survient durant
* le coup
*/
public BarbarianState playJoker(WeaponType weapon) throws GameOverException
{
jokerUsed = true;
return play(lastPosition, weapon);
}
/** Traite le cas où un joueur tombe sur une porte et peut se
* déplacer.
*
* @param pos la nouvelle position du joueur
* @param weapon l’arme du joueur
* @return le nouveau statut de la partie
* @throws GameOverException si le statut actuel de la partie
* n’est pas BEAM_ME_UP ou que la partie est finie ou qu’une
* erreur survient durant le coup
*/
public BarbarianState playGate(DungeonPosition pos, WeaponType weapon)
throws GameOverException
{
if (stateCurrent != BarbarianState.BEAM_ME_UP)
{
throw new GameOverException("Statut incorrect, devrait être"
+ " : BEAM_ME_UP");
}
if (isOver())
{
throw new GameOverException("La partie est terminée");
}
return play(pos, weapon);
}
/** Traite le cas où un joueur rencontre un blork invincible
* et peut le changer de place.
*
* @param pos la position où déplacer le blork invincible
* @return BarbarianState.CONTINUE si le joueur est débutant
* et qu’il n’avait pas encore utilisé son joker, sinon
* BarbarianState.GAMEOVER.
* @throws GameOverException si le statut actuel de la partie
* n’est pas MOVE_BLORK ou que la partie est finie
*/
public BarbarianState playBlorkInvincible(DungeonPosition pos)
throws GameOverException
{
if (stateCurrent != BarbarianState.MOVE_BLORK)
{
throw new GameOverException("Statut incorrect, devrait être"
+ " : MOVE_BLORK");
}
if (isOver())
{
throw new GameOverException("La partie est terminée");
}
if (pos.isCorner())
{
throw new GameOverException("La nouvelle position ne peut pas"
+ " être dans un coin");
}
dungeon.swap(lastPosition, pos);
dungeon.show(lastPosition);
if (getCurrentPlayer().isBeginner() && !jokerUsed)
{
jokerUsed = true;
stateCurrent = BarbarianState.CONTINUE;
}
else
{
stateCurrent = BarbarianState.GAMEOVER;
}
return stateCurrent;
}
/**
* Supprime tous les joueurs et remet à zéro le compteur.
*/
void deletePlayers()
{
Player.resetN();
players.clear();
}
/**
* Mutateur prévu pour les tests.
*
* @param dungeon
* un donjon personnalisé
*/
void setDungeon(Dungeon dungeon)
{
this.dungeon = dungeon;
}
}
| [
"gatien.bovyn@gmail.com"
] | gatien.bovyn@gmail.com |
e1de2cd605d5f8281693043f29c93d3b756d033b | 98843786dd6cf8c6a26c48c26ef239207eeb4a21 | /cas-demo/cas-seckill/src/main/java/com/cas/casseckill/config/CasConfig.java | 9856090d74403848545998ae5ddb1fa5f98cb49d | [] | no_license | ZzouYu/springbootcas | 0cb4d3c0c222b46cec5e2fb87f93e458728b57b5 | ac4e5bfaa2253e3bc7f06889658ed1b4873be9a4 | refs/heads/master | 2022-11-13T20:50:24.366050 | 2020-06-26T17:39:24 | 2020-06-26T17:39:24 | 260,100,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,430 | java | package com.cas.casseckill.config;
import org.jasig.cas.client.authentication.AuthenticationFilter;
import org.jasig.cas.client.session.SingleSignOutFilter;
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
import org.jasig.cas.client.util.HttpServletRequestWrapperFilter;
import org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
/**
* @author zouyu
* @description
* @date 2020/4/29
*/
@Configuration
public class CasConfig {
@Value("${spring.cas.casServerUrl}")
private String serverUrl;
@Value("${spring.cas.casClientUrl}")
private String clientUrl;
@Value("${server.port}")
private String port;
@Value("${ignore-host-url}")
private String ignoreHostUrl;
private static boolean casEnabled = true;
/**
* 用于实现单点登出功能
*/
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
listener.setEnabled(casEnabled);
listener.setListener(new SingleSignOutHttpSessionListener());
listener.setOrder(1);
return listener ;
}
/**
* 该过滤器用于实现单点登出功能,单点退出配置,一定要放在其他filter之前
*/
@Bean
public FilterRegistrationBean singleSignOutFilter() {
FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
filterRegistration.setFilter(new SingleSignOutFilter());
filterRegistration.setEnabled(casEnabled);
filterRegistration.addUrlPatterns("/*" );
filterRegistration.addInitParameter("casServerUrlPrefix" ,"http://"+serverUrl+"cas");
filterRegistration.setOrder(2);
return filterRegistration ;
}
/**
* 授权过滤器
* @return
*/
@Bean
public FilterRegistrationBean filterAuthenticationRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new AuthenticationFilter());
// 设定匹配的路径
registration.addUrlPatterns("/*");
Map<String,String> initParameters = new HashMap<>();
initParameters.put("casServerLoginUrl", "http://"+serverUrl+"/cas/login");
initParameters.put("serverName","http://"+clientUrl+":"+port);
//忽略的url,"|"分隔多个url
initParameters.put("ignorePattern", ignoreHostUrl);
registration.setInitParameters(initParameters);
// 设定加载的顺序
registration.setOrder(3);
return registration;
}
/**
* description:过滤验证器
* * @param: []
* @return: org.springframework.boot.web.servlet.FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean filterValidationRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new Cas30ProxyReceivingTicketValidationFilter());
// 设定匹配的路径
registration.addUrlPatterns("/*");
Map<String,String> initParameters = new HashMap<String, String>();
initParameters.put("casServerUrlPrefix", "http://"+serverUrl+"/cas");
initParameters.put("serverName", "http://"+clientUrl+":"+port);
initParameters.put("useSession", "true");
registration.setInitParameters(initParameters);
// 设定加载的顺序
registration.setOrder(4);
return registration;
}
/**
* wraper过滤器
* @return
*/
@Bean
public FilterRegistrationBean filterWrapperRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new HttpServletRequestWrapperFilter());
// 设定匹配的路径
registration.addUrlPatterns("/*");
// 设定加载的顺序
registration.setOrder(5);
return registration;
}
}
| [
"zouyu@tellhow.com"
] | zouyu@tellhow.com |
884fd41f2979793c5209be2c3900ab252f8d113f | f8029ef7f55ee2e0ddf2bb9c76fa50808eabeb13 | /app/src/main/java/com/example/cmput301f21t39/Pentagon.java | 739be39baf186a25c7526b7940b76c9bfc66da84 | [] | no_license | CMPUT301F21T39/CMPUT301F21T39 | 18ce344ea494db91f97a977bd11ae247964c4687 | 995564137713bee50d29881b2bef25da03d83373 | refs/heads/main | 2023-08-15T15:01:37.291381 | 2021-10-04T17:28:03 | 2021-10-04T17:28:03 | 412,259,989 | 0 | 0 | null | 2021-10-04T17:28:04 | 2021-09-30T23:27:54 | Java | UTF-8 | Java | false | false | 447 | java | package com.example.cmput301f21t39;
public class Pentagon extends Shape
{
private int sideA;
private int sideB;
private int sideC;
private int sideD;
private int sideE;
Pentagon(int x, int y, int sideA, int sideB, int sideC, int sideD, int sideE)
{
super(x,y);
this.sideA = sideA;
this.sideB = sideB;
this.sideC = sideC;
this.sideD = sideD;
this.sideE = sideE;
}
}
| [
"daisywklau@hotmail.com"
] | daisywklau@hotmail.com |
968dfd75583d5c22232572a4a9e6d8556fcf4233 | 686123f5e6cdadfe0e463d8d9b5a39091e87a58d | /Data_Structures/src/main/java/Stack/BalancedParenthesis.java | 5dd022cc3dce522221788eea193a39f3ab90e424 | [] | no_license | Motahharul-Haque/DSA | 7790cec68f9afcd4a868ccdf97c69fc6e8b079ea | 568eb240ffd1506ddf95d3299f2889b4f81ab12b | refs/heads/master | 2023-08-11T07:55:32.261432 | 2021-09-29T19:57:45 | 2021-09-29T19:57:45 | 310,914,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package Stack;
import java.util.ArrayDeque;
import java.util.Deque;
public class BalancedParenthesis {
public static boolean matching(char a, char b) {
return ((a == '(' && b == ')') || (a == '[' && b == ']') || (a == '{' && b == '}'));
}
public static boolean isBalanced(String str) {
Deque<Character> s = new ArrayDeque<>();
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == '(' || str.charAt(i) == '[' || str.charAt(i) == '{') {
s.add(str.charAt(i));
}
else{
if (s.isEmpty() == true) {
return false;
}
else if (matching(s.peek(), str.charAt(i)) == false) {
return false;
}
else {
s.pop();
}
}
}
return (s.isEmpty() == true);
}
public static void main (String[] args) {
String str = "((()))";
if (isBalanced(str))
System.out.print("Balanced");
else
System.out.print("Not Balanced");
}
}
| [
"mdmotahharul.haque@gmail.com"
] | mdmotahharul.haque@gmail.com |
72216c1c9e420a53361a27a6700ed764d07e15fd | 184eb3780ea8619ee44ebca31d470ef6d1f46a6a | /src/main/java/com/example/demo/controller/KafkaController.java | 3adef74cb25f985c27db4c8399477658d41e0773 | [] | no_license | fancky2019/SpringBootProject | f2ffab05f5af805efd74baf5600b602ee26bcd6a | 635e74813f45876bfa0764c405598c170440e488 | refs/heads/master | 2023-08-12T03:48:06.909002 | 2023-07-22T04:18:21 | 2023-07-22T04:18:21 | 162,677,730 | 0 | 0 | null | 2022-06-20T22:46:20 | 2018-12-21T06:54:06 | Java | UTF-8 | Java | false | false | 805 | java | package com.example.demo.controller;
import com.example.demo.kafka.KafkaTest;
import com.example.demo.model.viewModel.MessageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//测试时候把kafka相关类的@Component注解放开
@RestController
@RequestMapping("/kafka")
public class KafkaController {
// @Autowired
// private KafkaTest kafkaTest;
@GetMapping("")
public MessageResult<Void> kafkaTest() {
try {
// kafkaTest.test();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return null;
}
}
| [
"709737588@qq.com"
] | 709737588@qq.com |
748b13cd538f34085dee57ecdbcbb45daae93457 | 445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602 | /aliyun-java-sdk-config/src/main/java/com/aliyuncs/config/model/v20190108/GetDiscoveredResourceCountsRequest.java | c0dc35496da09a111e951952f984636bf9ba9167 | [
"Apache-2.0"
] | permissive | caojiele/aliyun-openapi-java-sdk | b6367cc95469ac32249c3d9c119474bf76fe6db2 | ecc1c949681276b3eed2500ec230637b039771b8 | refs/heads/master | 2023-06-02T02:30:02.232397 | 2021-06-18T04:08:36 | 2021-06-18T04:08:36 | 172,076,930 | 0 | 0 | NOASSERTION | 2019-02-22T14:08:29 | 2019-02-22T14:08:29 | null | UTF-8 | Java | false | false | 2,243 | java | /*
* 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.aliyuncs.config.model.v20190108;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.config.Endpoint;
/**
* @author auto create
* @version
*/
public class GetDiscoveredResourceCountsRequest extends RpcAcsRequest<GetDiscoveredResourceCountsResponse> {
private Boolean multiAccount;
private String groupByKey;
private Long memberId;
public GetDiscoveredResourceCountsRequest() {
super("Config", "2019-01-08", "GetDiscoveredResourceCounts", "Config");
setMethod(MethodType.GET);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public Boolean getMultiAccount() {
return this.multiAccount;
}
public void setMultiAccount(Boolean multiAccount) {
this.multiAccount = multiAccount;
if(multiAccount != null){
putQueryParameter("MultiAccount", multiAccount.toString());
}
}
public String getGroupByKey() {
return this.groupByKey;
}
public void setGroupByKey(String groupByKey) {
this.groupByKey = groupByKey;
if(groupByKey != null){
putQueryParameter("GroupByKey", groupByKey);
}
}
public Long getMemberId() {
return this.memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
if(memberId != null){
putQueryParameter("MemberId", memberId.toString());
}
}
@Override
public Class<GetDiscoveredResourceCountsResponse> getResponseClass() {
return GetDiscoveredResourceCountsResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
43bdf88b9ec09355c2011b4672f37915e00ad45a | d78b796876c75783a2cab3e187adce88ed617189 | /src/main/java/rocketrestapi/RocketCountdownException.java | c15740db897bf017e86db5dece0f91adfa41a80f | [
"MIT"
] | permissive | Aaron23145/RocketRestApi | d4d7ae3896277b86ec853679d0e3fcb82244e345 | ef69f46534c300d8e4c9089edf2ef1e562c3bfca | refs/heads/master | 2020-05-20T13:40:41.947869 | 2019-05-11T16:23:21 | 2019-05-11T16:23:21 | 185,604,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package rocketrestapi;
public class RocketCountdownException extends Exception {
private static final long serialVersionUID = 1L;
}
| [
"aaronarrieropelaez99@gmail.com"
] | aaronarrieropelaez99@gmail.com |
9f07c40f14a586f57425133ad1ddc1c3771da6b0 | f5c1cf6e930ac3a51b7f35775e379957cf3257e3 | /src/RequisicaoCompraLivro.java | 63cc446e0cddfbb750459ed9b9da1d521491edee | [] | no_license | LuckeLucky/Projeto-ES1 | 202cfd1a0c2bfb90ec709682d8335a3910cb599c | addcd5c378204c870b481b46a30d51a1cd8466c2 | refs/heads/master | 2020-05-23T02:35:24.741625 | 2019-06-19T17:11:16 | 2019-06-19T17:11:16 | 186,607,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | import java.time.LocalDate;
public class RequisicaoCompraLivro extends RequisicaoCompra {
private PropostaAquisicao propostaAquisicao;
public RequisicaoCompraLivro(String estado, LocalDate data, String oficio,PropostaAquisicao propostaAquisicao, Livro livro, Utilizador utilizador) {
super(estado, data, oficio, livro, utilizador);
this.propostaAquisicao = propostaAquisicao;
}
public PropostaAquisicao getPropostaAquisicao() {
return propostaAquisicao;
}
}
| [
"ricky.tomas99@gmail.com"
] | ricky.tomas99@gmail.com |
0f26723f2ed3c56575d65f9afa157de16d0d1888 | 4c5b20875aaf3dc3dba56902e1a805d43ef0b3a5 | /demo-2.4.16/src/main/java/examples/WebControl.java | 5b389b4c4f37dea68629661f1cdfc5095c93ba11 | [] | no_license | ev3dev-lang-java/examples | c85e25350569dc790038ed09ef142790a5060b8d | 73d207511fa027699b9ad9fcb7223a5418eb2875 | refs/heads/master | 2021-06-01T17:25:29.684532 | 2021-04-23T19:55:37 | 2021-04-23T19:55:37 | 57,417,352 | 7 | 8 | null | 2021-04-23T19:55:38 | 2016-04-29T22:49:25 | Java | UTF-8 | Java | false | false | 2,493 | java | package examples;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
@Slf4j
public class WebControl {
//public static Logger LOGGER = LoggerFactory.getLogger(WebControl.class);
public static final int PORT = 9000;
private ServerSocket ss;
private Socket sock;
private final DisplayAnimations displayAnimations;
public WebControl(DisplayAnimations displayAnimations) throws IOException {
LOGGER.info("Creating a simple API");
ss = new ServerSocket(PORT);
this.displayAnimations = displayAnimations;
}
public void run() throws IOException {
for (;;) {
sock = ss.accept();
InputStream is = sock.getInputStream();
OutputStream os = sock.getOutputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
PrintStream ps = new PrintStream(os);
for (;;) {
String cmd = br.readLine();
if (cmd == null)
break;
String reply = execute(cmd);
if (reply != null)
ps.println(reply);
else {
br.close();
ps.close();
break;
}
}
}
}
public String execute(String cmd) {
String[] tokens = cmd.split(" ");
if (tokens.length > 1 && tokens[0].equals("GET")) {
if (tokens[1].equals("/stop")) {
LOGGER.info("{}", tokens[1]);
System.exit(0);
} else if (tokens[1].equals("/left")) {
LOGGER.info("{}", tokens[1]);
displayAnimations.sin();
displayAnimations.clear();
displayAnimations.showJavaLogo();
} else if (tokens[1].equals("/right")) {
LOGGER.info("{}", tokens[1]);
displayAnimations.sin2();
displayAnimations.clear();
displayAnimations.showJavaLogo();
}
return "HTTP/1.1 200 OK\r\n\r\n" + readFile() + "\r\n";
}
return null;
}
private String readFile() {
StringBuffer document = new StringBuffer();
try {
InputStream in = this.getClass().getClassLoader().getResourceAsStream("index.html");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in), 1);
String line;
while ((line = bufferedReader.readLine()) != null) {
document.append(line);
}
in.close();
}catch (IOException io) {
LOGGER.error(io.getLocalizedMessage());
}
return document.toString();
}
} | [
"bren@juanantonio.info"
] | bren@juanantonio.info |
2fca0d0314eac1a810be2600f7ed6197bc062468 | 57500dc946586b24c1403fce41ca4b549353ed35 | /app/src/main/java/com/healthclock/healthclock/widget/RoundImageView.java | be0d1dd95c38d09f466be99bff72ebb24cfffe2f | [] | no_license | sengeiou/Healthclock | 86cbf4099459ef05b83ac890467880a3510a1b8c | 054631c0a2152513e3d9d4d9e3a78217662ace55 | refs/heads/master | 2022-01-16T03:16:48.152916 | 2019-06-13T02:08:04 | 2019-06-13T02:08:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,806 | java | package com.healthclock.healthclock.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.ImageView;
import com.healthclock.healthclock.R;
/**
* 自定义的圆角矩形ImageView
*/
@SuppressLint("AppCompatCustomView")
public class RoundImageView extends ImageView {
/**
* 图片的类型,圆形or圆角
*/
private int type;
public static final int TYPE_CIRCLE = 0;
public static final int TYPE_ROUND = 1;
public static final int TYPE_OVAL = 2;
/**
* 描边的颜色、宽度
*/
private int mBorderColor;
private float mBorderWidth;
private int mProgressColor = R.color.gray;
/**
* 圆角的大小
*/
private float mCornerRadius;
//左上角圆角大小
private float mLeftTopCornerRadius;
//右上角圆角大小
private float mRightTopCornerRadius;
//左下角圆角大小
private float mLeftBottomCornerRadius;
//右下角圆角大小
private float mRightBottomCornerRadius;
/**
* 绘图的Paint
*/
private Paint mBitmapPaint;
private Paint mBorderPaint;
/**
* 圆角的半径
*/
private float mRadius;
/**
* 3x3 矩阵,主要用于缩小放大
*/
private Matrix mMatrix;
/**
* 渲染图像,使用图像为绘制图形着色
*/
private BitmapShader mBitmapShader;
/**
* view的宽度
*/
private int mWidth;
/**
* 圆角图片区域
*/
private RectF mRoundRect;
private Path mRoundPath;
private int mBorderProgress = 0;
private static int num = 1;
public RoundImageView(Context context) {
this(context, null);
}
public RoundImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView, defStyleAttr, 0);
type = a.getInt(R.styleable.RoundImageView_type, TYPE_ROUND);
mBorderColor = a.getColor(R.styleable.RoundImageView_border_color, Color.WHITE);
mBorderWidth = a.getDimension(R.styleable.RoundImageView_border_width, 0);
mCornerRadius = a.getDimension(R.styleable.RoundImageView_corner_radius, dp2px(10));
mLeftTopCornerRadius = a.getDimension(R.styleable.RoundImageView_leftTop_corner_radius, 0);
mLeftBottomCornerRadius = a.getDimension(R.styleable.RoundImageView_leftBottom_corner_radius, 0);
mRightTopCornerRadius = a.getDimension(R.styleable.RoundImageView_rightTop_corner_radius, 0);
mRightBottomCornerRadius = a.getDimension(R.styleable.RoundImageView_rightBottom_corner_radius, 0);
a.recycle();
init();
}
private void init() {
mRoundPath = new Path();
mMatrix = new Matrix();
mBitmapPaint = new Paint();
mBitmapPaint.setAntiAlias(true);
mBorderPaint = new Paint();
mBorderPaint.setAntiAlias(true);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setStrokeCap(Paint.Cap.ROUND);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
/**
* 如果类型是圆形,则强制改变view的宽高一致,以小值为准
*/
if (type == TYPE_CIRCLE) {
mWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec),
MeasureSpec.getSize(heightMeasureSpec));
mRadius = mWidth / 2 - mBorderWidth / 2;
setMeasuredDimension(mWidth, mWidth);
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
// 圆角图片的范围
if (type == TYPE_ROUND || type == TYPE_OVAL) {
mRoundRect = new RectF(mBorderWidth / 2, mBorderWidth / 2, w - mBorderWidth / 2, h - mBorderWidth / 2);
}
}
@Override
protected void onDraw(Canvas canvas) {
mBorderPaint.setColor(mBorderColor);
mBorderPaint.setStrokeWidth(mBorderWidth);
if (getDrawable() == null) {
return;
}
setUpShader();
if (type == TYPE_ROUND) {
setRoundPath();
canvas.drawPath(mRoundPath, mBitmapPaint);
//绘制描边
canvas.drawPath(mRoundPath, mBorderPaint);
} else if (type == TYPE_CIRCLE) {
canvas.drawCircle(mRadius + mBorderWidth / 2, mRadius + mBorderWidth / 2, mRadius, mBitmapPaint);
//绘制描边
canvas.drawCircle(mRadius + mBorderWidth / 2, mRadius + mBorderWidth / 2, mRadius, mBorderPaint);
//进度
mBorderPaint.setColor(getResources().getColor(mProgressColor));
RectF rect = new RectF(mBorderWidth/2,mBorderWidth/2,mRadius*2 + mBorderWidth/2,mRadius*2 + mBorderWidth/2);
canvas.drawArc(rect,-90,mBorderProgress,false,mBorderPaint);
} else {
canvas.drawOval(mRoundRect, mBitmapPaint);
canvas.drawOval(mRoundRect, mBorderPaint);
}
}
private void setRoundPath() {
mRoundPath.reset();
/**
* 如果四个圆角大小都是默认值0,
* 则将四个圆角大小设置为mCornerRadius的值
*/
if (mLeftTopCornerRadius == 0 &&
mLeftBottomCornerRadius == 0 &&
mRightTopCornerRadius == 0 &&
mRightBottomCornerRadius == 0) {
mRoundPath.addRoundRect(mRoundRect,
new float[]{mCornerRadius, mCornerRadius,
mCornerRadius, mCornerRadius,
mCornerRadius, mCornerRadius,
mCornerRadius, mCornerRadius},
Path.Direction.CW);
} else {
mRoundPath.addRoundRect(mRoundRect,
new float[]{mLeftTopCornerRadius, mLeftTopCornerRadius,
mRightTopCornerRadius, mRightTopCornerRadius,
mRightBottomCornerRadius, mRightBottomCornerRadius,
mLeftBottomCornerRadius, mLeftBottomCornerRadius},
Path.Direction.CW);
}
}
/**
* 初始化BitmapShader
*/
private void setUpShader() {
Drawable drawable = getDrawable();
if (drawable == null) {
return;
}
Bitmap bmp = drawableToBitamp(drawable);
// 将bmp作为着色器,就是在指定区域内绘制bmp
mBitmapShader = new BitmapShader(bmp, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
float scale = 1.0f;
if (type == TYPE_CIRCLE) {
// 拿到bitmap宽或高的小值
int bSize = Math.min(bmp.getWidth(), bmp.getHeight());
scale = mWidth * 1.0f / bSize;
//使缩放后的图片居中
float dx = (bmp.getWidth() * scale - mWidth) / 2;
float dy = (bmp.getHeight() * scale - mWidth) / 2;
mMatrix.setTranslate(-dx, -dy);
} else if (type == TYPE_ROUND || type == TYPE_OVAL) {
if (!(bmp.getWidth() == getWidth() && bmp.getHeight() == getHeight())) {
// 如果图片的宽或者高与view的宽高不匹配,计算出需要缩放的比例;缩放后的图片的宽高,一定要大于我们view的宽高;所以我们这里取大值;
scale = Math.max(getWidth() * 1.0f / bmp.getWidth(),
getHeight() * 1.0f / bmp.getHeight());
//使缩放后的图片居中
float dx = (scale * bmp.getWidth() - getWidth()) / 2;
float dy = (scale * bmp.getHeight() - getHeight()) / 2;
mMatrix.setTranslate(-dx, -dy);
}
}
// shader的变换矩阵,我们这里主要用于放大或者缩小
mMatrix.preScale(scale, scale);
mBitmapShader.setLocalMatrix(mMatrix);
// 设置变换矩阵
mBitmapShader.setLocalMatrix(mMatrix);
// 设置shader
mBitmapPaint.setShader(mBitmapShader);
}
/**
* drawable转bitmap
*/
private Bitmap drawableToBitamp(Drawable drawable) {
try {
Bitmap bitmap;
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bd = (BitmapDrawable) drawable;
return bd.getBitmap();
}
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
bitmap= Bitmap.createBitmap(w, h, drawable.getOpacity() != PixelFormat.OPAQUE
? Bitmap.Config.ARGB_4444 : Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
drawable.draw(canvas);
return bitmap;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**
* 设置图片类型:
* imageType=0 圆形图片
* imageType=1 圆角图片
* 默认为圆形图片
*/
public RoundImageView setType(int imageType) {
if (this.type != imageType) {
this.type = imageType;
if (this.type != TYPE_ROUND && this.type != TYPE_CIRCLE && this.type != TYPE_OVAL) {
this.type = TYPE_OVAL;
}
requestLayout();
}
return this;
}
/**
* 设置圆角图片的圆角大小
*/
public RoundImageView setCornerRadius(int cornerRadius) {
cornerRadius = dp2px(cornerRadius);
if (mCornerRadius != cornerRadius) {
mCornerRadius = cornerRadius;
invalidate();
}
return this;
}
/**
* 设置圆角图片的左上圆角大小
*/
public RoundImageView setLeftTopCornerRadius(int cornerRadius) {
cornerRadius = dp2px(cornerRadius);
if (mLeftTopCornerRadius != cornerRadius) {
mLeftTopCornerRadius = cornerRadius;
invalidate();
}
return this;
}
/**
* 设置圆角图片的右上圆角大小
*/
public RoundImageView setRightTopCornerRadius(int cornerRadius) {
cornerRadius = dp2px(cornerRadius);
if (mRightTopCornerRadius != cornerRadius) {
mRightTopCornerRadius = cornerRadius;
invalidate();
}
return this;
}
/**
* 设置圆角图片的左下圆角大小
*/
public RoundImageView setLeftBottomCornerRadius(int cornerRadius) {
cornerRadius = dp2px(cornerRadius);
if (mLeftBottomCornerRadius != cornerRadius) {
mLeftBottomCornerRadius = cornerRadius;
invalidate();
}
return this;
}
/**
* 设置圆角图片的右下圆角大小
*/
public RoundImageView setRightBottomCornerRadius(int cornerRadius) {
cornerRadius = dp2px(cornerRadius);
if (mRightBottomCornerRadius != cornerRadius) {
mRightBottomCornerRadius = cornerRadius;
invalidate();
}
return this;
}
/**
* 设置描边宽度
*/
public RoundImageView setBorderWidth(int borderWidth) {
borderWidth = dp2px(borderWidth);
if (mBorderWidth != borderWidth) {
mBorderWidth = borderWidth;
invalidate();
}
return this;
}
/**
* 设置描边颜色
*/
public RoundImageView setBorderColor(int borderColor) {
if (mBorderColor != borderColor) {
mBorderColor = borderColor;
invalidate();
}
return this;
}
private int dp2px(int dpVal) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
dpVal, getResources().getDisplayMetrics());
}
public void setProgress(int progress,@ColorRes int color){
mBorderProgress = progress;
mProgressColor = color;
invalidate();
}
} | [
"931317632@qq.com"
] | 931317632@qq.com |
7accd3122cdaedd9270e68d4d0083426e96bd19e | 524d93f48709f199bce068b14554c4bfc1421d8c | /src/aifone/IAiFoneEntrada.java | e1671e51a3774b43f1e6a6870688b9e569d57545 | [] | no_license | amartani/hitwitter | e04d0fe0d6acac1dc29fbd8b7e3b81cf9eb82dda | b3cb7a104aa8f6eaef17171e47a5ba746380f23d | refs/heads/master | 2021-01-22T23:20:43.045314 | 2010-07-13T16:27:18 | 2010-07-13T16:27:18 | 32,344,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package aifone;
import java.rmi.Remote;
import java.rmi.RemoteException;
import entidades.Mensagem;
import entidades.Telefone;
public interface IAiFoneEntrada extends Remote {
/**
* Recebe uma chamada telefonica
*
* @param origem
* Telefone de origem da chamada
*/
public void receberChamada(Telefone origem) throws RemoteException;
/**
* Encerra uma chamada em andamento
*/
public void informarChamadaEncerrada() throws RemoteException;
/**
* Cancela um pedido de chamada recebido
*/
public void informarChamadaCancelada() throws RemoteException;
/**
* Rejeita uma chamada que está para ser feita
*/
public void informarChamadaRejeitada() throws RemoteException;
/**
* Recebe uma mensagem
*
* @param mensagem
* Mensagem enviada
*/
public void receberMensagem(Mensagem mensagem) throws RemoteException;
/**
* Confirma início da chamada
*/
public void informarChamadaConfirmada() throws RemoteException;
}
| [
"William@localhost"
] | William@localhost |
0a91090ebb029dd410dcd0bcfdfd4ef2ecd81bdd | 3fa3478419b369b132237ad418dbd2ebaad06c37 | /src/main/java/servlet/purchaseServlet.java | d379c7407d7a0c5602128fa6982c2ffa5433b878 | [] | no_license | staypecru/sklad | 2cabdcd6aebcd7c133670f84844f361a048785bb | 6da27b2bfe854eecc0659b436051d1f7108aa5b1 | refs/heads/master | 2022-01-30T06:47:43.493764 | 2019-10-03T19:01:10 | 2019-10-03T19:01:10 | 212,063,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | package servlet;
import databases.databaseUtils;
import operations.Transaction;
import servlet.utils.responses;
import servlet.utils.servletUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class purchaseServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
servletUtils.setEncoding(req, resp);
Transaction inputPurchase = servletUtils.getAndCheckTransactionParameters(req, resp);
if (inputPurchase != null) {
databaseUtils.createPurchase(inputPurchase);
responses.createCreatedResponse(resp);
}
}
}
| [
"Staypecru@gmail.com"
] | Staypecru@gmail.com |
fdf2dff590e2e838885b7b0d294f88e8f6fa2234 | 2d3542fae28c21e5b635b4ecf3b5a24fdf3f1e7a | /DictionaryPro/src/main/java/com/dictionary/codebhak/data/subdict/SubdictSection.java | 12efb671f5f2381d004d3dfde86dddb8299d0f53 | [
"Apache-2.0"
] | permissive | basriumar12/DictionaryOpenSource | 70c76b49409bbe8b272995a91579fb5803845d2b | 1beab3a82fe8862892efc11885ba22b4237e3a7b | refs/heads/master | 2020-04-24T07:34:38.036144 | 2019-02-21T05:02:30 | 2019-02-21T05:02:30 | 171,803,072 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package com.dictionary.codebhak.data.subdict;
import java.util.LinkedList;
/**
* A class to hold data for a section of the Overview of Lang Subdict text.
* <p>
* Each section contains a heading and some intro text followed by a series of list items.
*/
public class SubdictSection {
private String mHeading = "heading";
private String mIntro = "intro";
private final LinkedList<String> mList; // Represents bulleted list of items.
/* NOTE: I'm leaving the construction of the string with formatting information to the XML
* parser here. This is easier, but it would be cleaner to do all of the text construction
* here. On the other hand, the parser and this class are so closely coupled that this might
* not be a problem.
*/
/**
* Class constructor.
*/
public SubdictSection() {
mList = new LinkedList<>();
}
/**
* Returns a string containing HTML formatting tags.
*
* @return a string containing HTML formatting tags
*/
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append("<em>");
buffer.append(mHeading);
buffer.append("</em><br><br>");
buffer.append(mIntro);
/* TODO: Improve list. Subsequent paragraphs don't align at the moment.
* May need to use spans to do this.
*/
for (String item : mList) {
buffer.append("• "); // Add a bullet
buffer.append(item);
}
return buffer.toString();
}
public void setHeading(String heading) {
this.mHeading = heading;
}
public void setIntro(String intro) {
this.mIntro = intro;
}
public void addListItem(String item) {
mList.add(item);
}
public String getHeading() {
return mHeading;
}
}
| [
"basriumar12@gmail.com"
] | basriumar12@gmail.com |
08c1f0f2ef3e7e010caea66da50bf2b113680b5f | 3e5806da08de83f47104416f015265a64f19cccf | /portal-security-sso-iam/src/main/java/com/liferay/portal/security/sso/iam/internal/module/configuration/definition/package-info.java | b2e4c1c5c79f45ec763c3d9cf0804fb8885165b6 | [
"Apache-2.0"
] | permissive | indigo-dc/LiferayPlugIns | 0afa4d4bad32d02a0ead725ecc7a563f8152c72a | fa162f9b75ab76e36e5ba2379a9200bcc934d70b | refs/heads/master | 2021-01-19T08:12:44.782435 | 2017-09-29T13:47:33 | 2017-09-29T13:47:33 | 82,079,327 | 0 | 2 | null | 2017-09-28T08:51:34 | 2017-02-15T16:08:10 | Java | UTF-8 | Java | false | false | 1,034 | java | /**
* *********************************************************************
* Copyright (c) 2016: Istituto Nazionale di Fisica Nucleare (INFN) -
* INDIGO-DataCloud
*
* See http://www.infn.it and and http://www.consorzio-cometa.it for details on
* the copyright holders.
*
* 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 Marco Fargetta
*/
package com.liferay.portal.security.sso.iam.internal.module.configuration.
definition;
| [
"marco.fargetta@ct.infn.it"
] | marco.fargetta@ct.infn.it |
c452880fe8deb48af9a4a37c9900329c056138af | 6f3dfc0d2e5d6c0a60635bb667d5b22ffc07aa94 | /module-api-app/src/main/java/com/module/api/app/entity/AppProductType.java | 065b06cda35c1ae4ea9cbbbf4787c967d017b631 | [] | no_license | frankwondon/sofaboot-base | 4f92b00d6486f2720be9de736ae8a7e9481c8b2c | a1f6da6763fae3abe6ccf106c0b77ee952fa88a9 | refs/heads/master | 2022-12-14T03:53:53.239371 | 2019-07-17T01:11:03 | 2019-07-17T01:11:03 | 183,606,972 | 1 | 0 | null | 2022-11-16T11:32:31 | 2019-04-26T10:12:43 | Java | UTF-8 | Java | false | false | 977 | java | package com.module.api.app.entity;
import com.module.common.db.BaseEntity;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 商品分类
* </p>
*
* @author wangdong
* @since 2019-06-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class AppProductType extends BaseEntity {
private static final long serialVersionUID=1L;
private String name;
private String productDesc;
private Integer sort;
/**
* 0正常1锁定
*/
private Integer locked;
private Integer deleted;
/**
* 乐观锁
*/
private Integer version;
/**
* 创建人
*/
private Integer createBy;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人
*/
private Integer updateBy;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}
| [
"frankwondon@qq.com"
] | frankwondon@qq.com |
d5075351f93e03980b87eb800b8e0d8428b355f7 | c3101515ddde8a6e6ddc4294a4739256d1600df0 | /GeneralApp__2.20_1.0(1)_source_from_JADX/sources/com/google/android/gms/measurement/internal/zzo.java | 4a0b742c38eb0e4727cf0077f8ae1331cbd23d79 | [] | no_license | Aelshazly/Carty | b56fdb1be58a6d12f26d51b46f435ea4a73c8168 | d13f3a4ad80e8a7d0ed1c6a5720efb4d1ca721ee | refs/heads/master | 2022-11-14T23:29:53.547694 | 2020-07-08T19:23:39 | 2020-07-08T19:23:39 | 278,175,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,594 | java | package com.google.android.gms.measurement.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
import java.util.List;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@17.3.0 */
public final class zzo implements Creator<zzm> {
public final /* synthetic */ Object[] newArray(int i) {
return new zzm[i];
}
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
Parcel parcel2 = parcel;
int validateObjectHeader = SafeParcelReader.validateObjectHeader(parcel);
long j = 0;
long j2 = 0;
long j3 = 0;
long j4 = 0;
long j5 = 0;
String str = null;
String str2 = null;
String str3 = null;
String str4 = null;
String str5 = null;
String str6 = null;
String str7 = null;
Boolean bool = null;
List list = null;
String str8 = null;
long j6 = -2147483648L;
boolean z = true;
boolean z2 = false;
int i = 0;
boolean z3 = true;
boolean z4 = true;
boolean z5 = false;
while (parcel.dataPosition() < validateObjectHeader) {
int readHeader = SafeParcelReader.readHeader(parcel);
switch (SafeParcelReader.getFieldId(readHeader)) {
case 2:
str = SafeParcelReader.createString(parcel2, readHeader);
break;
case 3:
str2 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 4:
str3 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 5:
str4 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 6:
j = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 7:
j2 = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 8:
str5 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 9:
z = SafeParcelReader.readBoolean(parcel2, readHeader);
break;
case 10:
z2 = SafeParcelReader.readBoolean(parcel2, readHeader);
break;
case 11:
j6 = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 12:
str6 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 13:
j3 = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 14:
j4 = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 15:
i = SafeParcelReader.readInt(parcel2, readHeader);
break;
case 16:
z3 = SafeParcelReader.readBoolean(parcel2, readHeader);
break;
case 17:
z4 = SafeParcelReader.readBoolean(parcel2, readHeader);
break;
case 18:
z5 = SafeParcelReader.readBoolean(parcel2, readHeader);
break;
case 19:
str7 = SafeParcelReader.createString(parcel2, readHeader);
break;
case 21:
bool = SafeParcelReader.readBooleanObject(parcel2, readHeader);
break;
case 22:
j5 = SafeParcelReader.readLong(parcel2, readHeader);
break;
case 23:
list = SafeParcelReader.createStringList(parcel2, readHeader);
break;
case 24:
str8 = SafeParcelReader.createString(parcel2, readHeader);
break;
default:
SafeParcelReader.skipUnknownField(parcel2, readHeader);
break;
}
}
SafeParcelReader.ensureAtEnd(parcel2, validateObjectHeader);
zzm zzm = new zzm(str, str2, str3, str4, j, j2, str5, z, z2, j6, str6, j3, j4, i, z3, z4, z5, str7, bool, j5, list, str8);
return zzm;
}
}
| [
"aelshazly@engineer.com"
] | aelshazly@engineer.com |
fed45e5324d73604158ecfa9204aafa7c44ad8b4 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_b3bdc5f35d71d592ab8104ea630a971ba7d2bff1/FloatMatrix/17_b3bdc5f35d71d592ab8104ea630a971ba7d2bff1_FloatMatrix_s.java | 1d303a4f1178da93c9311abba76cd3415cb5fff8 | [] | 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 | 107,669 | java | // --- BEGIN LICENSE BLOCK ---
/*
* Copyright (c) 2009, Mikio L. Braun
* Copyright (c) 2008, Johannes Schaback
* Copyright (c) 2009, Jan Saputra Müller
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of the Technische Universität Berlin nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// --- END LICENSE BLOCK ---
package org.jblas;
import org.jblas.exceptions.SizeException;
import org.jblas.ranges.Range;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* A general matrix class for <tt>float</tt> typed values.
*
* Don't be intimidated by the large number of methods this function defines. Most
* are overloads provided for ease of use. For example, for each arithmetic operation,
* up to six overloaded versions exist to handle in-place computations, and
* scalar arguments.
*
* <h3>Construction</h3>
*
* <p>To construct a two-dimensional matrices, you can use the following constructors
* and static methods.</p>
*
* <table class="my">
* <tr><th>Method<th>Description
* <tr><td>FloatMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
* <tr><td>FloatMatrix(new float[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
* <tr><td>FloatMatrix.zeros(m,n) <td>Initial values set to 0.0f.
* <tr><td>FloatMatrix.ones(m,n) <td>Initial values set to 1.0f.
* <tr><td>FloatMatrix.rand(m,n) <td>Values drawn at random between 0.0f and 1.0f.
* <tr><td>FloatMatrix.randn(m,n) <td>Values drawn from normal distribution.
* <tr><td>FloatMatrix.eye(n) <td>Unit matrix (values 0.0f except for 1.0f on the diagonal).
* <tr><td>FloatMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
* </table>
*
* <p>Alternatively, you can construct (column) vectors, if you just supply the length
* using the following constructors and static methods.</p>
*
* <table class="my">
* <tr><th>Method<th>Description
* <tr><td>FloatMatrix(m)<td>Constructs a column vector.
* <tr><td>FloatMatrix(new float[] {value1, value2, ...})<td>Constructs a column vector.
* <tr><td>FloatMatrix.zeros(m) <td>Initial values set to 1.0f.
* <tr><td>FloatMatrix.ones(m) <td>Initial values set to 0.0f.
* <tr><td>FloatMatrix.rand(m) <td>Values drawn at random between 0.0f and 1.0f.
* <tr><td>FloatMatrix.randn(m) <td>Values drawn from normal distribution.
* </table>
*
* <p>You can also construct new matrices by concatenating matrices either horziontally
* or vertically:</p>
*
* <table class="my">
* <tr><th>Method<th>Description
* <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
* <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
* </table>
*
* <h3>Element Access, Copying and Duplication</h3>
*
* <p>To access individual elements, or whole rows and columns, use the following
* methods:<p>
*
* <table class="my">
* <tr><th>x.Method<th>Description
* <tr><td>x.get(i,j)<td>Get element in row i and column j.
* <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
* <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
* <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
* <tr><td>x.getColumn(i)<td>Get a copy of column i.
* <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
* <tr><td>x.getRow(i)<td>Get a copy of row i.
* <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
* <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
* <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
* </table>
*
* <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
* FloatMatrix objects, or Range objects, which then specify the indices used
* as follows:
*
* <ul>
* <li><em>integer array:</em> the elements will be used as indices.
* <li><em>FloatMatrix object:</em> non-zero entries specify the indices.
* <li><em>Range object:</em> see below.
* </ul>
*
* <p>When using <tt>put</tt> with multiple indices, the assigned object must
* have the correct size or be a scalar.</p>
*
* <p>There exist the following Range objects. The Class <tt>RangeUtils</tt> also
* contains the a number of handy helper methods for constructing these ranges.</p>
* <table class="my">
* <tr><th>Class <th>RangeUtils method <th>Indices
* <tr><td>AllRange <td>all() <td>All legal indices.
* <tr><td>PointRange <td>point(i) <td> A single point.
* <tr><td>IntervalRange <td>interval(a, b)<td> All indices from a to b (inclusive)
* <tr><td rowspan=3>IndicesRange <td>indices(int[])<td> The specified indices.
* <tr><td>indices(FloatMatrix)<td>The specified indices.
* <tr><td>find(FloatMatrix)<td>The non-zero entries of the matrix.
* </table>
*
* <p>The following methods can be used for duplicating and copying matrices.</p>
*
* <table class="my">
* <tr><th>Method<th>Description
* <tr><td>x.dup()<td>Get a copy of x.
* <tr><td>x.copy(y)<td>Copy the contents of y to x (possible resizing x).
* </table>
*
* <h3>Size and Shape</h3>
*
* <p>The following methods permit to acces the size of a matrix and change its size or shape.</p>
*
* <table class="my">
* <tr><th>x.Method<th>Description
* <tr><td>x.rows<td>Number of rows.
* <tr><td>x.columns<td>Number of columns.
* <tr><td>x.length<td>Total number of elements.
* <tr><td>x.isEmpty()<td>Checks whether rows == 0 and columns == 0.
* <tr><td>x.isRowVector()<td>Checks whether rows == 1.
* <tr><td>x.isColumnVector()<td>Checks whether columns == 1.
* <tr><td>x.isVector()<td>Checks whether rows == 1 or columns == 1.
* <tr><td>x.isSquare()<td>Checks whether rows == columns.
* <tr><td>x.isScalar()<td>Checks whether length == 1.
* <tr><td>x.resize(r, c)<td>Resize the matrix to r rows and c columns, discarding the content.
* <tr><td>x.reshape(r, c)<td>Resize the matrix to r rows and c columns.<br> Number of elements must not change.
* </table>
*
* <p>The size is stored in the <tt>rows</tt> and <tt>columns</tt> member variables.
* The total number of elements is stored in <tt>length</tt>. Do not change these
* values unless you know what you're doing!</p>
*
* <h3>Arithmetics</h3>
*
* <p>The usual arithmetic operations are implemented. Each operation exists in a
* in-place version, recognizable by the suffix <tt>"i"</tt>, to which you can supply
* the result matrix (or <tt>this</tt> is used, if missing). Using in-place operations
* can also lead to a smaller memory footprint, as the number of temporary objects
* which are directly garbage collected again is reduced.</p>
*
* <p>Whenever you specify a result vector, the result vector must already have the
* correct dimensions.</p>
*
* <p>For example, you can add two matrices using the <tt>add</tt> method. If you want
* to store the result in of <tt>x + y</tt> in <tt>z</tt>, type
* <span class=code>
* x.addi(y, z) // computes x = y + z.
* </span>
* Even in-place methods return the result, such that you can easily chain in-place methods,
* for example:
* <span class=code>
* x.addi(y).addi(z) // computes x += y; x += z
* </span></p>
*
* <p>Methods which operate element-wise only make sure that the length of the matrices
* is correct. Therefore, you can add a 3 * 3 matrix to a 1 * 9 matrix, for example.</p>
*
* <p>Finally, there exist versions which take floats instead of FloatMatrix Objects
* as arguments. These then compute the operation with the same value as the
* right-hand-side. The same effect can be achieved by passing a FloatMatrix with
* exactly one element.</p>
*
* <table class="my">
* <tr><th>Operation <th>Method <th>Comment
* <tr><td>x + y <td>x.add(y) <td>
* <tr><td>x - y <td>x.sub(y), y.rsub(x) <td>rsub subtracts left from right hand side
* <tr><td rowspan=3>x * y <td>x.mul(y) <td>element-wise multiplication
* <tr> <td>x.mmul(y)<td>matrix-matrix multiplication
* <tr> <td>x.dot(y) <td>scalar-product
* <tr><td>x / y <td>x.div(y), y.rdiv(x) <td>rdiv divides right hand side by left hand side.
* <tr><td>- x <td>x.neg() <td>
* </table>
*
* <p>There also exist operations which work on whole columns or rows.</p>
*
* <table class="my">
* <tr><th>Method <th>Description
* <tr><td>x.addRowVector<td>adds a vector to each row (addiRowVector works in-place)
* <tr><td>x.addColumnVector<td>adds a vector to each column
* <tr><td>x.subRowVector<td>subtracts a vector from each row
* <tr><td>x.subColumnVector<td>subtracts a vector from each column
* <tr><td>x.mulRow<td>Multiplies a row by a scalar
* <tr><td>x.mulColumn<td>multiplies a row by a column
* </table>
*
* <p>In principle, you could achieve the same result by first calling getColumn(),
* adding, and then calling putColumn, but these methods are much faster.</p>
*
* <p>The following comparison operations are available</p>
*
* <table class="my">
* <tr><th>Operation <th>Method
* <tr><td>x < y <td>x.lt(y)
* <tr><td>x <= y <td>x.le(y)
* <tr><td>x > y <td>x.gt(y)
* <tr><td>x >= y <td>x.ge(y)
* <tr><td>x == y <td>x.eq(y)
* <tr><td>x != y <td>x.ne(y)
* </table>
*
* <p> Logical operations are also supported. For these operations, a value different from
* zero is treated as "true" and zero is treated as "false". All operations are carried
* out elementwise.</p>
*
* <table class="my">
* <tr><th>Operation <th>Method
* <tr><td>x & y <td>x.and(y)
* <tr><td>x | y <td>x.or(y)
* <tr><td>x ^ y <td>x.xor(y)
* <tr><td>! x <td>x.not()
* </table>
*
* <p>Finally, there are a few more methods to compute various things:</p>
*
* <table class="my">
* <tr><th>Method <th>Description
* <tr><td>x.max() <td>Return maximal element
* <tr><td>x.argmax() <td>Return index of largest element
* <tr><td>x.min() <td>Return minimal element
* <tr><td>x.argmin() <td>Return index of largest element
* <tr><td>x.columnMins() <td>Return column-wise minima
* <tr><td>x.columnArgmins() <td>Return column-wise index of minima
* <tr><td>x.columnMaxs() <td>Return column-wise maxima
* <tr><td>x.columnArgmaxs() <td>Return column-wise index of maxima
* </table>
*
* @author Mikio Braun, Johannes Schaback
*/
public class FloatMatrix implements Serializable {
/** Number of rows. */
public int rows;
/** Number of columns. */
public int columns;
/** Total number of elements (for convenience). */
public int length;
/** The actual data stored by rows (that is, row 0, row 1...). */
public float[] data = null; // rows are contiguous
public static final FloatMatrix EMPTY = new FloatMatrix();
static final long serialVersionUID = -1249281332731183060L;
/**************************************************************************
*
* Constructors and factory functions
*
**************************************************************************/
/** Create a new matrix with <i>newRows</i> rows, <i>newColumns</i> columns
* using <i>newData></i> as the data. The length of the data is not checked!
*/
public FloatMatrix(int newRows, int newColumns, float... newData) {
rows = newRows;
columns = newColumns;
length = rows * columns;
if (newData != null && newData.length != newRows * newColumns) {
throw new IllegalArgumentException(
"Passed data must match matrix dimensions.");
}
data = newData;
//System.err.printf("%d * %d matrix created\n", rows, columns);
}
/**
* Creates a new <i>n</i> times <i>m</i> <tt>FloatMatrix</tt>.
* @param newRows the number of rows (<i>n</i>) of the new matrix.
* @param newColumns the number of columns (<i>m</i>) of the new matrix.
*/
public FloatMatrix(int newRows, int newColumns) {
this(newRows, newColumns, new float[newRows * newColumns]);
}
/**
* Creates a new <tt>FloatMatrix</tt> of size 0 times 0.
*/
public FloatMatrix() {
this(0, 0, (float[]) null);
}
/**
* Create a Matrix of length <tt>len</tt>. By default, this creates a row vector.
* @param len
*/
public FloatMatrix(int len) {
this(len, 1, new float[len]);
}
public FloatMatrix(float[] newData) {
this(newData.length);
data = newData;
}
/**
* Creates a new matrix by reading it from a file.
* @param filename the path and name of the file to read the matrix from
* @throws IOException
*/
public FloatMatrix(String filename) throws IOException {
load(filename);
}
/**
* Creates a new <i>n</i> times <i>m</i> <tt>FloatMatrix</tt> from
* the given <i>n</i> times <i>m</i> 2D data array. The first dimension of the array makes the
* rows (<i>n</i>) and the second dimension the columns (<i>m</i>). For example, the
* given code <br/><br/>
* <code>new FloatMatrix(new float[][]{{1d, 2d, 3d}, {4d, 5d, 6d}, {7d, 8d, 9d}}).print();</code><br/><br/>
* will constructs the following matrix:
* <pre>
* 1.0f 2.0f 3.0f
* 4.0f 5.0f 6.0f
* 7.0f 8.0f 9.0f
* </pre>.
* @param data <i>n</i> times <i>m</i> data array
*/
public FloatMatrix(float[][] data) {
this(data.length, data[0].length);
for (int r = 0; r < rows; r++) {
assert (data[r].length == columns);
}
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
put(r, c, data[r][c]);
}
}
}
public FloatMatrix(List<Float> data) {
this(data.size());
int c = 0;
for (java.lang.Float d : data) {
put(c++, d);
}
}
/**
* Construct FloatMatrix from ASCII representation.
*
* This is not very fast, but can be quiet useful when
* you want to "just" construct a matrix, for example
* when testing.
*
* The format is semicolon separated rows of space separated values,
* for example "1 2 3; 4 5 6; 7 8 9".
*/
public static FloatMatrix valueOf(String text) {
String[] rowValues = text.split(";");
// process first line
String[] columnValues = rowValues[0].trim().split("\\s+");
FloatMatrix result = null;
// process rest
for (int r = 0; r < rowValues.length; r++) {
columnValues = rowValues[r].trim().split("\\s+");
if (r == 0) {
result = new FloatMatrix(rowValues.length, columnValues.length);
}
for (int c = 0; c < columnValues.length; c++) {
result.put(r, c, Float.valueOf(columnValues[c]));
}
}
return result;
}
/**
* Serialization
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
}
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
}
/** Create matrix with random values uniformly in 0..1. */
public static FloatMatrix rand(int rows, int columns) {
FloatMatrix m = new FloatMatrix(rows, columns);
java.util.Random r = new java.util.Random();
for (int i = 0; i < rows * columns; i++) {
m.data[i] = r.nextFloat();
}
return m;
}
/** Creates a row vector with random values uniformly in 0..1. */
public static FloatMatrix rand(int len) {
return rand(len, 1);
}
/** Create matrix with normally distributed random values. */
public static FloatMatrix randn(int rows, int columns) {
FloatMatrix m = new FloatMatrix(rows, columns);
java.util.Random r = new java.util.Random();
for (int i = 0; i < rows * columns; i++) {
m.data[i] = (float) r.nextGaussian();
}
return m;
}
/** Create row vector with normally distributed random values. */
public static FloatMatrix randn(int len) {
return randn(len, 1);
}
/** Creates a new matrix in which all values are equal 0. */
public static FloatMatrix zeros(int rows, int columns) {
return new FloatMatrix(rows, columns);
}
/** Creates a row vector of given length. */
public static FloatMatrix zeros(int length) {
return zeros(length, 1);
}
/** Creates a new matrix in which all values are equal 1. */
public static FloatMatrix ones(int rows, int columns) {
FloatMatrix m = new FloatMatrix(rows, columns);
for (int i = 0; i < rows * columns; i++) {
m.put(i, 1.0f);
}
return m;
}
/** Creates a row vector with all elements equal to 1. */
public static FloatMatrix ones(int length) {
return ones(length, 1);
}
/** Construct a new n-by-n identity matrix. */
public static FloatMatrix eye(int n) {
FloatMatrix m = new FloatMatrix(n, n);
for (int i = 0; i < n; i++) {
m.put(i, i, 1.0f);
}
return m;
}
/**
* Creates a new matrix where the values of the given vector are the diagonal values of
* the matrix.
*/
public static FloatMatrix diag(FloatMatrix x) {
FloatMatrix m = new FloatMatrix(x.length, x.length);
for (int i = 0; i < x.length; i++) {
m.put(i, i, x.get(i));
}
return m;
}
/**
* Create a 1-by-1 matrix. For many operations, this matrix functions like a
* normal float.
*/
public static FloatMatrix scalar(float s) {
FloatMatrix m = new FloatMatrix(1, 1);
m.put(0, 0, s);
return m;
}
/** Test whether a matrix is scalar. */
public boolean isScalar() {
return length == 1;
}
/** Return the first element of the matrix. */
public float scalar() {
return get(0);
}
public static FloatMatrix logspace(float lower, float upper, int size) {
FloatMatrix result = new FloatMatrix(size);
for (int i = 0; i < size; i++) {
float t = (float) i / (size - 1);
float e = lower * (1 - t) + t * upper;
result.put(i, (float) Math.pow(10.0f, e));
}
return result;
}
public static FloatMatrix linspace(int lower, int upper, int size) {
FloatMatrix result = new FloatMatrix(size);
for (int i = 0; i < size; i++) {
float t = (float) i / (size - 1);
result.put(i, lower * (1 - t) + t * upper);
}
return result;
}
/**
* Concatenates two matrices horizontally. Matrices must have identical
* numbers of rows.
*/
public static FloatMatrix concatHorizontally(FloatMatrix A, FloatMatrix B) {
if (A.rows != B.rows) {
throw new SizeException("Matrices don't have same number of rows.");
}
FloatMatrix result = new FloatMatrix(A.rows, A.columns + B.columns);
SimpleBlas.copy(A, result);
JavaBlas.rcopy(B.length, B.data, 0, 1, result.data, A.length, 1);
return result;
}
/**
* Concatenates two matrices vertically. Matrices must have identical
* numbers of columns.
*/
public static FloatMatrix concatVertically(FloatMatrix A, FloatMatrix B) {
if (A.columns != B.columns) {
throw new SizeException("Matrices don't have same number of columns (" + A.columns + " != " + B.columns + ".");
}
FloatMatrix result = new FloatMatrix(A.rows + B.rows, A.columns);
for (int i = 0; i < A.columns; i++) {
JavaBlas.rcopy(A.rows, A.data, A.index(0, i), 1, result.data, result.index(0, i), 1);
JavaBlas.rcopy(B.rows, B.data, B.index(0, i), 1, result.data, result.index(A.rows, i), 1);
}
return result;
}
/**************************************************************************
* Working with slices (Man! 30+ methods just to make this a bit flexible...)
*/
/** Get all elements specified by the linear indices. */
public FloatMatrix get(int[] indices) {
FloatMatrix result = new FloatMatrix(indices.length);
for (int i = 0; i < indices.length; i++) {
result.put(i, get(indices[i]));
}
return result;
}
/** Get all elements for a given row and the specified columns. */
public FloatMatrix get(int r, int[] indices) {
FloatMatrix result = new FloatMatrix(1, indices.length);
for (int i = 0; i < indices.length; i++) {
result.put(i, get(r, indices[i]));
}
return result;
}
/** Get all elements for a given column and the specified rows. */
public FloatMatrix get(int[] indices, int c) {
FloatMatrix result = new FloatMatrix(indices.length, c);
for (int i = 0; i < indices.length; i++) {
result.put(i, get(indices[i], c));
}
return result;
}
/** Get all elements from the specified rows and columns. */
public FloatMatrix get(int[] rindices, int[] cindices) {
FloatMatrix result = new FloatMatrix(rindices.length, cindices.length);
for (int i = 0; i < rindices.length; i++) {
for (int j = 0; j < cindices.length; j++) {
result.put(i, j, get(rindices[i], cindices[j]));
}
}
return result;
}
/** Get elements from specified rows and columns. */
public FloatMatrix get(Range rs, Range cs) {
rs.init(0, rows);
cs.init(0, columns);
FloatMatrix result = new FloatMatrix(rs.length(), cs.length());
for (; rs.hasMore(); rs.next()) {
for (; cs.hasMore(); cs.next()) {
result.put(rs.index(), cs.index(), get(rs.value(), cs.value()));
}
}
return result;
}
public FloatMatrix get(Range rs, int c) {
rs.init(0, rows);
FloatMatrix result = new FloatMatrix(rs.length(), 1);
for (; rs.hasMore(); rs.next()) {
result.put(rs.index(), 0, get(rs.value(), c));
}
return result;
}
public FloatMatrix get(int r, Range cs) {
cs.init(0, columns);
FloatMatrix result = new FloatMatrix(1, cs.length());
for (; cs.hasMore(); cs.next()) {
result.put(0, cs.index(), get(r, cs.value()));
}
return result;
}
/** Get elements specified by the non-zero entries of the passed matrix. */
public FloatMatrix get(FloatMatrix indices) {
return get(indices.findIndices());
}
/**
* Get elements from a row and columns as specified by the non-zero entries of
* a matrix.
*/
public FloatMatrix get(int r, FloatMatrix indices) {
return get(r, indices.findIndices());
}
/**
* Get elements from a column and rows as specified by the non-zero entries of
* a matrix.
*/
public FloatMatrix get(FloatMatrix indices, int c) {
return get(indices.findIndices(), c);
}
/**
* Get elements from columns and rows as specified by the non-zero entries of
* the passed matrices.
*/
public FloatMatrix get(FloatMatrix rindices, FloatMatrix cindices) {
return get(rindices.findIndices(), cindices.findIndices());
}
/** Return all elements with linear index a, a + 1, ..., b - 1.*/
public FloatMatrix getRange(int a, int b) {
FloatMatrix result = new FloatMatrix(b - a);
for (int k = 0; k < b - a; k++) {
result.put(k, get(a + k));
}
return result;
}
/** Get elements from a row and columns <tt>a</tt> to <tt>b</tt>. */
public FloatMatrix getColumnRange(int r, int a, int b) {
FloatMatrix result = new FloatMatrix(1, b - a);
for (int k = 0; k < b - a; k++) {
result.put(k, get(r, a + k));
}
return result;
}
/** Get elements from a column and rows <tt>a/tt> to <tt>b</tt>. */
public FloatMatrix getRowRange(int a, int b, int c) {
FloatMatrix result = new FloatMatrix(b - a);
for (int k = 0; k < b - a; k++) {
result.put(k, get(a + k, c));
}
return result;
}
/**
* Get elements from rows <tt>ra</tt> to <tt>rb</tt> and
* columns <tt>ca</tt> to <tt>cb</tt>.
*/
public FloatMatrix getRange(int ra, int rb, int ca, int cb) {
FloatMatrix result = new FloatMatrix(rb - ra, cb - ca);
for (int i = 0; i < rb - ra; i++) {
for (int j = 0; j < cb - ca; j++) {
result.put(i, j, get(ra + i, ca + j));
}
}
return result;
}
/** Get whole rows from the passed indices. */
public FloatMatrix getRows(int[] rindices) {
FloatMatrix result = new FloatMatrix(rindices.length, columns);
for (int i = 0; i < rindices.length; i++) {
JavaBlas.rcopy(columns, data, index(rindices[i], 0), rows, result.data, result.index(i, 0), result.rows);
}
return result;
}
/** Get whole rows as specified by the non-zero entries of a matrix. */
public FloatMatrix getRows(FloatMatrix rindices) {
return getRows(rindices.findIndices());
}
public FloatMatrix getRows(Range indices, FloatMatrix result) {
indices.init(0, rows);
if (result.rows < indices.length()) {
throw new SizeException("Result matrix does not have enough rows (" + result.rows + " < " + indices.length() + ")");
}
result.checkColumns(columns);
for (int c = 0; c < columns; c++) {
indices.init(0, rows);
for (int r = 0; indices.hasMore(); indices.next(), r++) {
result.put(r, c, get(indices.index(), c));
}
}
return result;
}
public FloatMatrix getRows(Range indices) {
indices.init(0, rows);
FloatMatrix result = new FloatMatrix(indices.length(), columns);
return getRows(indices, result);
}
/** Get whole columns from the passed indices. */
public FloatMatrix getColumns(int[] cindices) {
FloatMatrix result = new FloatMatrix(rows, cindices.length);
for (int i = 0; i < cindices.length; i++) {
JavaBlas.rcopy(rows, data, index(0, cindices[i]), 1, result.data, result.index(0, i), 1);
}
return result;
}
/** Get whole columns as specified by the non-zero entries of a matrix. */
public FloatMatrix getColumns(FloatMatrix cindices) {
return getColumns(cindices.findIndices());
}
/**
* Assert that the matrix has a certain length.
* @throws SizeException
*/
public void checkLength(int l) {
if (length != l) {
throw new SizeException("Matrix does not have the necessary length (" + length + " != " + l + ").");
}
}
/**
* Asserts that the matrix has a certain number of rows.
* @throws SizeException
*/
public void checkRows(int r) {
if (rows != r) {
throw new SizeException("Matrix does not have the necessary number of rows (" + rows + " != " + r + ").");
}
}
/**
* Asserts that the amtrix has a certain number of columns.
* @throws SizeException
*/
public void checkColumns(int c) {
if (columns != c) {
throw new SizeException("Matrix does not have the necessary number of columns (" + columns + " != " + c + ").");
}
}
/** Set elements in linear ordering in the specified indices. */
public FloatMatrix put(int[] indices, FloatMatrix x) {
if (x.isScalar()) {
return put(indices, x.scalar());
}
x.checkLength(indices.length);
for (int i = 0; i < indices.length; i++) {
put(indices[i], x.get(i));
}
return this;
}
/** Set multiple elements in a row. */
public FloatMatrix put(int r, int[] indices, FloatMatrix x) {
if (x.isScalar()) {
return put(r, indices, x.scalar());
}
x.checkColumns(indices.length);
for (int i = 0; i < indices.length; i++) {
put(r, indices[i], x.get(i));
}
return this;
}
/** Set multiple elements in a row. */
public FloatMatrix put(int[] indices, int c, FloatMatrix x) {
if (x.isScalar()) {
return put(indices, c, x.scalar());
}
x.checkRows(indices.length);
for (int i = 0; i < indices.length; i++) {
put(indices[i], c, x.get(i));
}
return this;
}
/** Put a sub-matrix as specified by the indices. */
public FloatMatrix put(int[] rindices, int[] cindices, FloatMatrix x) {
if (x.isScalar()) {
return put(rindices, cindices, x.scalar());
}
x.checkRows(rindices.length);
x.checkColumns(cindices.length);
for (int i = 0; i < rindices.length; i++) {
for (int j = 0; j < cindices.length; j++) {
put(rindices[i], cindices[j], x.get(i, j));
}
}
return this;
}
/** Put a matrix into specified indices. */
public FloatMatrix put(Range rs, Range cs, FloatMatrix x) {
rs.init(0, rows);
cs.init(0, columns);
x.checkRows(rs.length());
x.checkColumns(cs.length());
for (; rs.hasMore(); rs.next()) {
for (; cs.hasMore(); cs.next()) {
put(rs.value(), cs.value(), x.get(rs.index(), cs.index()));
}
}
return this;
}
/** Put a single value into the specified indices (linear adressing). */
public FloatMatrix put(int[] indices, float v) {
for (int i = 0; i < indices.length; i++) {
put(indices[i], v);
}
return this;
}
/** Put a single value into a row and the specified columns. */
public FloatMatrix put(int r, int[] indices, float v) {
for (int i = 0; i < indices.length; i++) {
put(r, indices[i], v);
}
return this;
}
/** Put a single value into the specified rows of a column. */
public FloatMatrix put(int[] indices, int c, float v) {
for (int i = 0; i < indices.length; i++) {
put(indices[i], c, v);
}
return this;
}
/** Put a single value into the specified rows and columns. */
public FloatMatrix put(int[] rindices, int[] cindices, float v) {
for (int i = 0; i < rindices.length; i++) {
for (int j = 0; j < cindices.length; j++) {
put(rindices[i], cindices[j], v);
}
}
return this;
}
/**
* Put a sub-matrix into the indices specified by the non-zero entries
* of <tt>indices</tt> (linear adressing).
*/
public FloatMatrix put(FloatMatrix indices, FloatMatrix v) {
return put(indices.findIndices(), v);
}
/** Put a sub-vector into the specified columns (non-zero entries of <tt>indices</tt>) of a row. */
public FloatMatrix put(int r, FloatMatrix indices, FloatMatrix v) {
return put(r, indices.findIndices(), v);
}
/** Put a sub-vector into the specified rows (non-zero entries of <tt>indices</tt>) of a column. */
public FloatMatrix put(FloatMatrix indices, int c, FloatMatrix v) {
return put(indices.findIndices(), c, v);
}
/**
* Put a sub-matrix into the specified rows and columns (non-zero entries of
* <tt>rindices</tt> and <tt>cindices</tt>.
*/
public FloatMatrix put(FloatMatrix rindices, FloatMatrix cindices, FloatMatrix v) {
return put(rindices.findIndices(), cindices.findIndices(), v);
}
/**
* Put a single value into the elements specified by the non-zero
* entries of <tt>indices</tt> (linear adressing).
*/
public FloatMatrix put(FloatMatrix indices, float v) {
return put(indices.findIndices(), v);
}
/**
* Put a single value into the specified columns (non-zero entries of
* <tt>indices</tt>) of a row.
*/
public FloatMatrix put(int r, FloatMatrix indices, float v) {
return put(r, indices.findIndices(), v);
}
/**
* Put a single value into the specified rows (non-zero entries of
* <tt>indices</tt>) of a column.
*/
public FloatMatrix put(FloatMatrix indices, int c, float v) {
return put(indices.findIndices(), c, v);
}
/**
* Put a single value in the specified rows and columns (non-zero entries
* of <tt>rindices</tt> and <tt>cindices</tt>.
*/
public FloatMatrix put(FloatMatrix rindices, FloatMatrix cindices, float v) {
return put(rindices.findIndices(), cindices.findIndices(), v);
}
/** Find the linear indices of all non-zero elements. */
public int[] findIndices() {
int len = 0;
for (int i = 0; i < length; i++) {
if (get(i) != 0.0f) {
len++;
}
}
int[] indices = new int[len];
int c = 0;
for (int i = 0; i < length; i++) {
if (get(i) != 0.0f) {
indices[c++] = i;
}
}
return indices;
}
/**************************************************************************
* Basic operations (copying, resizing, element access)
*/
/** Return transposed copy of this matrix. */
public FloatMatrix transpose() {
FloatMatrix result = new FloatMatrix(columns, rows);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
result.put(j, i, get(i, j));
}
}
return result;
}
/**
* Compare two matrices. Returns true if and only if other is also a
* FloatMatrix which has the same size and the maximal absolute
* difference in matrix elements is smaller thatn 1e-6.
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof FloatMatrix)) {
return false;
}
FloatMatrix other = (FloatMatrix) o;
if (!sameSize(other)) {
return false;
}
FloatMatrix diff = MatrixFunctions.absi(sub(other));
return diff.max() / (rows * columns) < 1e-6;
}
@Override
public int hashCode() {
int hash = 7;
hash = 83 * hash + this.rows;
hash = 83 * hash + this.columns;
hash = 83 * hash + Arrays.hashCode(this.data);
return hash;
}
/** Resize the matrix. All elements will be set to zero. */
public void resize(int newRows, int newColumns) {
rows = newRows;
columns = newColumns;
length = newRows * newColumns;
data = new float[rows * columns];
}
/** Reshape the matrix. Number of elements must not change. */
public FloatMatrix reshape(int newRows, int newColumns) {
if (length != newRows * newColumns) {
throw new IllegalArgumentException(
"Number of elements must not change.");
}
rows = newRows;
columns = newColumns;
return this;
}
/** Generate a new matrix which has the given number of replications of this. */
public FloatMatrix repmat(int rowMult, int columnMult) {
FloatMatrix result = new FloatMatrix(rows * rowMult, columns * columnMult);
for (int c = 0; c < columnMult; c++) {
for (int r = 0; r < rowMult; r++) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
result.put(r * rows + i, c * columns + j, get(i, j));
}
}
}
}
return result;
}
/** Checks whether two matrices have the same size. */
public boolean sameSize(FloatMatrix a) {
return rows == a.rows && columns == a.columns;
}
/** Throws SizeException unless two matrices have the same size. */
public void assertSameSize(FloatMatrix a) {
if (!sameSize(a)) {
throw new SizeException("Matrices must have the same size.");
}
}
/** Checks whether two matrices can be multiplied (that is, number of columns of
* this must equal number of rows of a. */
public boolean multipliesWith(FloatMatrix a) {
return columns == a.rows;
}
/** Throws SizeException unless matrices can be multiplied with one another. */
public void assertMultipliesWith(FloatMatrix a) {
if (!multipliesWith(a)) {
throw new SizeException("Number of columns of left matrix must be equal to number of rows of right matrix.");
}
}
/** Checks whether two matrices have the same length. */
public boolean sameLength(FloatMatrix a) {
return length == a.length;
}
/** Throws SizeException unless matrices have the same length. */
public void assertSameLength(FloatMatrix a) {
if (!sameLength(a)) {
throw new SizeException("Matrices must have same length (is: " + length + " and " + a.length + ")");
}
}
/** Copy FloatMatrix a to this. this a is resized if necessary. */
public FloatMatrix copy(FloatMatrix a) {
if (!sameSize(a)) {
resize(a.rows, a.columns);
}
System.arraycopy(a.data, 0, data, 0, length);
return a;
}
/**
* Returns a duplicate of this matrix. Geometry is the same (including offsets, transpose, etc.),
* but the buffer is not shared.
*/
public FloatMatrix dup() {
FloatMatrix out = new FloatMatrix(rows, columns);
JavaBlas.rcopy(length, data, 0, 1, out.data, 0, 1);
return out;
}
/** Swap two columns of a matrix. */
public FloatMatrix swapColumns(int i, int j) {
NativeBlas.sswap(rows, data, index(0, i), 1, data, index(0, j), 1);
return this;
}
/** Swap two rows of a matrix. */
public FloatMatrix swapRows(int i, int j) {
NativeBlas.sswap(columns, data, index(i, 0), rows, data, index(j, 0), rows);
return this;
}
/** Set matrix element */
public FloatMatrix put(int rowIndex, int columnIndex, float value) {
data[index(rowIndex, columnIndex)] = value;
return this;
}
/** Retrieve matrix element */
public float get(int rowIndex, int columnIndex) {
return data[index(rowIndex, columnIndex)];
}
/** Get index of an element */
public int index(int rowIndex, int columnIndex) {
return rowIndex + rows * columnIndex;
}
/** Compute the row index of a linear index. */
public int indexRows(int i) {
return i / rows;
}
/** Compute the column index of a linear index. */
public int indexColumns(int i) {
return i - indexRows(i) * rows;
}
/** Get a matrix element (linear indexing). */
public float get(int i) {
return data[i];
}
/** Set a matrix element (linear indexing). */
public FloatMatrix put(int i, float v) {
data[i] = v;
return this;
}
/** Set all elements to a value. */
public FloatMatrix fill(float value) {
for (int i = 0; i < length; i++) {
put(i, value);
}
return this;
}
/** Get number of rows. */
public int getRows() {
return rows;
}
/** Get number of columns. */
public int getColumns() {
return columns;
}
/** Get total number of elements. */
public int getLength() {
return length;
}
/** Checks whether the matrix is empty. */
public boolean isEmpty() {
return columns == 0 || rows == 0;
}
/** Checks whether the matrix is square. */
public boolean isSquare() {
return columns == rows;
}
/** Throw SizeException unless matrix is square. */
public void assertSquare() {
if (!isSquare()) {
throw new SizeException("Matrix must be square!");
}
}
/** Checks whether the matrix is a vector. */
public boolean isVector() {
return columns == 1 || rows == 1;
}
/** Checks whether the matrix is a row vector. */
public boolean isRowVector() {
return rows == 1;
}
/** Checks whether the matrix is a column vector. */
public boolean isColumnVector() {
return columns == 1;
}
/** Returns the diagonal of the matrix. */
public FloatMatrix diag() {
assertSquare();
FloatMatrix d = new FloatMatrix(rows);
JavaBlas.rcopy(rows, data, 0, rows + 1, d.data, 0, 1);
return d;
}
/** Pretty-print this matrix to <tt>System.out</tt>. */
public void print() {
System.out.println(toString());
}
/** Generate string representation of the matrix. */
@Override
public String toString() {
StringBuilder s = new StringBuilder();
s.append("[");
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
s.append(get(i, j));
if (j < columns - 1) {
s.append(", ");
}
}
if (i < rows - 1) {
s.append("; ");
}
}
s.append("]");
return s.toString();
}
/**
* Generate string representation of the matrix, with specified
* format for the entries. For example, <code>x.toString("%.1f")</code>
* generates a string representations having only one position after the
* decimal point.
*/
public String toString(String fmt) {
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
p.print("[");
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
p.printf(fmt, get(r, c));
if (c < columns - 1) {
p.print(", ");
}
}
if (r < rows - 1) {
p.print("; ");
}
}
p.print("]");
return s.toString();
}
/** Converts the matrix to a one-dimensional array of floats. */
public float[] toArray() {
float[] array = new float[length];
System.arraycopy(data, 0, array, 0, length);
return array;
}
/** Converts the matrix to a two-dimensional array of floats. */
public float[][] toArray2() {
float[][] array = new float[rows][columns];
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
array[r][c] = get(r, c);
}
}
return array;
}
/** Converts the matrix to a one-dimensional array of integers. */
public int[] toIntArray() {
int[] array = new int[length];
for (int i = 0; i < length; i++) {
array[i] = (int) Math.rint(get(i));
}
return array;
}
/** Convert the matrix to a two-dimensional array of integers. */
public int[][] toIntArray2() {
int[][] array = new int[rows][columns];
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
array[r][c] = (int) Math.rint(get(r, c));
}
}
return array;
}
/** Convert the matrix to a one-dimensional array of boolean values. */
public boolean[] toBooleanArray() {
boolean[] array = new boolean[length];
for (int i = 0; i < length; i++) {
array[i] = get(i) != 0.0f ? true : false;
}
return array;
}
/** Convert the matrix to a two-dimensional array of boolean values. */
public boolean[][] toBooleanArray2() {
boolean[][] array = new boolean[rows][columns];
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
array[r][c] = get(r, c) != 0.0f ? true : false;
}
}
return array;
}
public FloatMatrix toFloat() {
FloatMatrix result = new FloatMatrix(rows, columns);
for (int i = 0; i < length; i++) {
result.put(i, (float) get(i));
}
return result;
}
/**
* A wrapper which allows to view a matrix as a List of Doubles (read-only!).
* Also implements the {@link ConvertsToFloatMatrix} interface.
*/
public class ElementsAsListView extends AbstractList<Float> implements ConvertsToFloatMatrix {
private FloatMatrix me;
public ElementsAsListView(FloatMatrix me) {
this.me = me;
}
@Override
public Float get(int index) {
return me.get(index);
}
@Override
public int size() {
return me.length;
}
public FloatMatrix convertToFloatMatrix() {
return me;
}
}
public class RowsAsListView extends AbstractList<FloatMatrix> implements ConvertsToFloatMatrix {
private FloatMatrix me;
public RowsAsListView(FloatMatrix me) {
this.me = me;
}
@Override
public FloatMatrix get(int index) {
return getRow(index);
}
@Override
public int size() {
return rows;
}
public FloatMatrix convertToFloatMatrix() {
return me;
}
}
public class ColumnsAsListView extends AbstractList<FloatMatrix> implements ConvertsToFloatMatrix {
private FloatMatrix me;
public ColumnsAsListView(FloatMatrix me) {
this.me = me;
}
@Override
public FloatMatrix get(int index) {
return getColumn(index);
}
@Override
public int size() {
return columns;
}
public FloatMatrix convertToFloatMatrix() {
return me;
}
}
public List<Float> elementsAsList() {
return new ElementsAsListView(this);
}
public List<FloatMatrix> rowsAsList() {
return new RowsAsListView(this);
}
public List<FloatMatrix> columnsAsList() {
return new ColumnsAsListView(this);
}
/**************************************************************************
* Arithmetic Operations
*/
/**
* Ensures that the result vector has the same length as this. If not,
* resizing result is tried, which fails if result == this or result == other.
*/
private void ensureResultLength(FloatMatrix other, FloatMatrix result) {
if (!sameLength(result)) {
if (result == this || result == other) {
throw new SizeException("Cannot resize result matrix because it is used in-place.");
}
result.resize(rows, columns);
}
}
/** Add two matrices (in-place). */
public FloatMatrix addi(FloatMatrix other, FloatMatrix result) {
if (other.isScalar()) {
return addi(other.scalar(), result);
}
if (isScalar()) {
return other.addi(scalar(), result);
}
assertSameLength(other);
ensureResultLength(other, result);
if (result == this) {
SimpleBlas.axpy(1.0f, other, result);
} else if (result == other) {
SimpleBlas.axpy(1.0f, this, result);
} else {
/*SimpleBlas.copy(this, result);
SimpleBlas.axpy(1.0f, other, result);*/
JavaBlas.rzgxpy(length, result.data, data, other.data);
}
return result;
}
/** Add a scalar to a matrix (in-place). */
public FloatMatrix addi(float v, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) + v);
}
return result;
}
/** Subtract two matrices (in-place). */
public FloatMatrix subi(FloatMatrix other, FloatMatrix result) {
if (other.isScalar()) {
return subi(other.scalar(), result);
}
if (isScalar()) {
return other.rsubi(scalar(), result);
}
assertSameLength(other);
ensureResultLength(other, result);
if (result == this) {
SimpleBlas.axpy(-1.0f, other, result);
} else if (result == other) {
SimpleBlas.scal(-1.0f, result);
SimpleBlas.axpy(1.0f, this, result);
} else {
SimpleBlas.copy(this, result);
SimpleBlas.axpy(-1.0f, other, result);
}
return result;
}
/** Subtract a scalar from a matrix (in-place). */
public FloatMatrix subi(float v, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) - v);
}
return result;
}
/**
* Subtract two matrices, but subtract first from second matrix, that is,
* compute <em>result = other - this</em> (in-place).
* */
public FloatMatrix rsubi(FloatMatrix other, FloatMatrix result) {
return other.subi(this, result);
}
/** Subtract a matrix from a scalar (in-place). */
public FloatMatrix rsubi(float a, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, a - get(i));
}
return result;
}
/** Elementwise multiplication (in-place). */
public FloatMatrix muli(FloatMatrix other, FloatMatrix result) {
if (other.isScalar()) {
return muli(other.scalar(), result);
}
if (isScalar()) {
return other.muli(scalar(), result);
}
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) * other.get(i));
}
return result;
}
/** Elementwise multiplication with a scalar (in-place). */
public FloatMatrix muli(float v, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) * v);
}
return result;
}
/** Matrix-matrix multiplication (in-place). */
public FloatMatrix mmuli(FloatMatrix other, FloatMatrix result) {
if (other.isScalar()) {
return muli(other.scalar(), result);
}
if (isScalar()) {
return other.muli(scalar(), result);
}
/* check sizes and resize if necessary */
assertMultipliesWith(other);
if (result.rows != rows || result.columns != other.columns) {
if (result != this && result != other) {
result.resize(rows, other.columns);
} else {
throw new SizeException("Cannot resize result matrix because it is used in-place.");
}
}
if (result == this || result == other) {
/* actually, blas cannot do multiplications in-place. Therefore, we will fake by
* allocating a temporary object on the side and copy the result later.
*/
FloatMatrix temp = new FloatMatrix(result.rows, result.columns);
if (other.columns == 1) {
SimpleBlas.gemv(1.0f, this, other, 0.0f, temp);
} else {
SimpleBlas.gemm(1.0f, this, other, 0.0f, temp);
}
SimpleBlas.copy(temp, result);
} else {
if (other.columns == 1) {
SimpleBlas.gemv(1.0f, this, other, 0.0f, result);
} else {
SimpleBlas.gemm(1.0f, this, other, 0.0f, result);
}
}
return result;
}
/** Matrix-matrix multiplication with a scalar (for symmetry, does the
* same as <code>muli(scalar)</code> (in-place).
*/
public FloatMatrix mmuli(float v, FloatMatrix result) {
return muli(v, result);
}
/** Elementwise division (in-place). */
public FloatMatrix divi(FloatMatrix other, FloatMatrix result) {
if (other.isScalar()) {
return divi(other.scalar(), result);
}
if (isScalar()) {
return other.rdivi(scalar(), result);
}
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) / other.get(i));
}
return result;
}
/** Elementwise division with a scalar (in-place). */
public FloatMatrix divi(float a, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, get(i) / a);
}
return result;
}
/**
* Elementwise division, with operands switched. Computes
* <code>result = other / this</code> (in-place). */
public FloatMatrix rdivi(FloatMatrix other, FloatMatrix result) {
return other.divi(this, result);
}
/** (Elementwise) division with a scalar, with operands switched. Computes
* <code>result = a / this</code> (in-place). */
public FloatMatrix rdivi(float a, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++) {
result.put(i, a / get(i));
}
return result;
}
/** Negate each element (in-place). */
public FloatMatrix negi() {
for (int i = 0; i < length; i++) {
put(i, -get(i));
}
return this;
}
/** Negate each element. */
public FloatMatrix neg() {
return dup().negi();
}
/** Maps zero to 1.0f and all non-zero values to 0.0f (in-place). */
public FloatMatrix noti() {
for (int i = 0; i < length; i++) {
put(i, get(i) == 0.0f ? 1.0f : 0.0f);
}
return this;
}
/** Maps zero to 1.0f and all non-zero values to 0.0f. */
public FloatMatrix not() {
return dup().noti();
}
/** Maps zero to 0.0f and all non-zero values to 1.0f (in-place). */
public FloatMatrix truthi() {
for (int i = 0; i < length; i++) {
put(i, get(i) == 0.0f ? 0.0f : 1.0f);
}
return this;
}
/** Maps zero to 0.0f and all non-zero values to 1.0f. */
public FloatMatrix truth() {
return dup().truthi();
}
public FloatMatrix isNaNi() {
for (int i = 0; i < length; i++) {
put(i, Float.isNaN(get(i)) ? 1.0f : 0.0f);
}
return this;
}
public FloatMatrix isNaN() {
return dup().isNaNi();
}
public FloatMatrix isInfinitei() {
for (int i = 0; i < length; i++) {
put(i, Float.isInfinite(get(i)) ? 1.0f : 0.0f);
}
return this;
}
public FloatMatrix isInfinite() {
return dup().isInfinitei();
}
public FloatMatrix selecti(FloatMatrix where) {
checkLength(where.length);
for (int i = 0; i < length; i++) {
if (where.get(i) == 0.0f) {
put(i, 0.0f);
}
}
return this;
}
public FloatMatrix select(FloatMatrix where) {
return dup().selecti(where);
}
/****************************************************************
* Rank one-updates
*/
/** Computes a rank-1-update A = A + alpha * x * y'. */
public FloatMatrix rankOneUpdate(float alpha, FloatMatrix x, FloatMatrix y) {
if (rows != x.length) {
throw new SizeException("Vector x has wrong length (" + x.length + " != " + rows + ").");
}
if (columns != y.length) {
throw new SizeException("Vector y has wrong length (" + x.length + " != " + columns + ").");
}
SimpleBlas.ger(alpha, x, y, this);
return this;
}
/** Computes a rank-1-update A = A + alpha * x * x'. */
public FloatMatrix rankOneUpdate(float alpha, FloatMatrix x) {
return rankOneUpdate(alpha, x, x);
}
/** Computes a rank-1-update A = A + x * x'. */
public FloatMatrix rankOneUpdate(FloatMatrix x) {
return rankOneUpdate(1.0f, x, x);
}
/** Computes a rank-1-update A = A + x * y'. */
public FloatMatrix rankOneUpdate(FloatMatrix x, FloatMatrix y) {
return rankOneUpdate(1.0f, x, y);
}
/****************************************************************
* Logical operations
*/
/** Returns the minimal element of the matrix. */
public float min() {
if (isEmpty()) {
return Float.POSITIVE_INFINITY;
}
float v = Float.POSITIVE_INFINITY;
for (int i = 0; i < length; i++) {
if (!Float.isNaN(get(i)) && get(i) < v) {
v = get(i);
}
}
return v;
}
/**
* Returns the linear index of the minimal element. If there are
* more than one elements with this value, the first one is returned.
*/
public int argmin() {
if (isEmpty()) {
return -1;
}
float v = Float.POSITIVE_INFINITY;
int a = -1;
for (int i = 0; i < length; i++) {
if (!Float.isNaN(get(i)) && get(i) < v) {
v = get(i);
a = i;
}
}
return a;
}
/**
* Computes the minimum between two matrices. Returns the smaller of the
* corresponding elements in the matrix (in-place).
*/
public FloatMatrix mini(FloatMatrix other, FloatMatrix result) {
if (result == this) {
for (int i = 0; i < length; i++) {
if (get(i) > other.get(i)) {
put(i, other.get(i));
}
}
} else {
for (int i = 0; i < length; i++) {
if (get(i) > other.get(i)) {
result.put(i, other.get(i));
} else {
result.put(i, get(i));
}
}
}
return this;
}
/**
* Computes the minimum between two matrices. Returns the smaller of the
* corresponding elements in the matrix (in-place on this).
*/
public FloatMatrix mini(FloatMatrix other) {
return mini(other, this);
}
/**
* Computes the minimum between two matrices. Returns the smaller of the
* corresponding elements in the matrix (in-place on this).
*/
public FloatMatrix min(FloatMatrix other) {
return mini(other, new FloatMatrix(rows, columns));
}
public FloatMatrix mini(float v, FloatMatrix result) {
if (result == this) {
for (int i = 0; i < length; i++) {
if (get(i) > v) {
result.put(i, v);
}
}
} else {
for (int i = 0; i < length; i++) {
if (get(i) > v) {
result.put(i, v);
} else {
result.put(i, get(i));
}
}
}
return this;
}
public FloatMatrix mini(float v) {
return mini(v, this);
}
public FloatMatrix min(float v) {
return mini(v, new FloatMatrix(rows, columns));
}
/** Returns the maximal element of the matrix. */
public float max() {
if (isEmpty()) {
return Float.NEGATIVE_INFINITY;
}
float v = Float.NEGATIVE_INFINITY;
for (int i = 0; i < length; i++) {
if (!Float.isNaN(get(i)) && get(i) > v) {
v = get(i);
}
}
return v;
}
/**
* Returns the linear index of the maximal element of the matrix. If
* there are more than one elements with this value, the first one
* is returned.
*/
public int argmax() {
if (isEmpty()) {
return -1;
}
float v = Float.NEGATIVE_INFINITY;
int a = -1;
for (int i = 0; i < length; i++) {
if (!Float.isNaN(get(i)) && get(i) > v) {
v = get(i);
a = i;
}
}
return a;
}
/**
* Computes the maximum between two matrices. Returns the larger of the
* corresponding elements in the matrix (in-place).
*/
public FloatMatrix maxi(FloatMatrix other, FloatMatrix result) {
if (result == this) {
for (int i = 0; i < length; i++) {
if (get(i) < other.get(i)) {
put(i, other.get(i));
}
}
} else {
for (int i = 0; i < length; i++) {
if (get(i) < other.get(i)) {
result.put(i, other.get(i));
} else {
result.put(i, get(i));
}
}
}
return this;
}
/**
* Computes the maximum between two matrices. Returns the smaller of the
* corresponding elements in the matrix (in-place on this).
*/
public FloatMatrix maxi(FloatMatrix other) {
return maxi(other, this);
}
/**
* Computes the maximum between two matrices. Returns the larger of the
* corresponding elements in the matrix (in-place on this).
*/
public FloatMatrix max(FloatMatrix other) {
return maxi(other, new FloatMatrix(rows, columns));
}
public FloatMatrix maxi(float v, FloatMatrix result) {
if (result == this) {
for (int i = 0; i < length; i++) {
if (get(i) < v) {
result.put(i, v);
}
}
} else {
for (int i = 0; i < length; i++) {
if (get(i) < v) {
result.put(i, v);
} else {
result.put(i, get(i));
}
}
}
return this;
}
public FloatMatrix maxi(float v) {
return maxi(v, this);
}
public FloatMatrix max(float v) {
return maxi(v, new FloatMatrix(rows, columns));
}
/** Computes the sum of all elements of the matrix. */
public float sum() {
float s = 0.0f;
for (int i = 0; i < length; i++) {
s += get(i);
}
return s;
}
/** Computes the product of all elements of the matrix */
public float prod() {
float p = 1.0f;
for (int i = 0; i < length; i++) {
p *= get(i);
}
return p;
}
/**
* Computes the mean value of all elements in the matrix,
* that is, <code>x.sum() / x.length</code>.
*/
public float mean() {
return sum() / length;
}
/**
* Computes the cumulative sum, that is, the sum of all elements
* of the matrix up to a given index in linear addressing (in-place).
*/
public FloatMatrix cumulativeSumi() {
float s = 0.0f;
for (int i = 0; i < length; i++) {
s += get(i);
put(i, s);
}
return this;
}
/**
* Computes the cumulative sum, that is, the sum of all elements
* of the matrix up to a given index in linear addressing.
*/
public FloatMatrix cumulativeSum() {
return dup().cumulativeSumi();
}
/** The scalar product of this with other. */
public float dot(FloatMatrix other) {
return SimpleBlas.dot(this, other);
}
/**
* Computes the projection coefficient of other on this.
*
* The returned scalar times <tt>this</tt> is the orthogonal projection
* of <tt>other</tt> on <tt>this</tt>.
*/
public float project(FloatMatrix other) {
other.checkLength(length);
float norm = 0, dot = 0;
for (int i = 0; i < this.length; i++) {
float x = get(i);
norm += x * x;
dot += x * other.get(i);
}
return dot / norm;
}
/**
* The Euclidean norm of the matrix as vector, also the Frobenius
* norm of the matrix.
*/
public float norm2() {
float norm = 0.0f;
for (int i = 0; i < length; i++) {
norm += get(i) * get(i);
}
return (float) Math.sqrt(norm);
}
/**
* The maximum norm of the matrix (maximal absolute value of the elements).
*/
public float normmax() {
float max = 0.0f;
for (int i = 0; i < length; i++) {
float a = Math.abs(get(i));
if (a > max) {
max = a;
}
}
return max;
}
/**
* The 1-norm of the matrix as vector (sum of absolute values of elements).
*/
public float norm1() {
float norm = 0.0f;
for (int i = 0; i < length; i++) {
norm += Math.abs(get(i));
}
return norm;
}
/**
* Returns the squared (Euclidean) distance.
*/
public float squaredDistance(FloatMatrix other) {
other.checkLength(length);
float sd = 0.0f;
for (int i = 0; i < length; i++) {
float d = get(i) - other.get(i);
sd += d * d;
}
return sd;
}
/**
* Returns the (euclidean) distance.
*/
public float distance2(FloatMatrix other) {
return (float) Math.sqrt(squaredDistance(other));
}
/**
* Returns the (1-norm) distance.
*/
public float distance1(FloatMatrix other) {
other.checkLength(length);
float d = 0.0f;
for (int i = 0; i < length; i++) {
d += Math.abs(get(i) - other.get(i));
}
return d;
}
/**
* Return a new matrix with all elements sorted.
*/
public FloatMatrix sort() {
float array[] = toArray();
java.util.Arrays.sort(array);
return new FloatMatrix(rows, columns, array);
}
/**
* Sort elements in-place.
*/
public FloatMatrix sorti() {
Arrays.sort(data);
return this;
}
/**
* Get the sorting permutation.
*
* @return an int[] array such that which indexes the elements in sorted
* order.
*/
public int[] sortingPermutation() {
Integer[] indices = new Integer[length];
for (int i = 0; i < length; i++) {
indices[i] = i;
}
final float[] array = data;
Arrays.sort(indices, new Comparator() {
public int compare(Object o1, Object o2) {
int i = (Integer) o1;
int j = (Integer) o2;
if (array[i] < array[j]) {
return -1;
} else if (array[i] == array[j]) {
return 0;
} else {
return 1;
}
}
});
int[] result = new int[length];
for (int i = 0; i < length; i++) {
result[i] = indices[i];
}
return result;
}
/**
* Sort columns (in-place).
*/
public FloatMatrix sortColumnsi() {
for (int i = 0; i < length; i += rows) {
Arrays.sort(data, i, i + rows);
}
return this;
}
/** Sort columns. */
public FloatMatrix sortColumns() {
return dup().sortColumnsi();
}
/** Return matrix of indices which sort all columns. */
public int[][] columnSortingPermutations() {
int[][] result = new int[columns][];
FloatMatrix temp = new FloatMatrix(rows);
for (int c = 0; c < columns; c++) {
result[c] = getColumn(c, temp).sortingPermutation();
}
return result;
}
/** Sort rows (in-place). */
public FloatMatrix sortRowsi() {
// actually, this is much harder because the data is not consecutive
// in memory...
FloatMatrix temp = new FloatMatrix(columns);
for (int r = 0; r < rows; r++) {
putRow(r, getRow(r, temp).sorti());
}
return this;
}
/** Sort rows. */
public FloatMatrix sortRows() {
return dup().sortRowsi();
}
/** Return matrix of indices which sort all columns. */
public int[][] rowSortingPermutations() {
int[][] result = new int[rows][];
FloatMatrix temp = new FloatMatrix(columns);
for (int r = 0; r < rows; r++) {
result[r] = getRow(r, temp).sortingPermutation();
}
return result;
}
/** Return a vector containing the sums of the columns (having number of columns many entries) */
public FloatMatrix columnSums() {
if (rows == 1) {
return dup();
} else {
FloatMatrix v = new FloatMatrix(1, columns);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
v.put(c, v.get(c) + get(r, c));
}
}
return v;
}
}
/** Return a vector containing the means of all columns. */
public FloatMatrix columnMeans() {
return columnSums().divi(rows);
}
/** Return a vector containing the sum of the rows. */
public FloatMatrix rowSums() {
if (columns == 1) {
return dup();
} else {
FloatMatrix v = new FloatMatrix(rows);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
v.put(r, v.get(r) + get(r, c));
}
}
return v;
}
}
/** Return a vector containing the means of the rows. */
public FloatMatrix rowMeans() {
return rowSums().divi(columns);
}
/************************************************************************
* Column and rows access.
*/
/** Get a copy of a column. */
public FloatMatrix getColumn(int c) {
return getColumn(c, new FloatMatrix(rows, 1));
}
/** Copy a column to the given vector. */
public FloatMatrix getColumn(int c, FloatMatrix result) {
result.checkLength(rows);
JavaBlas.rcopy(rows, data, index(0, c), 1, result.data, 0, 1);
return result;
}
/** Copy a column back into the matrix. */
public void putColumn(int c, FloatMatrix v) {
JavaBlas.rcopy(rows, v.data, 0, 1, data, index(0, c), 1);
}
/** Get a copy of a row. */
public FloatMatrix getRow(int r) {
return getRow(r, new FloatMatrix(1, columns));
}
/** Copy a row to a given vector. */
public FloatMatrix getRow(int r, FloatMatrix result) {
result.checkLength(columns);
JavaBlas.rcopy(columns, data, index(r, 0), rows, result.data, 0, 1);
return result;
}
/** Copy a row back into the matrix. */
public void putRow(int r, FloatMatrix v) {
JavaBlas.rcopy(columns, v.data, 0, 1, data, index(r, 0), rows);
}
/** Return column-wise minimums. */
public FloatMatrix columnMins() {
FloatMatrix mins = new FloatMatrix(1, columns);
for (int c = 0; c < columns; c++) {
mins.put(c, getColumn(c).min());
}
return mins;
}
/** Return index of minimal element per column. */
public int[] columnArgmins() {
int[] argmins = new int[columns];
for (int c = 0; c < columns; c++) {
argmins[c] = getColumn(c).argmin();
}
return argmins;
}
/** Return column-wise maximums. */
public FloatMatrix columnMaxs() {
FloatMatrix maxs = new FloatMatrix(1, columns);
for (int c = 0; c < columns; c++) {
maxs.put(c, getColumn(c).max());
}
return maxs;
}
/** Return index of minimal element per column. */
public int[] columnArgmaxs() {
int[] argmaxs = new int[columns];
for (int c = 0; c < columns; c++) {
argmaxs[c] = getColumn(c).argmax();
}
return argmaxs;
}
/** Return row-wise minimums. */
public FloatMatrix rowMins() {
FloatMatrix mins = new FloatMatrix(rows);
for (int c = 0; c < rows; c++) {
mins.put(c, getRow(c).min());
}
return mins;
}
/** Return index of minimal element per row. */
public int[] rowArgmins() {
int[] argmins = new int[rows];
for (int c = 0; c < rows; c++) {
argmins[c] = getRow(c).argmin();
}
return argmins;
}
/** Return row-wise maximums. */
public FloatMatrix rowMaxs() {
FloatMatrix maxs = new FloatMatrix(rows);
for (int c = 0; c < rows; c++) {
maxs.put(c, getRow(c).max());
}
return maxs;
}
/** Return index of minimal element per row. */
public int[] rowArgmaxs() {
int[] argmaxs = new int[rows];
for (int c = 0; c < rows; c++) {
argmaxs[c] = getRow(c).argmax();
}
return argmaxs;
}
/**************************************************************************
* Elementwise Functions
*/
/** Add a row vector to all rows of the matrix (in place). */
public FloatMatrix addiRowVector(FloatMatrix x) {
x.checkLength(columns);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) + x.get(c));
}
}
return this;
}
/** Add a row to all rows of the matrix. */
public FloatMatrix addRowVector(FloatMatrix x) {
return dup().addiRowVector(x);
}
/** Add a vector to all columns of the matrix (in-place). */
public FloatMatrix addiColumnVector(FloatMatrix x) {
x.checkLength(rows);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) + x.get(r));
}
}
return this;
}
/** Add a vector to all columns of the matrix. */
public FloatMatrix addColumnVector(FloatMatrix x) {
return dup().addiColumnVector(x);
}
/** Subtract a row vector from all rows of the matrix (in-place). */
public FloatMatrix subiRowVector(FloatMatrix x) {
// This is a bit crazy, but a row vector must have as length as the columns of the matrix.
x.checkLength(columns);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) - x.get(c));
}
}
return this;
}
/** Subtract a row vector from all rows of the matrix. */
public FloatMatrix subRowVector(FloatMatrix x) {
return dup().subiRowVector(x);
}
/** Subtract a column vector from all columns of the matrix (in-place). */
public FloatMatrix subiColumnVector(FloatMatrix x) {
x.checkLength(rows);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) - x.get(r));
}
}
return this;
}
/** Subtract a vector from all columns of the matrix. */
public FloatMatrix subColumnVector(FloatMatrix x) {
return dup().subiColumnVector(x);
}
/** Multiply a row by a scalar. */
public FloatMatrix mulRow(int r, float scale) {
NativeBlas.sscal(columns, scale, data, index(r, 0), rows);
return this;
}
/** Multiply a column by a scalar. */
public FloatMatrix mulColumn(int c, float scale) {
NativeBlas.sscal(rows, scale, data, index(0, c), 1);
return this;
}
/** Multiply all columns with a column vector (in-place). */
public FloatMatrix muliColumnVector(FloatMatrix x) {
x.checkLength(rows);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) * x.get(r));
}
}
return this;
}
/** Multiply all columns with a column vector. */
public FloatMatrix mulColumnVector(FloatMatrix x) {
return dup().muliColumnVector(x);
}
/** Multiply all rows with a row vector (in-place). */
public FloatMatrix muliRowVector(FloatMatrix x) {
x.checkLength(columns);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) * x.get(c));
}
}
return this;
}
/** Multiply all rows with a row vector. */
public FloatMatrix mulRowVector(FloatMatrix x) {
return dup().muliRowVector(x);
}
public FloatMatrix diviRowVector(FloatMatrix x) {
x.checkLength(columns);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) / x.get(c));
}
}
return this;
}
public FloatMatrix divRowVector(FloatMatrix x) {
return dup().diviRowVector(x);
}
public FloatMatrix diviColumnVector(FloatMatrix x) {
x.checkLength(rows);
for (int c = 0; c < columns; c++) {
for (int r = 0; r < rows; r++) {
put(r, c, get(r, c) / x.get(r));
}
}
return this;
}
public FloatMatrix divColumnVector(FloatMatrix x) {
return dup().diviColumnVector(x);
}
/**
* Writes out this matrix to the given data stream.
* @param dos the data output stream to write to.
* @throws IOException
*/
public void out(DataOutputStream dos) throws IOException {
dos.writeUTF("float");
dos.writeInt(columns);
dos.writeInt(rows);
dos.writeInt(data.length);
for (int i = 0; i < data.length; i++) {
dos.writeDouble(data[i]);
}
}
/**
* Reads in a matrix from the given data stream. Note
* that the old data of this matrix will be discarded.
* @param dis the data input stream to read from.
* @throws IOException
*/
public void in(DataInputStream dis) throws IOException {
if (!dis.readUTF().equals("float")) {
throw new IllegalStateException("The matrix in the specified file is not of the correct type!");
}
this.columns = dis.readInt();
this.rows = dis.readInt();
final int MAX = dis.readInt();
data = new float[MAX];
for (int i = 0; i < MAX; i++) {
data[i] = dis.readFloat();
}
}
/**
* Saves this matrix to the specified file.
* @param filename the file to write the matrix in.
* @throws IOException thrown on errors while writing the matrix to the file
*/
public void save(String filename) throws IOException {
DataOutputStream dos = new DataOutputStream(new FileOutputStream(filename, false));
this.out(dos);
}
/**
* Loads a matrix from a file into this matrix. Note that the old data
* of this matrix will be discarded.
* @param filename the file to read the matrix from
* @throws IOException thrown on errors while reading the matrix
*/
public void load(String filename) throws IOException {
DataInputStream dis = new DataInputStream(new FileInputStream(filename));
this.in(dis);
}
public static FloatMatrix loadAsciiFile(String filename) throws IOException {
BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
// Go through file and count columns and rows. What makes this endeavour a bit difficult is
// that files can have leading or trailing spaces leading to spurious fields
// after String.split().
String line;
int rows = 0;
int columns = -1;
while ((line = is.readLine()) != null) {
String[] elements = line.split("\\s+");
int numElements = elements.length;
if (elements[0].length() == 0) {
numElements--;
}
if (elements[elements.length - 1].length() == 0) {
numElements--;
}
if (columns == -1) {
columns = numElements;
} else {
if (columns != numElements) {
throw new IOException("Number of elements changes in line " + line + ".");
}
}
rows++;
}
is.close();
// Go through file a second time process the actual data.
is = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
FloatMatrix result = new FloatMatrix(rows, columns);
int r = 0;
while ((line = is.readLine()) != null) {
String[] elements = line.split("\\s+");
int firstElement = (elements[0].length() == 0) ? 1 : 0;
for (int c = 0, cc = firstElement; c < columns; c++, cc++) {
result.put(r, c, Float.valueOf(elements[cc]));
}
r++;
}
return result;
}
public static FloatMatrix loadCSVFile(String filename) throws IOException {
BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
List<FloatMatrix> rows = new LinkedList<FloatMatrix>();
String line;
int columns = -1;
while ((line = is.readLine()) != null) {
String[] elements = line.split(",");
int numElements = elements.length;
if (elements[0].length() == 0) {
numElements--;
}
if (elements[elements.length - 1].length() == 0) {
numElements--;
}
if (columns == -1) {
columns = numElements;
} else {
if (columns != numElements) {
throw new IOException("Number of elements changes in line " + line + ".");
}
}
FloatMatrix row = new FloatMatrix(columns);
for (int c = 0; c < columns; c++) {
row.put(c, Float.valueOf(elements[c]));
}
rows.add(row);
}
is.close();
System.out.println("Done reading file");
FloatMatrix result = new FloatMatrix(rows.size(), columns);
int r = 0;
Iterator<FloatMatrix> ri = rows.iterator();
while (ri.hasNext()) {
result.putRow(r, ri.next());
r++;
}
return result;
}
/****************************************************************
* Autogenerated code
*/
/***** Code for operators ***************************************/
/* Overloads for the usual arithmetic operations */
/*#
def gen_overloads(base, result_rows, result_cols, verb=''); <<-EOS
#{doc verb.capitalize + " a matrix (in place)."}
public FloatMatrix #{base}i(FloatMatrix other) {
return #{base}i(other, this);
}
#{doc verb.capitalize + " a matrix (in place)."}
public FloatMatrix #{base}(FloatMatrix other) {
return #{base}i(other, new FloatMatrix(#{result_rows}, #{result_cols}));
}
#{doc verb.capitalize + " a scalar (in place)."}
public FloatMatrix #{base}i(float v) {
return #{base}i(v, this);
}
#{doc verb.capitalize + " a scalar."}
public FloatMatrix #{base}(float v) {
return #{base}i(v, new FloatMatrix(rows, columns));
}
EOS
end
#*/
/* Generating code for logical operators. This not only generates the stubs
* but really all of the code.
*/
/*#
def gen_compare(name, op, cmp); <<-EOS
#{doc 'Test for ' + cmp + ' (in-place).'}
public FloatMatrix #{name}i(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return #{name}i(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) #{op} other.get(i) ? 1.0f : 0.0f);
return result;
}
#{doc 'Test for ' + cmp + ' (in-place).'}
public FloatMatrix #{name}i(FloatMatrix other) {
return #{name}i(other, this);
}
#{doc 'Test for ' + cmp + '.'}
public FloatMatrix #{name}(FloatMatrix other) {
return #{name}i(other, new FloatMatrix(rows, columns));
}
#{doc 'Test for ' + cmp + ' against a scalar (in-place).'}
public FloatMatrix #{name}i(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) #{op} value ? 1.0f : 0.0f);
return result;
}
#{doc 'Test for ' + cmp + ' against a scalar (in-place).'}
public FloatMatrix #{name}i(float value) {
return #{name}i(value, this);
}
#{doc 'test for ' + cmp + ' against a scalar.'}
public FloatMatrix #{name}(float value) {
return #{name}i(value, new FloatMatrix(rows, columns));
}
EOS
end
#*/
/*#
def gen_logical(name, op, cmp); <<-EOS
#{doc 'Compute elementwise ' + cmp + ' (in-place).'}
public FloatMatrix #{name}i(FloatMatrix other, FloatMatrix result) {
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) #{op} (other.get(i) != 0.0f) ? 1.0f : 0.0f);
return result;
}
#{doc 'Compute elementwise ' + cmp + ' (in-place).'}
public FloatMatrix #{name}i(FloatMatrix other) {
return #{name}i(other, this);
}
#{doc 'Compute elementwise ' + cmp + '.'}
public FloatMatrix #{name}(FloatMatrix other) {
return #{name}i(other, new FloatMatrix(rows, columns));
}
#{doc 'Compute elementwise ' + cmp + ' against a scalar (in-place).'}
public FloatMatrix #{name}i(float value, FloatMatrix result) {
ensureResultLength(null, result);
boolean val = (value != 0.0f);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) #{op} val ? 1.0f : 0.0f);
return result;
}
#{doc 'Compute elementwise ' + cmp + ' against a scalar (in-place).'}
public FloatMatrix #{name}i(float value) {
return #{name}i(value, this);
}
#{doc 'Compute elementwise ' + cmp + ' against a scalar.'}
public FloatMatrix #{name}(float value) {
return #{name}i(value, new FloatMatrix(rows, columns));
}
EOS
end
#*/
/*# collect(gen_overloads('add', 'rows', 'columns', 'add'),
gen_overloads('sub', 'rows', 'columns', 'subtract'),
gen_overloads('rsub', 'rows', 'columns', '(right-)subtract'),
gen_overloads('div', 'rows', 'columns', 'elementwise divide by'),
gen_overloads('rdiv', 'rows', 'columns', '(right-)elementwise divide by'),
gen_overloads('mul', 'rows', 'columns', 'elementwise multiply by'),
gen_overloads('mmul', 'rows', 'other.columns', 'matrix-multiply by'),
gen_compare('lt', '<', '"less than"'),
gen_compare('gt', '>', '"greater than"'),
gen_compare('le', '<=', '"less than or equal"'),
gen_compare('ge', '>=', '"greater than or equal"'),
gen_compare('eq', '==', 'equality'),
gen_compare('ne', '!=', 'inequality'),
gen_logical('and', '&', 'logical and'),
gen_logical('or', '|', 'logical or'),
gen_logical('xor', '^', 'logical xor'))
#*/
//RJPP-BEGIN------------------------------------------------------------
/** Add a matrix (in place). */
public FloatMatrix addi(FloatMatrix other) {
return addi(other, this);
}
/** Add a matrix (in place). */
public FloatMatrix add(FloatMatrix other) {
return addi(other, new FloatMatrix(rows, columns));
}
/** Add a scalar (in place). */
public FloatMatrix addi(float v) {
return addi(v, this);
}
/** Add a scalar. */
public FloatMatrix add(float v) {
return addi(v, new FloatMatrix(rows, columns));
}
/** Subtract a matrix (in place). */
public FloatMatrix subi(FloatMatrix other) {
return subi(other, this);
}
/** Subtract a matrix (in place). */
public FloatMatrix sub(FloatMatrix other) {
return subi(other, new FloatMatrix(rows, columns));
}
/** Subtract a scalar (in place). */
public FloatMatrix subi(float v) {
return subi(v, this);
}
/** Subtract a scalar. */
public FloatMatrix sub(float v) {
return subi(v, new FloatMatrix(rows, columns));
}
/** (right-)subtract a matrix (in place). */
public FloatMatrix rsubi(FloatMatrix other) {
return rsubi(other, this);
}
/** (right-)subtract a matrix (in place). */
public FloatMatrix rsub(FloatMatrix other) {
return rsubi(other, new FloatMatrix(rows, columns));
}
/** (right-)subtract a scalar (in place). */
public FloatMatrix rsubi(float v) {
return rsubi(v, this);
}
/** (right-)subtract a scalar. */
public FloatMatrix rsub(float v) {
return rsubi(v, new FloatMatrix(rows, columns));
}
/** Elementwise divide by a matrix (in place). */
public FloatMatrix divi(FloatMatrix other) {
return divi(other, this);
}
/** Elementwise divide by a matrix (in place). */
public FloatMatrix div(FloatMatrix other) {
return divi(other, new FloatMatrix(rows, columns));
}
/** Elementwise divide by a scalar (in place). */
public FloatMatrix divi(float v) {
return divi(v, this);
}
/** Elementwise divide by a scalar. */
public FloatMatrix div(float v) {
return divi(v, new FloatMatrix(rows, columns));
}
/** (right-)elementwise divide by a matrix (in place). */
public FloatMatrix rdivi(FloatMatrix other) {
return rdivi(other, this);
}
/** (right-)elementwise divide by a matrix (in place). */
public FloatMatrix rdiv(FloatMatrix other) {
return rdivi(other, new FloatMatrix(rows, columns));
}
/** (right-)elementwise divide by a scalar (in place). */
public FloatMatrix rdivi(float v) {
return rdivi(v, this);
}
/** (right-)elementwise divide by a scalar. */
public FloatMatrix rdiv(float v) {
return rdivi(v, new FloatMatrix(rows, columns));
}
/** Elementwise multiply by a matrix (in place). */
public FloatMatrix muli(FloatMatrix other) {
return muli(other, this);
}
/** Elementwise multiply by a matrix (in place). */
public FloatMatrix mul(FloatMatrix other) {
return muli(other, new FloatMatrix(rows, columns));
}
/** Elementwise multiply by a scalar (in place). */
public FloatMatrix muli(float v) {
return muli(v, this);
}
/** Elementwise multiply by a scalar. */
public FloatMatrix mul(float v) {
return muli(v, new FloatMatrix(rows, columns));
}
/** Matrix-multiply by a matrix (in place). */
public FloatMatrix mmuli(FloatMatrix other) {
return mmuli(other, this);
}
/** Matrix-multiply by a matrix (in place). */
public FloatMatrix mmul(FloatMatrix other) {
return mmuli(other, new FloatMatrix(rows, other.columns));
}
/** Matrix-multiply by a scalar (in place). */
public FloatMatrix mmuli(float v) {
return mmuli(v, this);
}
/** Matrix-multiply by a scalar. */
public FloatMatrix mmul(float v) {
return mmuli(v, new FloatMatrix(rows, columns));
}
/** Test for "less than" (in-place). */
public FloatMatrix lti(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return lti(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) < other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for "less than" (in-place). */
public FloatMatrix lti(FloatMatrix other) {
return lti(other, this);
}
/** Test for "less than". */
public FloatMatrix lt(FloatMatrix other) {
return lti(other, new FloatMatrix(rows, columns));
}
/** Test for "less than" against a scalar (in-place). */
public FloatMatrix lti(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) < value ? 1.0f : 0.0f);
return result;
}
/** Test for "less than" against a scalar (in-place). */
public FloatMatrix lti(float value) {
return lti(value, this);
}
/** test for "less than" against a scalar. */
public FloatMatrix lt(float value) {
return lti(value, new FloatMatrix(rows, columns));
}
/** Test for "greater than" (in-place). */
public FloatMatrix gti(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return gti(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) > other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for "greater than" (in-place). */
public FloatMatrix gti(FloatMatrix other) {
return gti(other, this);
}
/** Test for "greater than". */
public FloatMatrix gt(FloatMatrix other) {
return gti(other, new FloatMatrix(rows, columns));
}
/** Test for "greater than" against a scalar (in-place). */
public FloatMatrix gti(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) > value ? 1.0f : 0.0f);
return result;
}
/** Test for "greater than" against a scalar (in-place). */
public FloatMatrix gti(float value) {
return gti(value, this);
}
/** test for "greater than" against a scalar. */
public FloatMatrix gt(float value) {
return gti(value, new FloatMatrix(rows, columns));
}
/** Test for "less than or equal" (in-place). */
public FloatMatrix lei(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return lei(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) <= other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for "less than or equal" (in-place). */
public FloatMatrix lei(FloatMatrix other) {
return lei(other, this);
}
/** Test for "less than or equal". */
public FloatMatrix le(FloatMatrix other) {
return lei(other, new FloatMatrix(rows, columns));
}
/** Test for "less than or equal" against a scalar (in-place). */
public FloatMatrix lei(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) <= value ? 1.0f : 0.0f);
return result;
}
/** Test for "less than or equal" against a scalar (in-place). */
public FloatMatrix lei(float value) {
return lei(value, this);
}
/** test for "less than or equal" against a scalar. */
public FloatMatrix le(float value) {
return lei(value, new FloatMatrix(rows, columns));
}
/** Test for "greater than or equal" (in-place). */
public FloatMatrix gei(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return gei(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) >= other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for "greater than or equal" (in-place). */
public FloatMatrix gei(FloatMatrix other) {
return gei(other, this);
}
/** Test for "greater than or equal". */
public FloatMatrix ge(FloatMatrix other) {
return gei(other, new FloatMatrix(rows, columns));
}
/** Test for "greater than or equal" against a scalar (in-place). */
public FloatMatrix gei(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) >= value ? 1.0f : 0.0f);
return result;
}
/** Test for "greater than or equal" against a scalar (in-place). */
public FloatMatrix gei(float value) {
return gei(value, this);
}
/** test for "greater than or equal" against a scalar. */
public FloatMatrix ge(float value) {
return gei(value, new FloatMatrix(rows, columns));
}
/** Test for equality (in-place). */
public FloatMatrix eqi(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return eqi(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) == other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for equality (in-place). */
public FloatMatrix eqi(FloatMatrix other) {
return eqi(other, this);
}
/** Test for equality. */
public FloatMatrix eq(FloatMatrix other) {
return eqi(other, new FloatMatrix(rows, columns));
}
/** Test for equality against a scalar (in-place). */
public FloatMatrix eqi(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) == value ? 1.0f : 0.0f);
return result;
}
/** Test for equality against a scalar (in-place). */
public FloatMatrix eqi(float value) {
return eqi(value, this);
}
/** test for equality against a scalar. */
public FloatMatrix eq(float value) {
return eqi(value, new FloatMatrix(rows, columns));
}
/** Test for inequality (in-place). */
public FloatMatrix nei(FloatMatrix other, FloatMatrix result) {
if (other.isScalar())
return nei(other.scalar(), result);
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) != other.get(i) ? 1.0f : 0.0f);
return result;
}
/** Test for inequality (in-place). */
public FloatMatrix nei(FloatMatrix other) {
return nei(other, this);
}
/** Test for inequality. */
public FloatMatrix ne(FloatMatrix other) {
return nei(other, new FloatMatrix(rows, columns));
}
/** Test for inequality against a scalar (in-place). */
public FloatMatrix nei(float value, FloatMatrix result) {
ensureResultLength(null, result);
for (int i = 0; i < length; i++)
result.put(i, get(i) != value ? 1.0f : 0.0f);
return result;
}
/** Test for inequality against a scalar (in-place). */
public FloatMatrix nei(float value) {
return nei(value, this);
}
/** test for inequality against a scalar. */
public FloatMatrix ne(float value) {
return nei(value, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical and (in-place). */
public FloatMatrix andi(FloatMatrix other, FloatMatrix result) {
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) & (other.get(i) != 0.0f) ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical and (in-place). */
public FloatMatrix andi(FloatMatrix other) {
return andi(other, this);
}
/** Compute elementwise logical and. */
public FloatMatrix and(FloatMatrix other) {
return andi(other, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical and against a scalar (in-place). */
public FloatMatrix andi(float value, FloatMatrix result) {
ensureResultLength(null, result);
boolean val = (value != 0.0f);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) & val ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical and against a scalar (in-place). */
public FloatMatrix andi(float value) {
return andi(value, this);
}
/** Compute elementwise logical and against a scalar. */
public FloatMatrix and(float value) {
return andi(value, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical or (in-place). */
public FloatMatrix ori(FloatMatrix other, FloatMatrix result) {
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) | (other.get(i) != 0.0f) ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical or (in-place). */
public FloatMatrix ori(FloatMatrix other) {
return ori(other, this);
}
/** Compute elementwise logical or. */
public FloatMatrix or(FloatMatrix other) {
return ori(other, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical or against a scalar (in-place). */
public FloatMatrix ori(float value, FloatMatrix result) {
ensureResultLength(null, result);
boolean val = (value != 0.0f);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) | val ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical or against a scalar (in-place). */
public FloatMatrix ori(float value) {
return ori(value, this);
}
/** Compute elementwise logical or against a scalar. */
public FloatMatrix or(float value) {
return ori(value, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical xor (in-place). */
public FloatMatrix xori(FloatMatrix other, FloatMatrix result) {
assertSameLength(other);
ensureResultLength(other, result);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) ^ (other.get(i) != 0.0f) ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical xor (in-place). */
public FloatMatrix xori(FloatMatrix other) {
return xori(other, this);
}
/** Compute elementwise logical xor. */
public FloatMatrix xor(FloatMatrix other) {
return xori(other, new FloatMatrix(rows, columns));
}
/** Compute elementwise logical xor against a scalar (in-place). */
public FloatMatrix xori(float value, FloatMatrix result) {
ensureResultLength(null, result);
boolean val = (value != 0.0f);
for (int i = 0; i < length; i++)
result.put(i, (get(i) != 0.0f) ^ val ? 1.0f : 0.0f);
return result;
}
/** Compute elementwise logical xor against a scalar (in-place). */
public FloatMatrix xori(float value) {
return xori(value, this);
}
/** Compute elementwise logical xor against a scalar. */
public FloatMatrix xor(float value) {
return xori(value, new FloatMatrix(rows, columns));
}
//RJPP-END--------------------------------------------------------------
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
30badca6d7da2bf56bf13e4fb76945fdd4e2c832 | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/DeleteUseCaseResult.java | 555442e6ce04cdb0d78fef5bf3e9dafc736991a6 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 2,322 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.connect.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/DeleteUseCase" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeleteUseCaseResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeleteUseCaseResult == false)
return false;
DeleteUseCaseResult other = (DeleteUseCaseResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public DeleteUseCaseResult clone() {
try {
return (DeleteUseCaseResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
74ef329d1396626a03c1a4d190339e59a855c2c8 | 8322f49ea44bf10d8ea158dd61b21658baf06290 | /app/src/main/java/com/qf/h5/adapter/GiftCenterAdapter.java | 5760e2debca83f9bd36193220e6f2f02486ab1f9 | [] | no_license | Moon0011/qfh5app | 85c9308d406f94a81e25851bcffbc2ee39958871 | fbed4efd6779786685eeb91cb8918b088b9a162a | refs/heads/master | 2021-09-04T03:53:31.776375 | 2018-01-15T14:53:57 | 2018-01-15T14:53:57 | 112,156,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,839 | java | package com.qf.h5.adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.qf.h5.R;
import com.qf.h5.bean.RecommendBean;
import com.qf.h5.common.GlideApp;
import com.qf.h5.ui.H5WebActivity;
import java.util.List;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
/**
* Created by Administrator on 2017/11/24.
*/
public class GiftCenterAdapter extends RecyclerView.Adapter<GiftCenterAdapter.ViewHolder> {
private Context mContext;
private List<RecommendBean> mDatas;
private LayoutInflater inf;
public interface OnRecyclerViewItemListener {
void onItemClickListener(View view, int position);
}
private OnRecyclerViewItemListener mOnRecyclerViewItemListener;
public void setOnRecyclerViewItemListener(OnRecyclerViewItemListener listener) {
mOnRecyclerViewItemListener = listener;
}
public GiftCenterAdapter(Context mContext, List<RecommendBean> datas) {
this.mContext = mContext;
mDatas = datas;
inf = LayoutInflater.from(mContext);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = inf.inflate(R.layout.gift_center_item_layout, viewGroup, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
if (holder == null) {
return;
}
holder.tvGameName.setText(mDatas.get(position).getGameName());
holder.tvType.setText(mDatas.get(position).getType() + "");
GlideApp.with(mContext)
.load(mDatas.get(position).getBgurl())
.placeholder(R.mipmap.error_pic)
.transition(withCrossFade())
.error(R.mipmap.error_pic)
.into(holder.imgbg);
holder.play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, H5WebActivity.class);
Bundle b = new Bundle();
b.putString("game_name", mDatas.get(position).getGameName());
intent.putExtras(b);
mContext.startActivity(intent);
}
});
if (mOnRecyclerViewItemListener != null) {
itemOnClick(holder);
}
}
@Override
public int getItemCount() {
return mDatas.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
TextView tvGameName, tvType;
ImageView imgbg;
Button play;
public ViewHolder(View itemView) {
super(itemView);
tvGameName = (TextView) itemView.findViewById(R.id.game_name);
tvType = (TextView) itemView.findViewById(R.id.game_type);
imgbg = (ImageView) itemView.findViewById(R.id.game_logo);
play = (Button) itemView.findViewById(R.id.btn_play);
}
}
private void itemOnClick(final RecyclerView.ViewHolder holder) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// int position = holder.getLayoutPosition();
// mOnRecyclerViewItemListener.onItemClickListener(holder.itemView, position);
}
});
}
public void clearData() {
mDatas.clear();
}
public void addAllData(List<RecommendBean> dataList) {
mDatas.addAll(dataList);
notifyDataSetChanged();
}
} | [
"hover_android@126.com"
] | hover_android@126.com |
4dddcc91f49f4f5960b2574cc06fd688e1b83b40 | 6b3240d9336b4c7b6e3564e88971d8bb74daefa5 | /design-pattern/src/main/java/com/nextyu/study/design/pattern/cor/handler/PriceHandlerFactory.java | 558a6dacbaa5728f58817f4b67b752d73b98f68f | [] | no_license | nextyu/study-source | 5bc5307e165ffbdd5ea123290ca56a7ece226f7c | a9d215ec12ea20827dda67e2054773332c34a870 | refs/heads/master | 2020-12-25T14:37:47.523120 | 2017-12-26T09:07:13 | 2017-12-26T09:07:13 | 63,568,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.nextyu.study.design.pattern.cor.handler;
/**
* @author nextyu
* @version 1.0
*/
public class PriceHandlerFactory {
/**
* 创建PriceHandler的工厂方法
* @return
*/
public static PriceHandler createPriceHandler() {
Sales sales = new Sales();
Lead lead = new Lead();
Manager manager = new Manager();
Director director = new Director();
VicePresident vicePresident = new VicePresident();
CEO ceo = new CEO();
sales.setSuccessor(lead);
lead.setSuccessor(manager);
manager.setSuccessor(director);
director.setSuccessor(vicePresident);
vicePresident.setSuccessor(ceo);
return sales;
}
}
| [
"2530510290@qq.com"
] | 2530510290@qq.com |
05583e385fb431eee5e5901cea0a646cf2e33af0 | 9ebf0ddc783581968b0188afdc982a0f6e6183b1 | /src/com/sst/cxf/service/CustomerSerivice.java | 1026eee135dfb5866a56283c2d050c85b42714ab | [] | no_license | SunShengTeng/CRM_Service | c4142dd5c24b375d7543a76926966d5e373c28f0 | c4b655f165d42098ad31882dfd4eff87f4821a2c | refs/heads/master | 2021-05-08T18:15:11.660444 | 2018-01-30T08:49:17 | 2018-01-30T08:49:17 | 119,507,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package com.sst.cxf.service;
import java.util.List;
import javax.jws.WebService;
import com.sst.cxf.entity.Customer;
@WebService
public interface CustomerSerivice {
/**
* 查询所有的客户
* @return
*/
public List<Customer> customerListAll();
/**
* 查询没有关联定区的客户
* @return
*/
public List<Customer> customerListNotDecidedZone();
/**
* 通过定区ID查询客户
* @param decidedzoneid
* @return
*/
public List<Customer> customerListByDecidedZoneId(String decidedzoneid);
/**
* 更新客户关联的定区
* @param dId
* @param customerIds
*/
public void updateDecidedZoneId(String dId,Integer[] customerIds);
/**
* 根据手机号查询客户信息
* @param telephone
* @return
*/
public Customer findCustomerByTelephone(String telephone);
/**
* 根据的地址查询客户的定区ID
* @param address
* @return
*/
public String findDecidedZoneByaddress(String address);
}
| [
"sunshengteng@yahoo.com"
] | sunshengteng@yahoo.com |
bdcd45b3524b4e69592c3a99bde30c1644bd4d6a | 81413a1034b847a38cdf3d7018e7d5498eb70972 | /src/main/java/com/hrong/major/model/vo/DetailUpdateVo.java | ef327e7858078ea4514cabf1aeff6bf7ae726a42 | [] | no_license | 18113996630/major_show | e0c2a16b9a15f3f462ccae3d3135cd8891b488df | ca8db3092663df54920f70401b129ae8cec714cc | refs/heads/master | 2022-09-16T10:47:16.581427 | 2020-03-21T02:43:29 | 2020-03-21T02:43:29 | 201,893,355 | 10 | 1 | null | 2022-09-01T23:12:46 | 2019-08-12T08:54:02 | Java | UTF-8 | Java | false | false | 1,123 | java | package com.hrong.major.model.vo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author hrong
* @since 2019-09-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DetailUpdateVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Integer id;
/**
* 修改内容
*/
private String content;
/**
* 原内容
*/
private String contentBefore;
/**
* 修改类型
*/
private String type;
/**
* 修改原因
*/
private String reason;
/**
* 专业名字
*
*/
private String majorName;
/**
* 用户id
*/
private String ip;
private String city;
/**
* 提交时间
*/
private String time;
/**
* 状态(0-待处理 1-已通过 -1-未通过)
*/
private Integer status;
}
| [
"18113996630"
] | 18113996630 |
069501506d59fcb2079555ad57550fb3a2ec5f6d | 1585d61018e64fb5e72202a783b6ff9036a847df | /app/src/main/java/com/sinocall/phonerecordera/dao/CallLogBean.java | 9b5a59aa418eb0bffdb016aa82a5a1e3fcc96ec1 | [] | no_license | Wadeqing/phoneRecording | 06402f6017ba46ed8dbc906e11ebe5d397095f0c | 832e8fc25fa826227a4348757856b9381c7ab635 | refs/heads/master | 2020-04-08T08:49:44.190267 | 2018-11-26T16:17:37 | 2018-11-26T16:17:37 | 159,195,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package com.sinocall.phonerecordera.dao;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
/**
* Created by qingchao on 2017/12/7.
*/
@Entity
public class CallLogBean {
@Id
private long id;
private String name;
private String phoneNum;
@Generated(hash = 767922866)
public CallLogBean(long id, String name, String phoneNum) {
this.id = id;
this.name = name;
this.phoneNum = phoneNum;
}
@Generated(hash = 837774923)
public CallLogBean() {
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getPhoneNum() {
return this.phoneNum;
}
public void setPhoneNum(String phoneNum) {
this.phoneNum = phoneNum;
}
}
| [
"m17600380089@163.com"
] | m17600380089@163.com |
1ebb6f0d5b16a9e48d7db765bec364350b61ad42 | 92459cdb854868e182b4c269a0fcbe8d6e3ad117 | /src/main/java/com/iandtop/utils/excel/User.java | 8ba812eb452c2cec701b7f6c7add71cf300da8a0 | [
"Apache-2.0"
] | permissive | hoeoy/wwj | 81516361f6154a7d52ff7c1e06f1a122796b5b4e | f89d8e78bd1c50904c2ac8d4cc4ff2f90ee5929c | refs/heads/master | 2018-11-23T23:54:16.287744 | 2018-10-09T07:48:10 | 2018-10-09T07:48:10 | 119,341,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | package com.iandtop.utils.excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by lz on 2017/4/12.
*/
public class User {
public User(){
}
@Excel(name = "姓名", width = 30)
private String name;
@Excel(name = "年龄", width = 60)
private String age;
@Excel(skip = true)
private String password;
@Excel(name = "xx")
private Double xx;
@Excel(name = "yy")
private Date yy;
@Excel(name = "锁定")
private Boolean locked;
@Excel(name = "金额")
private BigDecimal db;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Double getXx() {
return xx;
}
public void setXx(Double xx) {
this.xx = xx;
}
public Date getYy() {
return yy;
}
public void setYy(Date yy) {
this.yy = yy;
}
public Boolean getLocked() {
return locked;
}
public void setLocked(Boolean locked) {
this.locked = locked;
}
public BigDecimal getDb() {
return db;
}
public void setDb(BigDecimal db) {
this.db = db;
}
}
| [
"andy_zhaozhao@hotmail.com"
] | andy_zhaozhao@hotmail.com |
bb9104a28217330a3004602b61a57406a8f96926 | b96c7576b33a1dd1b128756c6de8cabdeb053303 | /Repositories/STS/mvc-java1/src/main/java/io/github/donggi/mvc/config/Initializer.java | e2ad68f64edbd761db115f0fb5348783ef9981f6 | [
"MIT"
] | permissive | Dong-gi/Dong-gi.github.io | 04066d9ed57aa0519800939c3f9da576f35a28a2 | 716fd3a4d2aeffb6390f9612447b6684f194c058 | refs/heads/master | 2023-08-31T11:54:00.075070 | 2023-08-30T10:25:28 | 2023-08-30T10:25:28 | 111,770,080 | 6 | 1 | MIT | 2023-04-19T13:44:34 | 2017-11-23T06:07:47 | HTML | UTF-8 | Java | false | false | 862 | java | package io.github.donggi.mvc.config;
import javax.servlet.ServletContext;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class Initializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletCxt) {
// WebApplicationContext 로드
var ac = new AnnotationConfigWebApplicationContext();
ac.setServletContext(servletCxt);
ac.register(AppConfig.class);
ac.refresh();
// DispatcherServlet 등록
var dispatcher = new DispatcherServlet(ac);
var registration = servletCxt.addServlet("app", dispatcher);
registration.setLoadOnStartup(1);
registration.addMapping("/*");
}
} | [
"hi.donggi@gmail.com"
] | hi.donggi@gmail.com |
73b518821d6c6c4e4143540806985560a8421f7a | 6b82ceb2db205e6b85894bb647cf87aefb605acc | /src/IHasRings.java | e595f3c5ddaf01596a6b5b6ea32cc06f6ef75153 | [] | no_license | karansharma516/COMP1011-Assignment3 | 19813aa5eb9c4674c6874961ead4acb4f28ae7b5 | c433c680060c9db2f9984fa6be85a988fd0d7e24 | refs/heads/master | 2021-01-22T02:08:32.105112 | 2015-02-20T03:39:00 | 2015-02-20T03:39:00 | 30,786,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | /**
*
* @author karan sharma
* @description added the interface to check whether planet has ring
* @version: 1.1
*/
public interface IHasRings {
Boolean HasRings();
}
| [
"karan.sharma516@yahoo.com"
] | karan.sharma516@yahoo.com |
600fd8df439f1448c078a9eaf1880c262c4b9deb | 1d96c215d672c5fa0d6ed79fab5881f0304eafd1 | /xamoomsdk/src/main/java/com/xamoom/android/xamoomsdk/Storage/FileManager.java | a10506bad0d7841c7c6bc5d3520b986332b4d571 | [
"MIT"
] | permissive | morristech/xamoom-android-sdk | 31f0cc72212435391e6d1a93aa2a521829ec06cf | 2955f1325bee4bd1d49368175a147d89110390a0 | refs/heads/master | 2020-09-07T17:11:00.185609 | 2019-11-04T12:33:09 | 2019-11-04T12:33:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,209 | java | /*
* Copyright (c) 2017 xamoom GmbH <apps@xamoom.com>
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at the root of this project.
*/
package com.xamoom.android.xamoomsdk.Storage;
import android.content.Context;
import android.net.Uri;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* FileManager to save and retriev data from disk.
*/
public class FileManager {
private static FileManager mInstance;
private Context mContext;
public static FileManager getInstance(Context context) {
if (mInstance == null) {
mInstance = new FileManager(context);
}
return mInstance;
}
public FileManager(Context context) {
mContext = context;
}
/**
* Saves file to internal storage.
*
* @param urlString Url as string to create fileName.
* @param bytes Bytes to save.
* @throws IOException if not able to open file.
*/
public void saveFile(String urlString, byte[] bytes) throws IOException {
FileOutputStream outputStream;
String fileName = getFileName(urlString);
outputStream = mContext.openFileOutput(fileName, Context.MODE_PRIVATE);
outputStream.write(bytes);
outputStream.close();
}
/**
* Deletes file with urlString.
*
* @param urlString Url as string to create fileName.
* @return True if deleted.
* @throws IOException if not able to open file.
*/
public boolean deleteFile(String urlString) throws IOException {
File file = getFile(urlString);
boolean deleted = file.delete();
return deleted;
}
/**
* Returns file from internal storage.
*
* @param urlString Url as string to create fileName.
* @return Saved file.
* @throws IOException if not able to open file.
*/
public File getFile(String urlString) throws IOException {
File file = new File(mContext.getFilesDir(), getFileName(urlString));
return file;
}
/**
* Returns fileName of saved file on internal storage.
*
* @param urlString Url as string to create fileName.
* @return fileName of saved file.
*/
public String getFileName(String urlString) {
if (urlString == null) {
return null;
}
String urlStringWithoutCaching = FileManager.removeQuery(urlString);
Uri url = Uri.parse(urlStringWithoutCaching);
String fileName = url.getLastPathSegment();
String[] fileNameSegments = fileName.split("\\.");
String extension = "";
if (fileNameSegments != null && fileNameSegments.length > 1) {
extension = fileNameSegments[1];
}
String newFileName = String.format("%s.%s", md5(urlStringWithoutCaching), extension);
return newFileName;
}
/**
* Returns filePath of saved file on internal storage.
*
* @param urlString Url as string to create fileName.
* @return filePath as String.
*/
public String getFilePath(String urlString) {
if (urlString == null) {
return null;
}
return String.format("%s/%s", mContext.getFilesDir().getAbsolutePath(), getFileName(urlString));
}
/**
* Remove query from url.
*
* @param urlString Url of file as string.
* @return Url without query parameters.
*/
public static String removeQuery(String urlString) {
if (urlString == null) {
return null;
}
Uri url = Uri.parse(urlString);
return urlString.replace("?" + url.getQuery(), "");
}
private static String md5(String s) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
digest.update(s.getBytes(Charset.forName("US-ASCII")), 0, s.length());
byte[] magnitude = digest.digest();
BigInteger bi = new BigInteger(1, magnitude);
String hash = String.format("%0" + (magnitude.length << 1) + "x", bi);
return hash;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
// getter & setter
public void setContext(Context context) {
mContext = context;
}
}
| [
"raphael@xamoom.com"
] | raphael@xamoom.com |
f951951d82f30bffcaf4fba0fa881214729bb0a3 | 680a40583d23e05a3da47028e9832653895f29d7 | /src/modelo/constantes/Consulta.java | c27fef39da782499a310ad1170475f8ead7db8c8 | [] | no_license | felipeescallon/gym_calendar_java | 9a86b713638173033ec37719e6b08c26d59ea1ed | 21b936a10a4a9a5d0e11e96b61331eb1caedb097 | refs/heads/main | 2023-07-09T21:49:18.118172 | 2021-08-09T00:03:52 | 2021-08-09T00:03:52 | 394,311,113 | 1 | 0 | null | 2021-08-09T13:56:39 | 2021-08-09T13:56:38 | null | UTF-8 | Java | false | false | 2,153 | 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 modelo.constantes;
import modelo.Fecha;
import modelo.Usuario;
/**
*
* @author xaca
*/
public class Consulta {
public static final int ANUALIDAD = 2021;
public static final String TODOS_LOS_USUARIOS = "select * from usuarios;";
public static final String TODAS_LAS_HORAS = "select * from horario;";
public static String crearInsertUsuario(Usuario usuario){
StringBuilder sql = new StringBuilder();
sql.append("INSERT INTO `usuarios` (`id`,`usuario`, `nombre`, `apellido`, `direccion`, `telefono`, `correo`) VALUES");
sql.append("(NULL,'"+usuario.getUsuario()+"' , '"+usuario.getNombre()+"', '"+usuario.getApellido()+"', '"+usuario.getDireccion()+"', '"+usuario.getTelefono()+"', '"+usuario.getCorreo()+"');");
return sql.toString();
}
public static String crearInsertClave(Usuario usuario){
StringBuilder sql = new StringBuilder();
sql.append("INSERT INTO `claves` (`id`, `id_usuario`, `clave`) VALUES ");
sql.append("(NULL, '"+usuario.getId()+"', '"+usuario.getClave()+"');");
return sql.toString();
}
public static String crearValidacionClave(Usuario usuario){
StringBuilder sql = new StringBuilder();
sql.append("SELECT * FROM `usuarios` as usuarios,`claves` as claves WHERE usuario ='");
sql.append(usuario.getUsuario()+"' and clave='");
sql.append(usuario.getClave()+"' and usuarios.id = claves.id_usuario;");
return sql.toString();
}
public static String traerReservas(int id_hora,Fecha fecha){
//SELECT * FROM `reservas` WHERE id_hora = 1 and dia = '2021-09-08';
StringBuilder sql = new StringBuilder();
sql.append("SELECT * FROM `reservas`,`usuarios` WHERE");
sql.append(" id_hora = "+id_hora);
sql.append(" and dia = '"+fecha.getFecha()+"'");
sql.append(" and reservas.id_usuario = usuarios.id;");
return sql.toString();
}
}
| [
"andres.bedoya@upb.edu.co"
] | andres.bedoya@upb.edu.co |
b6db94071140e65579e7438f9159745f9c87c2ae | aa16fbdb35227576bdc3e177c578d001c19428a5 | /src/main/java/org/durcframework/autocode/entity/BackUserSch.java | d68d9bce68d1cdd5e49e6404d179439b39b1bb38 | [] | no_license | AndyYHL/autoCode | ee11a7e84cfae3962d880f754367de9b812acaba | a3c21de042aa5687e69e4fa8364b93e8c9c42ba7 | refs/heads/master | 2023-04-27T08:02:13.693929 | 2023-04-20T02:26:48 | 2023-04-20T02:26:48 | 124,502,502 | 3 | 0 | null | 2022-06-20T23:01:57 | 2018-03-09T07:12:24 | JavaScript | UTF-8 | Java | false | false | 1,033 | java | package org.durcframework.autocode.entity;
import java.util.Date;
import org.durcframework.core.SearchEntity;
import org.durcframework.core.expression.annotation.LikeDoubleField;
import org.durcframework.core.expression.annotation.ValueField;
public class BackUserSch extends SearchEntity{
private String usernameSch;
private String passwordSch;
private Date addTimeSch;
public void setUsernameSch(String usernameSch){
this.usernameSch = usernameSch;
}
@LikeDoubleField(column = "username")
public String getUsernameSch(){
return this.usernameSch;
}
public void setPasswordSch(String passwordSch){
this.passwordSch = passwordSch;
}
@ValueField(column = "password")
public String getPasswordSch(){
return this.passwordSch;
}
public void setAddTimeSch(Date addTimeSch){
this.addTimeSch = addTimeSch;
}
@ValueField(column = "add_time")
public Date getAddTimeSch(){
return this.addTimeSch;
}
} | [
"love90yhl@hotmail.com"
] | love90yhl@hotmail.com |
25e5a457e561bd5f7ffcfdb26d8d5ab169b3b812 | 784310fcd0935a90ffc55cbf7458ac0cbbb857fd | /src/main/java/com/tledu/cn/service/UserService.java | 157fbb4faa7cdf7054b2e482e433f8f12a234084 | [] | no_license | cjh1202/SSMTest | fe05288bb3c6ca369d7b4293bef983b08487bb25 | 275997615fdcb1b25bf372440c69b3f29430730a | refs/heads/master | 2023-02-23T11:21:21.294937 | 2021-01-19T09:32:13 | 2021-01-19T09:32:13 | 330,910,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.tledu.cn.service;
import com.tledu.cn.pojo.User;
import java.util.List;
public interface UserService {
List<User> queryAll();
int insertUser(User user);
}
| [
"1395501780@qq.com"
] | 1395501780@qq.com |
459f59118a1038041ddfb9d3de404111eaed4328 | ffcbd3d2d7e23bc6a811fc8f29ed65d882453c2c | /han-core/src/main/java/org/hanframework/env/annotation/Profile.java | 419d666c906f2eec50b46655a33b9a70369d2f95 | [
"Apache-2.0",
"ICU"
] | permissive | hanframework/han | 59c78e8227638b4c82eb1202d68937d70109b78b | 4043e5a450ddc6923233ee5326436bcdf5b947a3 | refs/heads/master | 2022-12-22T21:37:04.635758 | 2019-10-14T08:59:36 | 2019-10-14T08:59:36 | 185,520,022 | 0 | 1 | Apache-2.0 | 2022-12-14T20:30:16 | 2019-05-08T03:19:23 | Java | UTF-8 | Java | false | false | 689 | java | package org.hanframework.env.annotation;
import java.lang.annotation.*;
/**
* 在一个应用中可能有多套配置环境。
* 当我们在一个组件中使用@Value注解时候,默认会从已经激活的配置文件中来读取,
* 但是也可以通过@Profile来指定。
*
* @author liuxin
* @version Id: Profile.java, v 0.1 2018-12-13 16:08
* @see Value
*/
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Profile {
/**
* 激活的配置文件名
*
* @return 读取配置的文件名
*/
String[] value() default "default";
}
| [
"lxchinesszz@163.com"
] | lxchinesszz@163.com |
3764ecf7b9f2ee39af7345dec4de45bcfd40b526 | b0c92e330c5be342c749f72e0d3415ba3b6984f3 | /src/cn/itcast/shop/cart/vo/Cart.java | dcb4ec9b3ec0dac3359336915857221c639ea0ad | [] | no_license | chd9/shop | 88c75343e3a68317f95e689f652e6345a90bc85f | 8e6cd8e8edde695dcd0bf6069956a8e136960648 | refs/heads/master | 2022-07-29T07:12:03.579797 | 2020-05-12T17:26:49 | 2020-05-12T17:26:49 | 263,394,083 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package cn.itcast.shop.cart.vo;
import java.io.Serializable;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 购物车对象
*
* @author donnie99
*
*/
public class Cart implements Serializable{
// 购物车属性
// 购物项集合:Map的key就是商品pid,value:购物项
private Map<Integer, CartItem> map = new LinkedHashMap<Integer, CartItem>();
// Cart对象中有一个叫cartItems属性.
public Collection<CartItem> getCartItems(){
return map.values();
}
// 购物总计:
private double total;
public double getTotal() {
return total;
}
// 购物车的功能:
// 1.将购物项添加到购物车
public void addCart(CartItem cartItem) {
// 判断购物车中是否已经存在该购物项:
/*
* * 如果存在:
* * 数量增加
* * 总计 = 总计 + 购物项小计
* * 如果不存在:
* * 向map中添加购物项
* * 总计 = 总计 + 购物项小计
*/
// 获得商品id.
Integer pid = cartItem.getProduct().getPid();
// 判断购物车中是否已经存在该购物项:
if(map.containsKey(pid)){
// 存在
CartItem _cartItem = map.get(pid);// 获得购物车中原来的购物项
_cartItem.setCount(_cartItem.getCount()+cartItem.getCount());
}else{
// 不存在
map.put(pid, cartItem);
}
// 设置总计的值
total += cartItem.getSubtotal();
}
// 2.从购物车移除购物项
public void removeCart(Integer pid) {
// 将购物项移除购物车:
CartItem cartItem = map.remove(pid);
// 总计 = 总计 -移除的购物项小计:
total -= cartItem.getSubtotal();
}
// 3.清空购物车
public void clearCart() {
// 将所有购物项清空
map.clear();
// 将总计设置为0
total = 0;
}
}
| [
"164606358@qq.com"
] | 164606358@qq.com |
95eb21f1753379d00ee6ef9deaa31c194fba1270 | b137ef81bb7f355aed2256c07d1b4ab2397269de | /src/main/java/tb/common/itemblock/ItemBlockTBLeaves.java | b91d0ce6d3ab39690493ce4e5c7d64e7bd4ff71e | [
"CC0-1.0",
"CC-BY-SA-4.0"
] | permissive | Kiwi233/ThaumicBases | 2f649febfc4a73b12e8df8d5607c47ba05505859 | 654342af75f4240c11180e1f1f0cd7dd5e1a7985 | refs/heads/master | 2023-06-30T22:28:26.439587 | 2021-08-02T12:32:22 | 2021-08-02T12:32:22 | 266,516,248 | 0 | 0 | CC0-1.0 | 2020-05-24T10:18:26 | 2020-05-24T10:18:25 | null | UTF-8 | Java | false | false | 556 | java | package tb.common.itemblock;
import tb.common.block.BlockTBLeaves;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemBlockTBLeaves extends ItemBlock{
public ItemBlockTBLeaves(Block b) {
super(b);
this.setHasSubtypes(true);
}
public String getUnlocalizedName(ItemStack stk)
{
return "tile."+BlockTBLeaves.names[Math.min(BlockTBLeaves.names.length-1,stk.getItemDamage()%8)];
}
public int getMetadata(int meta)
{
return meta;
}
}
| [
"Modbder@gmail.com"
] | Modbder@gmail.com |
206e22a0a8b2721aa0a4971e3099a43bdc67f61b | 58c59293960286e45c374ac4fa67b74edcb7d800 | /src/main/java/org/generallib/pluginbase/manager/ElementCachingManager.java | 1ccee287b0618c1f50d50c87d9328f48014f5b3a | [
"Apache-2.0"
] | permissive | wysohn/GeneralLib | f1fa27b08c920028160afb5e7efe2bbc113ee5a0 | 120c0e507f607b157e98b21e96a1b734168116e8 | refs/heads/master | 2020-02-26T14:33:41.380147 | 2018-04-21T21:52:55 | 2018-04-21T21:52:55 | 106,978,837 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 14,010 | java | package org.generallib.pluginbase.manager;
import java.io.File;
import java.lang.reflect.Type;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.generallib.database.Database;
import org.generallib.database.file.DatabaseFile;
import org.generallib.database.mysql.DatabaseMysql;
import org.generallib.database.tasks.DatabaseTransferTask.TransferPair;
import org.generallib.pluginbase.PluginBase;
import org.generallib.pluginbase.PluginManager;
public abstract class ElementCachingManager<K, V extends ElementCachingManager.NamedElement>
extends PluginManager<PluginBase> {
/*
* Lock ordering should be cachedElements -> db if it has to be nested.
*/
private final ExecutorService saveTaskPool = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setPriority(Thread.MIN_PRIORITY);
return thread;
}
});
private final Map<K, V> cachedElements = new HashMap<>();
private final Map<String, K> nameMap = new HashMap<>();
private Database<V> db;
private CacheUpdateThread cacheUpdateThread;
private boolean dbWriting = false;
public ElementCachingManager(PluginBase base, int loadPriority) {
super(base, loadPriority);
}
@Override
protected void onDisable() throws Exception {
cacheUpdateThread.interrupt();
saveTaskPool.shutdown();
base.getLogger().info("Waiting for the save tasks to be done...");
saveTaskPool.awaitTermination(10, TimeUnit.SECONDS);
base.getLogger().info("Done!");
}
@Override
protected void onEnable() throws Exception {
try {
if (base.getPluginConfig().MySql_Enabled) {
db = createMysqlDB();
}
} catch (Exception e) {
base.getLogger().warning(e.getMessage());
base.getLogger().warning("Failed to initialize Mysql. file database. -- " + getClass().getSimpleName());
} finally {
if (db == null) {
db = createFileDB();
}
}
onReload();
cacheUpdateThread = new CacheUpdateThread();
cacheUpdateThread.start();
}
@Override
protected void onReload() throws Exception {
synchronized (cachedElements) {
cachedElements.clear();
}
updateCache();
}
public void setCacheUpdaterStatus(boolean status) {
synchronized(this.cacheUpdateThread) {
this.cacheUpdateThread.enabled = status;
if(status) {
this.cacheUpdateThread.notifyAll();
}
}
}
public boolean getCacheUpdaterStatus() {
return this.cacheUpdateThread.enabled;
}
public DatabaseFile<V> createFileDB() {
return new DatabaseFile<V>(new File(base.getDataFolder(), getTableName()), getType());
}
public DatabaseMysql<V> createMysqlDB()
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
return new DatabaseMysql<V>(base.getPluginConfig().MySql_DBAddress, base.getPluginConfig().MySql_DBName,
getTableName(), base.getPluginConfig().MySql_DBUser, base.getPluginConfig().MySql_DBPassword,
getType());
}
/**
*
* @return Name of the table to save the data.
*/
protected abstract String getTableName();
/**
*
* @return The data type to be used when serializing/deserializing the data.
*/
protected abstract Type getType();
/**
* Generate key from the given String.
*
* @param str
* the deserializable String value.
* @return deserialized object.
*/
protected abstract K createKeyFromString(String str);
/**
* Get update gamehandle to be used caching the data.
*
* @return
*/
protected abstract CacheUpdateHandle<K, V> getUpdateHandle();
/**
* Get delete gamehandle to be used removing data from cache.
*
* @return
*/
protected abstract CacheDeleteHandle<K, V> getDeleteHandle();
public TransferPair<V> getTransferPair(Database<V> from) {
return new TransferPair<V>(from, db);
}
private void updateCache() {
Set<String> strKeys = db.getKeys();
Set<K> keys = new HashSet<>();
Set<K> remove = new HashSet<>();
synchronized (cachedElements) {
for (K key : cachedElements.keySet()) {
if (!strKeys.contains(key.toString()))
remove.add(key);
}
for (String strKey : strKeys) {
K key = null;
try {
key = createKeyFromString(strKey);
} catch (Exception e) {
base.getLogger().warning("Removing invalid item with wrong key.");
base.getLogger().warning("Key [" + strKey + "] is not an UUID.");
base.getLogger().warning("In " + getClass().getSimpleName());
} finally {
if (key != null)
keys.add(key);
}
}
for (K key : remove) {
V before = cachedElements.remove(key);
if (before != null && before.getName() != null)
nameMap.remove(before.getName());
}
}
for (K key : keys) {
updateCache(key);
}
}
private void updateCache(K key) {
V newVal;
synchronized (db) {
newVal = db.load(key.toString(), null);
}
cache(key, newVal);
}
protected void cache(K key, V newVal) {
cache(key, newVal, getUpdateHandle(), getDeleteHandle());
}
protected void cache(K key, V newVal, CacheUpdateHandle<K, V> updateHndle, CacheDeleteHandle<K, V> deleteHandle) {
synchronized (cachedElements) {
if (newVal == null) {
V original = cachedElements.remove(key);
if (deleteHandle != null) {
deleteHandle.onDelete(key, original);
}
if (original != null && original.getName() != null)
nameMap.remove(original.getName());
} else {
if (updateHndle != null) {
V out = updateHndle.onUpdate(key, newVal);
if (out != null)
newVal = out;
}
V original = cachedElements.put(key, newVal);
if (newVal.getName() != null)
nameMap.put(newVal.getName(), key);
if (original != null && original.getName() != null && !original.getName().equals(newVal.getName()))
nameMap.remove(original.getName());
}
}
}
public V get(K key) {
return get(key, false);
}
public V get(String name) {
return get(name, false);
}
/**
*
* @param key
* @param lock
* whether to wait for previous database operations or just use
* cache right away
* @return
*/
protected V get(K key, boolean lock) {
synchronized (cachedElements) {
if (lock) {
synchronized (db) {
return cachedElements.get(key);
}
} else {
return cachedElements.get(key);
}
}
}
/**
*
* @param name
* @param lock
* whether to wait for previous database operations or just use
* cache right away
* @return
*/
protected V get(String name, boolean lock) {
synchronized (cachedElements) {
if (lock) {
synchronized (db) {
K key = nameMap.get(name);
if (key == null)
return null;
else
return cachedElements.get(key);
}
} else {
K key = nameMap.get(name);
if (key == null)
return null;
else
return cachedElements.get(key);
}
}
}
/**
* Get copy of keys. This only represent snapshot of keys at the moment when this method is invoked.
* @return snapshot of key set.
*/
protected Set<K> getAllKeys() {
synchronized (cachedElements) {
Set<K> newSet = new HashSet<>();
newSet.addAll(cachedElements.keySet());
return newSet;
}
}
/**
* Lock thread until previous database works are done
*
* @param key
*/
public void check() {
synchronized (db) {
}
}
protected void save(K key, V value) {
save(key, value, null);
}
protected void save(final K key, final V value, final SaveHandle handle) {
dbWriting = true;
if (handle != null) {
try {
handle.preSave();
} catch (Exception e) {
e.printStackTrace();
}
}
cache(key, value);
saveTaskPool.submit(new Runnable() {
@Override
public void run() {
synchronized (db) {
try {
db.save(key.toString(), value);
if (handle != null) {
handle.postSave();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
dbWriting = false;
}
}
}
});
}
protected void delete(final K key) {
dbWriting = true;
synchronized (cachedElements) {
V original = cachedElements.get(key);
if (original != null && original.getName() != null)
nameMap.remove(original.getName());
}
saveTaskPool.submit(new Runnable() {
@Override
public void run() {
synchronized (db) {
try {
db.save(key.toString(), null);
} catch (Exception e) {
e.printStackTrace();
} finally {
dbWriting = false;
}
}
}
});
}
protected void deleteNameKey(String key) {
nameMap.remove(key);
}
public K getKey(String name) {
return nameMap.get(name);
}
private class CacheUpdateThread extends Thread {
boolean enabled = false;
CacheUpdateThread() {
this.setPriority(MIN_PRIORITY);
this.setName("CacheUpdateThread");
this.setDaemon(true);
}
@Override
public void run() {
while (!Thread.interrupted() && base.isEnabled()) {
while(!enabled) {
try {
synchronized (this) {
wait();
}
} catch (InterruptedException e1) {
}
}
try {
if (!dbWriting)
updateCache();
} catch (Exception e) {
e.printStackTrace();
base.getLogger().severe("CacheUpdateThread had to be stopped!");
base.getLogger().severe("Data will be out of sync if you have another server using the plugin!");
base.getLogger().severe("It's better to restart the server before any data corruption happens.");
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
}
}
}
}
public interface NamedElement {
String getName();
}
public interface SaveHandle {
/**
* This method will be invoked before saving the value. It's not
* asynchronous.
*/
void preSave();
/**
* This method will be invoked after saving the value. It's
* asynchronous.
*/
void postSave();
}
public interface CacheUpdateHandle<K, T extends NamedElement> {
/**
* This method will be invoked every-time when a new information read
* from database will be cached. This is good place to initialize
* transient field values.
*
* @param key
* key used when load value from database
* @param original
* original value. This can be null if the data was deleted
* from the database.
* @return changed value. Return null will preserve the 'original' to be
* used as cache.
*/
T onUpdate(K key, T original);
}
public interface CacheDeleteHandle<K, T extends NamedElement> {
void onDelete(K key, T deleted);
}
}
| [
"wysohn2002@naver.com"
] | wysohn2002@naver.com |
c5bd88961d1344b868dee5b37c7e6772fb641303 | dc19ab7807ddd43a7f7017ef049aa6117abad258 | /src/main/java/com/orionletizi/csv/App.java | dd9ec0167a914d375bc3518bfb5d1ee94f4a569d | [] | no_license | oletizi/csvcut | 02afc466b2c041608153612e6c0c1ef515846dad | 163738dacbe4611b11906611df354037d341acf2 | refs/heads/master | 2016-09-05T14:46:58.477973 | 2015-04-13T00:46:19 | 2015-04-13T00:46:19 | 33,838,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,177 | java | package com.orionletizi.csv;
import java.io.File;
import java.io.IOException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
/**
* csvcut -- Cut columns from a CSV file. Prints modified contents to STDOUT
*
*/
public class App {
public static void main(String[] args) {
final CommandLineParser parser = new GnuParser();
Options options = new Options();
options.addOption("q", "choose", false, "Engage UI for choosing columns to cut. Implies --outfile");
options.addOption("o", "outfile", true, "Where to write the chosen columns. Implies --choose.");
options.addOption("c", "columns", true, "Comma-separated list of column indices to cut.");
final CommandLine line;
try {
line = parser.parse(options, args);
// Check for the input file
final String[] remaining = line.getArgs();
if (remaining.length < 1) {
printHelp(options, "Please specify an input file.");
System.exit(0);
}
// If it doesn't exist, barf.
File infile = new File(remaining[0]);
if (! infile.exists()) {
printHelp(options, "Can't find input file: " + infile.getPath());
System.exit(0);
}
if (line.hasOption("choose")) {
// Initiate the "choose" UI
if (!line.hasOption("outfile")) {
printHelp(options, "Please specify an output file.");
System.exit(0);
}
// TODO: Implement me!
throw new RuntimeException("Implement Me! -- implement the choose UI");
} else {
// validate the --columns option
if (!line.hasOption("columns")) {
printHelp(options, "Please specify the columns to cut.");
System.exit(0);
}
String columnsOpt = line.getOptionValue("columns");
String[] columnsArray = columnsOpt.split(",");
if (columnsArray == null || columnsArray.length == 0) {
printHelp(options, "Invalid columns option: " + columnsOpt);
System.exit(0);
}
// parse the --columns option
Integer[] columns = new Integer[columnsArray.length];
for (int i=0; i<columnsArray.length; i++) {
try {
columns[i] = Integer.parseInt(columnsArray[i]);
} catch (NumberFormatException e) {
printHelp(options, "Invalid number format for columns option: " + columnsOpt);
System.exit(0);
}
}
try {
new ColumnCutter(infile, System.out, columns).run();
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
}
} catch (ParseException e) {
printHelp(options, e.getLocalizedMessage());
}
}
private static void printHelp(final Options options, String message) {
System.out.println(message + "\n");
new HelpFormatter().printHelp("java -jar csvcut.jar <options> /path/to/input/file", options);
}
}
| [
"oletizi@mac.com"
] | oletizi@mac.com |
ab4adbb669d27d350c85448033b5066b0c824fd3 | 60d3926c5a791c2224cee706f7638a68374f3eaf | /src/main/java/com/grain/utils/baidu/ueditor/Encoder.java | 4c6595453eae21c739428b1065ef8e90a7902d2c | [] | no_license | yuwangtian/grain | 18fad2ecf163067e3c050b1c2bcdf98f7fac9063 | 01ea4bee4f4f40f0b14858715a3003928309516e | refs/heads/master | 2021-01-20T09:22:01.675797 | 2017-12-12T08:58:15 | 2017-12-12T08:58:15 | 101,592,004 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.grain.utils.baidu.ueditor;
public class Encoder {
public static String toUnicode(String input) {
StringBuilder builder = new StringBuilder();
char[] chars = input.toCharArray();
for (char ch : chars) {
if (ch < 256) {
builder.append(ch);
} else {
builder.append("\\u" + Integer.toHexString(ch & 0xffff));
}
}
return builder.toString();
}
} | [
"yuwangtian@aliyun.com"
] | yuwangtian@aliyun.com |
9109ba2faf4ffdf4b65e1008bc0b60783f1fb22f | 1fd2824e167de51ebe223405284a40ff145eae58 | /src/main/java/org/docksidestage/db2/dbflute/cbean/cq/bs/BsMemberWithdrawalCQ.java | 36db503f38ce997ff2bc58916884e695157f0bca | [
"Apache-2.0"
] | permissive | dbflute-test/dbflute-test-dbms-db2 | 37bd9c6afddf8c35224089e080e699acbbf567b9 | d5fe9fe00f36b6584121a1ab8ac772ea570d5a65 | refs/heads/master | 2022-07-04T08:55:30.267335 | 2022-05-15T09:56:52 | 2022-05-15T09:56:52 | 26,101,682 | 0 | 0 | null | 2015-09-08T06:15:07 | 2014-11-03T03:05:25 | Java | UTF-8 | Java | false | false | 19,041 | java | package org.docksidestage.db2.dbflute.cbean.cq.bs;
import java.util.Map;
import org.dbflute.cbean.*;
import org.dbflute.cbean.chelper.*;
import org.dbflute.cbean.coption.*;
import org.dbflute.cbean.cvalue.ConditionValue;
import org.dbflute.cbean.sqlclause.SqlClause;
import org.dbflute.exception.IllegalConditionBeanOperationException;
import org.docksidestage.db2.dbflute.cbean.cq.ciq.*;
import org.docksidestage.db2.dbflute.cbean.*;
import org.docksidestage.db2.dbflute.cbean.cq.*;
/**
* The base condition-query of MEMBER_WITHDRAWAL.
* @author DBFlute(AutoGenerator)
*/
public class BsMemberWithdrawalCQ extends AbstractBsMemberWithdrawalCQ {
// ===================================================================================
// Attribute
// =========
protected MemberWithdrawalCIQ _inlineQuery;
// ===================================================================================
// Constructor
// ===========
public BsMemberWithdrawalCQ(ConditionQuery referrerQuery, SqlClause sqlClause, String aliasName, int nestLevel) {
super(referrerQuery, sqlClause, aliasName, nestLevel);
}
// ===================================================================================
// InlineView/OrClause
// ===================
/**
* Prepare InlineView query. <br>
* {select ... from ... left outer join (select * from MEMBER_WITHDRAWAL) where FOO = [value] ...}
* <pre>
* cb.query().queryMemberStatus().<span style="color: #CC4747">inline()</span>.setFoo...;
* </pre>
* @return The condition-query for InlineView query. (NotNull)
*/
public MemberWithdrawalCIQ inline() {
if (_inlineQuery == null) { _inlineQuery = xcreateCIQ(); }
_inlineQuery.xsetOnClause(false); return _inlineQuery;
}
protected MemberWithdrawalCIQ xcreateCIQ() {
MemberWithdrawalCIQ ciq = xnewCIQ();
ciq.xsetBaseCB(_baseCB);
return ciq;
}
protected MemberWithdrawalCIQ xnewCIQ() {
return new MemberWithdrawalCIQ(xgetReferrerQuery(), xgetSqlClause(), xgetAliasName(), xgetNestLevel(), this);
}
/**
* Prepare OnClause query. <br>
* {select ... from ... left outer join MEMBER_WITHDRAWAL on ... and FOO = [value] ...}
* <pre>
* cb.query().queryMemberStatus().<span style="color: #CC4747">on()</span>.setFoo...;
* </pre>
* @return The condition-query for OnClause query. (NotNull)
* @throws IllegalConditionBeanOperationException When this condition-query is base query.
*/
public MemberWithdrawalCIQ on() {
if (isBaseQuery()) { throw new IllegalConditionBeanOperationException("OnClause for local table is unavailable!"); }
MemberWithdrawalCIQ inlineQuery = inline(); inlineQuery.xsetOnClause(true); return inlineQuery;
}
// ===================================================================================
// Query
// =====
protected ConditionValue _memberId;
public ConditionValue xdfgetMemberId()
{ if (_memberId == null) { _memberId = nCV(); }
return _memberId; }
protected ConditionValue xgetCValueMemberId() { return xdfgetMemberId(); }
/**
* Add order-by as ascend. <br>
* MEMBER_ID: {PK, NotNull, INTEGER(10), FK to MEMBER}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_MemberId_Asc() { regOBA("MEMBER_ID"); return this; }
/**
* Add order-by as descend. <br>
* MEMBER_ID: {PK, NotNull, INTEGER(10), FK to MEMBER}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_MemberId_Desc() { regOBD("MEMBER_ID"); return this; }
protected ConditionValue _withdrawalReasonCode;
public ConditionValue xdfgetWithdrawalReasonCode()
{ if (_withdrawalReasonCode == null) { _withdrawalReasonCode = nCV(); }
return _withdrawalReasonCode; }
protected ConditionValue xgetCValueWithdrawalReasonCode() { return xdfgetWithdrawalReasonCode(); }
/**
* Add order-by as ascend. <br>
* (退会理由コード)WITHDRAWAL_REASON_CODE: {CHAR(3), FK to WITHDRAWAL_REASON}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalReasonCode_Asc() { regOBA("WITHDRAWAL_REASON_CODE"); return this; }
/**
* Add order-by as descend. <br>
* (退会理由コード)WITHDRAWAL_REASON_CODE: {CHAR(3), FK to WITHDRAWAL_REASON}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalReasonCode_Desc() { regOBD("WITHDRAWAL_REASON_CODE"); return this; }
protected ConditionValue _withdrawalReasonInputText;
public ConditionValue xdfgetWithdrawalReasonInputText()
{ if (_withdrawalReasonInputText == null) { _withdrawalReasonInputText = nCV(); }
return _withdrawalReasonInputText; }
protected ConditionValue xgetCValueWithdrawalReasonInputText() { return xdfgetWithdrawalReasonInputText(); }
/**
* Add order-by as ascend. <br>
* (退会理由入力テキスト)WITHDRAWAL_REASON_INPUT_TEXT: {CLOB(1048576)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalReasonInputText_Asc() { regOBA("WITHDRAWAL_REASON_INPUT_TEXT"); return this; }
/**
* Add order-by as descend. <br>
* (退会理由入力テキスト)WITHDRAWAL_REASON_INPUT_TEXT: {CLOB(1048576)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalReasonInputText_Desc() { regOBD("WITHDRAWAL_REASON_INPUT_TEXT"); return this; }
protected ConditionValue _withdrawalDatetime;
public ConditionValue xdfgetWithdrawalDatetime()
{ if (_withdrawalDatetime == null) { _withdrawalDatetime = nCV(); }
return _withdrawalDatetime; }
protected ConditionValue xgetCValueWithdrawalDatetime() { return xdfgetWithdrawalDatetime(); }
/**
* Add order-by as ascend. <br>
* (退会日時)WITHDRAWAL_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalDatetime_Asc() { regOBA("WITHDRAWAL_DATETIME"); return this; }
/**
* Add order-by as descend. <br>
* (退会日時)WITHDRAWAL_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_WithdrawalDatetime_Desc() { regOBD("WITHDRAWAL_DATETIME"); return this; }
protected ConditionValue _registerDatetime;
public ConditionValue xdfgetRegisterDatetime()
{ if (_registerDatetime == null) { _registerDatetime = nCV(); }
return _registerDatetime; }
protected ConditionValue xgetCValueRegisterDatetime() { return xdfgetRegisterDatetime(); }
/**
* Add order-by as ascend. <br>
* REGISTER_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_RegisterDatetime_Asc() { regOBA("REGISTER_DATETIME"); return this; }
/**
* Add order-by as descend. <br>
* REGISTER_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_RegisterDatetime_Desc() { regOBD("REGISTER_DATETIME"); return this; }
protected ConditionValue _registerUser;
public ConditionValue xdfgetRegisterUser()
{ if (_registerUser == null) { _registerUser = nCV(); }
return _registerUser; }
protected ConditionValue xgetCValueRegisterUser() { return xdfgetRegisterUser(); }
/**
* Add order-by as ascend. <br>
* REGISTER_USER: {NotNull, VARCHAR(200)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_RegisterUser_Asc() { regOBA("REGISTER_USER"); return this; }
/**
* Add order-by as descend. <br>
* REGISTER_USER: {NotNull, VARCHAR(200)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_RegisterUser_Desc() { regOBD("REGISTER_USER"); return this; }
protected ConditionValue _updateDatetime;
public ConditionValue xdfgetUpdateDatetime()
{ if (_updateDatetime == null) { _updateDatetime = nCV(); }
return _updateDatetime; }
protected ConditionValue xgetCValueUpdateDatetime() { return xdfgetUpdateDatetime(); }
/**
* Add order-by as ascend. <br>
* UPDATE_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_UpdateDatetime_Asc() { regOBA("UPDATE_DATETIME"); return this; }
/**
* Add order-by as descend. <br>
* UPDATE_DATETIME: {NotNull, TIMESTAMP(26, 6)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_UpdateDatetime_Desc() { regOBD("UPDATE_DATETIME"); return this; }
protected ConditionValue _updateUser;
public ConditionValue xdfgetUpdateUser()
{ if (_updateUser == null) { _updateUser = nCV(); }
return _updateUser; }
protected ConditionValue xgetCValueUpdateUser() { return xdfgetUpdateUser(); }
/**
* Add order-by as ascend. <br>
* UPDATE_USER: {NotNull, VARCHAR(200)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_UpdateUser_Asc() { regOBA("UPDATE_USER"); return this; }
/**
* Add order-by as descend. <br>
* UPDATE_USER: {NotNull, VARCHAR(200)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_UpdateUser_Desc() { regOBD("UPDATE_USER"); return this; }
protected ConditionValue _versionNo;
public ConditionValue xdfgetVersionNo()
{ if (_versionNo == null) { _versionNo = nCV(); }
return _versionNo; }
protected ConditionValue xgetCValueVersionNo() { return xdfgetVersionNo(); }
/**
* Add order-by as ascend. <br>
* VERSION_NO: {NotNull, BIGINT(19)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_VersionNo_Asc() { regOBA("VERSION_NO"); return this; }
/**
* Add order-by as descend. <br>
* VERSION_NO: {NotNull, BIGINT(19)}
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addOrderBy_VersionNo_Desc() { regOBD("VERSION_NO"); return this; }
// ===================================================================================
// SpecifiedDerivedOrderBy
// =======================
/**
* Add order-by for specified derived column as ascend.
* <pre>
* cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchaseDatetime();
* }
* }, <span style="color: #CC4747">aliasName</span>);
* <span style="color: #3F7E5E">// order by [alias-name] asc</span>
* cb.<span style="color: #CC4747">addSpecifiedDerivedOrderBy_Asc</span>(<span style="color: #CC4747">aliasName</span>);
* </pre>
* @param aliasName The alias name specified at (Specify)DerivedReferrer. (NotNull)
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addSpecifiedDerivedOrderBy_Asc(String aliasName) { registerSpecifiedDerivedOrderBy_Asc(aliasName); return this; }
/**
* Add order-by for specified derived column as descend.
* <pre>
* cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchaseDatetime();
* }
* }, <span style="color: #CC4747">aliasName</span>);
* <span style="color: #3F7E5E">// order by [alias-name] desc</span>
* cb.<span style="color: #CC4747">addSpecifiedDerivedOrderBy_Desc</span>(<span style="color: #CC4747">aliasName</span>);
* </pre>
* @param aliasName The alias name specified at (Specify)DerivedReferrer. (NotNull)
* @return this. (NotNull)
*/
public BsMemberWithdrawalCQ addSpecifiedDerivedOrderBy_Desc(String aliasName) { registerSpecifiedDerivedOrderBy_Desc(aliasName); return this; }
// ===================================================================================
// Union Query
// ===========
public void reflectRelationOnUnionQuery(ConditionQuery bqs, ConditionQuery uqs) {
MemberWithdrawalCQ bq = (MemberWithdrawalCQ)bqs;
MemberWithdrawalCQ uq = (MemberWithdrawalCQ)uqs;
if (bq.hasConditionQueryMember()) {
uq.queryMember().reflectRelationOnUnionQuery(bq.queryMember(), uq.queryMember());
}
if (bq.hasConditionQueryWithdrawalReason()) {
uq.queryWithdrawalReason().reflectRelationOnUnionQuery(bq.queryWithdrawalReason(), uq.queryWithdrawalReason());
}
}
// ===================================================================================
// Foreign Query
// =============
/**
* Get the condition-query for relation table. <br>
* (会員)MEMBER by my MEMBER_ID, named 'member'.
* @return The instance of condition-query. (NotNull)
*/
public MemberCQ queryMember() {
return xdfgetConditionQueryMember();
}
public MemberCQ xdfgetConditionQueryMember() {
String prop = "member";
if (!xhasQueRlMap(prop)) { xregQueRl(prop, xcreateQueryMember()); xsetupOuterJoinMember(); }
return xgetQueRlMap(prop);
}
protected MemberCQ xcreateQueryMember() {
String nrp = xresolveNRP("MEMBER_WITHDRAWAL", "member"); String jan = xresolveJAN(nrp, xgetNNLvl());
return xinitRelCQ(new MemberCQ(this, xgetSqlClause(), jan, xgetNNLvl()), _baseCB, "member", nrp);
}
protected void xsetupOuterJoinMember() { xregOutJo("member"); }
public boolean hasConditionQueryMember() { return xhasQueRlMap("member"); }
/**
* Get the condition-query for relation table. <br>
* (退会理由)WITHDRAWAL_REASON by my WITHDRAWAL_REASON_CODE, named 'withdrawalReason'.
* @return The instance of condition-query. (NotNull)
*/
public WithdrawalReasonCQ queryWithdrawalReason() {
return xdfgetConditionQueryWithdrawalReason();
}
public WithdrawalReasonCQ xdfgetConditionQueryWithdrawalReason() {
String prop = "withdrawalReason";
if (!xhasQueRlMap(prop)) { xregQueRl(prop, xcreateQueryWithdrawalReason()); xsetupOuterJoinWithdrawalReason(); }
return xgetQueRlMap(prop);
}
protected WithdrawalReasonCQ xcreateQueryWithdrawalReason() {
String nrp = xresolveNRP("MEMBER_WITHDRAWAL", "withdrawalReason"); String jan = xresolveJAN(nrp, xgetNNLvl());
return xinitRelCQ(new WithdrawalReasonCQ(this, xgetSqlClause(), jan, xgetNNLvl()), _baseCB, "withdrawalReason", nrp);
}
protected void xsetupOuterJoinWithdrawalReason() { xregOutJo("withdrawalReason"); }
public boolean hasConditionQueryWithdrawalReason() { return xhasQueRlMap("withdrawalReason"); }
protected Map<String, Object> xfindFixedConditionDynamicParameterMap(String property) {
return null;
}
// ===================================================================================
// ScalarCondition
// ===============
public Map<String, MemberWithdrawalCQ> xdfgetScalarCondition() { return xgetSQueMap("scalarCondition"); }
public String keepScalarCondition(MemberWithdrawalCQ sq) { return xkeepSQue("scalarCondition", sq); }
// ===================================================================================
// MyselfDerived
// =============
public Map<String, MemberWithdrawalCQ> xdfgetSpecifyMyselfDerived() { return xgetSQueMap("specifyMyselfDerived"); }
public String keepSpecifyMyselfDerived(MemberWithdrawalCQ sq) { return xkeepSQue("specifyMyselfDerived", sq); }
public Map<String, MemberWithdrawalCQ> xdfgetQueryMyselfDerived() { return xgetSQueMap("queryMyselfDerived"); }
public String keepQueryMyselfDerived(MemberWithdrawalCQ sq) { return xkeepSQue("queryMyselfDerived", sq); }
public Map<String, Object> xdfgetQueryMyselfDerivedParameter() { return xgetSQuePmMap("queryMyselfDerived"); }
public String keepQueryMyselfDerivedParameter(Object pm) { return xkeepSQuePm("queryMyselfDerived", pm); }
// ===================================================================================
// MyselfExists
// ============
protected Map<String, MemberWithdrawalCQ> _myselfExistsMap;
public Map<String, MemberWithdrawalCQ> xdfgetMyselfExists() { return xgetSQueMap("myselfExists"); }
public String keepMyselfExists(MemberWithdrawalCQ sq) { return xkeepSQue("myselfExists", sq); }
// ===================================================================================
// MyselfInScope
// =============
public Map<String, MemberWithdrawalCQ> xdfgetMyselfInScope() { return xgetSQueMap("myselfInScope"); }
public String keepMyselfInScope(MemberWithdrawalCQ sq) { return xkeepSQue("myselfInScope", sq); }
// ===================================================================================
// Very Internal
// =============
// very internal (for suppressing warn about 'Not Use Import')
protected String xCB() { return MemberWithdrawalCB.class.getName(); }
protected String xCQ() { return MemberWithdrawalCQ.class.getName(); }
protected String xCHp() { return HpQDRFunction.class.getName(); }
protected String xCOp() { return ConditionOption.class.getName(); }
protected String xMap() { return Map.class.getName(); }
}
| [
"dbflute@gmail.com"
] | dbflute@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.