method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
40e6974b-e433-4117-bef1-4b0e800e5f91 | 0 | public void addToValue(double term) {
value += term;
} |
0db3ada3-a39d-403f-bcbc-9e5562b6b37f | 5 | @Override
void update() {
super.update();
angle = angle + ((2 * Math.PI) / ROTATION_SPEED);
if (!remove && Player.x + Player.SIZE > x && Player.x < x + SIZE && Player.y + Player.SIZE > y && Player.y < y + SIZE) {
explosionBuffer.add(new Explosion(x, y, SIZE));
explosi... |
ba2d6b3e-d2f4-440b-bb1b-19a03e7b53c6 | 8 | public void run() {
try {
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String client_input;
// Read input from client and execute on commands
... |
e86144db-1fa7-4ef6-a868-dc7208e2a85f | 8 | public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
// require an owner type if the raw type needs it
if (rawType instanceof Class<?>) {
Class<?> rawTypeAsClass = (Class<?>) rawType;
checkArgument(ownerType != null || rawTypeAsClass.getEnclosingClass() == null... |
dd7a182b-1e6d-40b4-a315-7d048caa57a1 | 8 | private void saveExperiment() {
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File expFile = m_FileChooser.getSelectedFile();
// add extension if necessary
if (m_FileChooser.getFileFilter() == m_ExpFilter) {
if (!e... |
4d7466d5-30f7-4262-82db-211bb4dc9de3 | 0 | @Autowired
public void setMongoTemplate(MongoTemplate mongoTemplate) {
this.mongoImageTemplate = mongoTemplate;
db = mongoTemplate.getDb();
} |
0d2d25cd-53b3-4e02-96f7-4c9d90aa8adb | 4 | public void writTwitterStreamToCSV(Status status) {
try {
bufferedWriter.write(status.getId()
+ "," + StringEscapeUtils.escapeCsv(status.getUser().getScreenName())
+ "," + StringEscapeUtils.escapeCsv(status.getText())
+ "," + StringEscape... |
78a27963-1823-4c5a-a0af-ba176de54bb8 | 5 | public static final void UseHiredMerchant(final SeekableLittleEndianAccessor slea, final MapleClient c) {
// slea.readInt(); // TimeStamp
if (c.getPlayer().getMap().allowPersonalShop()) {
final byte state = checkExistance(c.getAccID());
switch (state) {
case 1:
... |
b80499c2-421e-4eb2-aad8-737d80b4ef36 | 6 | private boolean checkALError()
{
switch( AL10.alGetError() )
{
case AL10.AL_NO_ERROR:
return false;
case AL10.AL_INVALID_NAME:
errorMessage( "Invalid name parameter." );
return true;
case AL10.AL_INVALID_ENUM:
... |
2af1073b-df6f-446e-bd15-333145f35331 | 9 | private void initEntries() {
if (entriesInited) {
return;
}
if (!zipFileIndex.readFromIndex) {
int from = -Arrays.binarySearch(zipFileIndex.entries,
new Entry(dirName, ZipFileIndex.MIN_CHAR)) - 1;
int to = -Arra... |
d44bd363-43cd-4108-b1cd-16e4dccac431 | 0 | public String getLibelle() {
return libelle;
} |
e47d77af-3510-4f1b-b155-a8308816ce84 | 1 | public static boolean isJava1_3_1() {
String javaVersion = System.getProperty("java.version");
if (javaVersion.startsWith("1.3.1")) {
return true;
} else {
return false;
}
} |
d49cadc4-4555-4862-aabc-616c6db92988 | 7 | private void setData(String[] data){
String option = null;
String inputValue = null;
long id;
try{
option = data[1].toLowerCase();
inputValue = data[2];
id = Long.parseLong(data[3]);
} catch(Exception e){
System.out.println("Invalid command! Try to input command once more!");
return;
}
swit... |
6c35785b-338c-4d24-b946-ccf349f76726 | 4 | public static void main(String[] args) {
A a = new A();
Class<A> clazz = A.class;
Method[] methods = clazz.getDeclaredMethods();
for(Method method : methods) {
method.setAccessible(true);
try {
method.invoke(a);
} catch(IllegalAccessExc... |
685e2368-e463-4fef-9920-ab857d79c1af | 5 | public ArrayList<ArrayList<String>> parseData(ArrayList<String> rawdata){
ArrayList<ArrayList<String>> bigdata = new ArrayList<ArrayList<String>>();
for(String line : rawdata){
ArrayList<String> smalldata = new ArrayList<String>();
String[] minidata = line.split("\\|");
for(int i = 0;i < minidata.length;i+... |
26b66b5e-a48e-43aa-83f9-5046e8b9a345 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
629edf23-3d6a-48d8-b599-63772edbcfda | 9 | public static ArrayList<Player> selectPlayersExact(String target) throws EssentialsCommandException {
ArrayList<Player> matchedPlayers = new ArrayList<Player>();
if(target.equals("*")) {
matchedPlayers = new ArrayList<Player>(Arrays.asList(Bukkit.getServer().getOnlinePlayers()));
}
else if(target.startsWith(... |
d893a34d-a7f9-482f-b908-bee513cb0d2f | 5 | public double[] std(double x[][]) {
if (x.length <= 1) {
return null;
}
int n = x[0].length;
double mean[] = new double[n];
double var[] = new double[n];
for (int i = 0; i < n; i++) {
mean[i] = 0;
for (int j = 0; j < x.length; j++) {
... |
34a29c07-738d-4333-b125-f757f375d091 | 1 | private void loadOnlinePlayers(MainClass mainClass) {
for(Player o : Bukkit.getOnlinePlayers()) {
FileUtil.checkPlayerDat(o);
PlayerUtil pu = new PlayerUtil(o);
pu.updateName();
}
} |
197d4dc7-61d5-4fbe-951d-703880041e64 | 4 | @Override
public void gridletSubmit(Gridlet gridlet, boolean ack) {
if(!gridlet.hasReserved()) {
super.gridletSubmit(gridlet, ack);
}
else {
if(!handleReservationJob(gridlet)) {
try {
gridlet.setGridletStatus(Gridlet.FAILED);
} catch (Exception e) {
// should not hap... |
911daea5-8075-4b9d-9c62-c280e7f0baa2 | 0 | public String getPersonId() {
return personId;
} |
88c2219f-bddc-4b62-91ca-37419fee5110 | 2 | private void setTitle(String title, boolean check){
if(!check){
this.title[0] = title;
this.nTitle++;
this.titleCheck = check;
}
else{
if(!this.titleCheck){
this.title[0] = title;
this.nTitle++;
this.... |
fa26c3e5-3348-4a53-905c-33566bd6a7a9 | 0 | public long getTemp() {
return sa.temps[sa.stable][indexI][indexJ];
} |
10019ce4-1650-421e-a606-0912d22fbfc8 | 1 | public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
} |
2e15fb90-0376-4eb5-af06-711b1cadbdbb | 8 | private static DistributionType resolvedtype(int s){
switch(s){
case 1: return DistributionType.BETA;
case 2: return DistributionType.NORMAL;
case 3: return DistributionType.CAUCHY;
case 4: return DistributionType.CHISQUARED;
... |
fd66298b-db3b-42ab-904f-a6a8018ce942 | 5 | public void consumirInsumo() throws IOException, SQLException{
boolean bandera = true;
do{
System.out.println("ingrese id del insumo a consumir:");
String insuId = bf.readLine();
Long insumoId = null;
try {
insumoId = new Long(insuId);
} catch (NumberFormatException exception) {
exception.pr... |
e8496534-f1e9-4128-b6de-b0db14389673 | 5 | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (debug) {
log("LoginFilter:doFilter()");
}
String contextPath = filterConfig.getServletContext().getRealPath("/WEB-INF... |
7ba8d78f-fce9-4c18-b82f-be0bde28a3a3 | 5 | public void signFile(String person, String path, String sign) {
try {
ArrayList<User> users = DataBase.getInstance().getUsers();
for (Iterator it = users.iterator(); it.hasNext();) {
User user = (User) it.next();
if (user.getLogin().equals(person)) {
... |
42b2039e-4e70-4d57-bb99-574f57191a7b | 8 | public Entry find(Object key) {
try{
int hash_code = key.hashCode();
int comp_code = this.compFunction(hash_code);
if (this.table[comp_code]==null){
return null;
}
else{
SList list_at_code = this.table[comp_code];
int list_size = list_at_code.length();
... |
3c0e5ba5-8941-4b60-a36a-36fccab39401 | 7 | @Override
public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) {
values[ref] = 0.0;
values[alt] = 0.0;
Set<Pair> refPairs = new HashSet<Pair>();
Set<Pair> altPairs = new HashSet<Pair>();
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while(it... |
4c8b91f4-6235-486b-8050-e83cf0f72bfd | 9 | public void addDepthIndex() {
List<HierarchyArea> sorted = new ArrayList<HierarchyArea>();
Stack<HierarchyArea> start = new Stack<HierarchyArea>();
// initialize start group
for(HierarchyArea ha : hierarchy) {
if( ha.front.size() == 0 ) {
start.push(ha);
ha.depth = 0.0;
}
}
// topologic... |
faa72487-c30e-44f5-ab63-67932d7e7afd | 2 | @Override
public void updateView() {
Model m = controller.getModel();
includeListModel.removeAllElements();
excludeListModel.removeAllElements();
for (File p : m.getFilesToExclude()) {
excludeListModel.addElement(p);
}
excludedList.setModel(excludeListModel);
for (File p : m.getFilesToInclude()) {
... |
07e050e0-6407-4f5e-9939-a164c72dc507 | 1 | @Override
public void dragGestureRecognized(DragGestureEvent dge) {
if (DragSource.isDragImageSupported()) {
Point offset = new Point(dge.getDragOrigin());
offset.x = -offset.x;
offset.y = -offset.y;
dge.startDrag(null, UIUtilities.getImage(this), offset, new DockableTransferable(mDockable), null);
}
... |
75159d59-0b6f-4e24-b0ee-23f7e91d0d73 | 5 | public Thead(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "align":
align = Align.parse(this, v);
break;
case "char":
charr = Char.parse(this, v);
break;
... |
f8cc2936-f6f2-40da-b0ee-d9f398625c26 | 4 | public boolean withinField(double x, double y){
if ( x > 15 && x < 1014 && y >= 25 && y < 518) {
return true;
}
return false;
} |
5f862386-6740-47fb-ae4d-2b1baf65dcd5 | 3 | public void mouseClicked(MouseEvent e)
{
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1)
{
int status = ge... |
2d50e5a5-c44a-4f41-ba61-fe31fb97d327 | 8 | public static BufferedImage obrot(BufferedImage in,int param) {
BufferedImage out = new BufferedImage(in.getWidth(),in.getHeight(),in.getType());
int width,height;
width = out.getWidth();
height = out.getHeight();
int r,g,b;
double x,y;
double minX,maxX,m... |
cf20e5e5-26f8-407c-973a-b05e1b68447a | 1 | public void addText(String text) {
if(text.startsWith(";")) {
lines.add(new TextLine(text.substring(1)));
}
} |
e5d2b80e-efc5-4bd0-a9de-4f44415f2679 | 4 | @EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent e){
if(e.getEntity() instanceof Player){
Player p = (Player) e.getEntity();
if(ArenaManager.getArenaManager().isInArena(p)){
if(e.getCause() != DamageCause.PROJECTILE && e.getCause() != DamageCause.ENTITY_ATTACK)... |
7eb1f8dd-7cfd-4b09-9f4c-315339cfbdf6 | 6 | @Override
public void kpic_SIBEventHandler( String xml_received)
{
final String xml = xml_received;
new Thread(
new Runnable() {
public void run() {
String id = "";
SSAP_XMLTools xmlTools = new SSAP_XMLTools();
boolean isunsubscription = xmlTools.isUnSubscriptionConfirmed(xml... |
563cc219-d38e-4580-a99c-896977b8634f | 4 | public String where(int p)
{
int ln = 1; // Line number
int ls = -1; // Line start (position of preceding newline)
int nextnl; // Position of next newline or end
while (true)
{
nextnl = text.indexOf('\n',ls+1);
if (nextnl<0) nextnl = text.length();
if (ls<... |
9b29a188-1f14-44dd-b7fb-da27d0594dcb | 5 | @Override
public boolean equals (Object other){
if(other == null)
return false;
if (!(other instanceof Set))
return false;
Set otherSet = (Set) other;
if(this.tiles.size() != otherSet.tiles.size())
return false;
for(int i=0; i<this.getNumTiles(); i++)
if(!this.tiles.get(i).equals(otherSe... |
c9247294-5dc4-4ae3-ba58-147caf725a07 | 3 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
BigDecimal num;
while (scan.hasNext()) {
num = scan.nextBigDecimal();
num = cubeRoot(num);
String ans = num.toString();
int index = ans.indexOf(".");
ans = ans.substring(0,index+11);
char[] a =ans.toCharArray();
l... |
01f08d5e-b6d2-44b9-9884-6ebc89dca68a | 3 | protected void doOnTerminate(StateEnum state, final C context) {
if (!context.isTerminated()) {
try {
if (isTrace())
log.info("terminating context %s", context);
context.setTerminated();
handlers.callOnFinalState(state, context);
... |
cd4428e3-68a9-4e45-a76d-16fa0f9bb924 | 9 | private static String parseFilesAndCompare(ArrayList<String> logFilenames, ArrayList<String> greppedFilenames, String command, String[] hosts) {
boolean isMatch = true;
String result = "";
String tempCommand = command;
//get the grepped results from each server and compare to local grep results
for(i... |
de02feab-9e00-40b2-9221-a7a046aebcea | 3 | public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... |
10e513ad-8286-4a93-9686-99dbfbeadb9f | 1 | @SuppressWarnings("unchecked")
public void saveError(HttpServletRequest request, String error) {
List<String> errors = (List<String>) request.getSession().getAttribute(ERRORS_KEY);
if (errors == null) {
errors = new ArrayList<String>();
}
errors.add(error);
reques... |
8d294f15-2fef-45f0-bf41-05cb920aaabe | 4 | private void setNextActivePlayer() {
this.players.add(players.poll());
getActivePlayer().incrementActionsWithMaxActions();
Position positionActivePlayer = grid.getElementPosition(getActivePlayer());
for (Element e : grid.getElementsOnPosition(positionActivePlayer))
if (e instanceof StartObstacle)
((Start... |
3192150e-238f-4dd6-91fe-b36eb5d341d2 | 6 | private void run() {
isRunning = true;
int frames = 0;
long frameCounter = 0;
final double frameTime = 1.0 / FRAME_CAP;
long lastTime = Time.getTime();
double unprocessedTime = 0;
while(isRunning) {
boolean render = false;
long startTi... |
a8289a05-07e8-4e36-b62e-dae1c307f2bd | 5 | @Override
public final D apply(S source) {
long ts = 0;
D res = null;
if (!initialized) {
synchronized (this) {
if (!initialized) {
init();
}
}
}
if (log.isDebugEnabled()) {
ts = System.nanoTime();
}
try {
res = mapper.apply(source);
} ... |
ae05ad15-036d-4af4-9643-b9bd8911169f | 2 | private boolean checkBottom(int x, int y, int z){
int dy = y + 1;
if(dy > CHUNK_HEIGHT - 1){
return false;
}else if(chunk[x][dy][z] != 0){
return true;
}else{
return false;
}
} |
e6f9b2ca-1f04-4f7f-9f1c-7a074ac57065 | 6 | public String getGPSDateTime(){
final String[] dt = {"", ""};
final GpsDirectory gps = md.getDirectory(GpsDirectory.class);
if (gps == null) {
return null;
}
for (final Tag t:gps.getTags()) {
if (t.getTagName().equals("GPS Date Stamp")) {
... |
f005a31d-1b14-48c6-9c82-32955667244e | 6 | @Override
public void readIn(String filename) {
System.out.println("Path : " + filename);
String sep = File.separator;
File path = new File(filename.substring(0, filename.lastIndexOf(sep)));
String prjName = filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'));
System.out.println("Pro... |
d1d4df81-6d4b-4eef-96e0-bfd783b78c2b | 4 | @SuppressWarnings("unchecked")
private void sundayCheckActionPerformed(java.awt.event.ActionEvent evt) {
// SWAP 1, TEAM 5
/*
* SMELL: data clumps - these actionperformed have chunks of data that is used over
* and over again.
*/
if(this.dayChecks[0].isSelected()) {
... |
3f251dc7-a8cb-452c-8f95-796dd963ad7b | 7 | public static void addDependentPropositionToSpecializedIndex(BacklinksIndex index, Proposition proposition, Stella_Object argument) {
{ HashTable table = index.predicatePropositionsTable;
if (table == null) {
table = HashTable.newHashTable();
index.predicatePropositionsTable = table;
... |
5e918b9c-dc20-453b-b4f1-fde1cd15ef7b | 6 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
SerializableLocation loc = (SerializableLocation) o;
if (x != loc.x)
return false;
if (y != loc.y)
return fa... |
e98a2d2f-f13c-4473-a950-1b8d7e9d5ac4 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficien... |
e29717ab-a2e2-4a86-a091-723ade441564 | 3 | public void exec() {
try {
ArrayList<String> erg = util.networkCommand("ifconfig eth0");
for (int i = 0; i < erg.size(); i++) {
if(erg.get(i).contains("inet Adresse:")){
String[] buffer = erg.get(i).split(":");
ip = buffer[1].substring(0, 14).trim();
bcast = buffer[2].substring(0, 1... |
642dd25c-5288-4296-b8dc-590a5185e19a | 6 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here: SAVE
if (APPLET.currentlyLoggedIn)
{
String post = "";
for (int y = 0; y < 5; y++)
{
... |
6c3c40bb-1655-42ee-ad79-fb87c510ddbc | 4 | public static int bin(int [] arr, int s, int e, int value){
int m=(s+e)/2;
if(s>e||s<e){
return -1; //value not found
}
else{
if(value>arr[m]){
s=m+1;
return bin(arr,s,e, value);
}
else if(value<arr[m]){
... |
4ac10630-d489-41cb-b516-bfe34fa7df64 | 5 | static void zelfdeWeekdag
(int jaarBegin, int jaarEind, int dag, int maand, String dagVanDeWeek) {
System.out.println(dag + " " + maandToString(maand) +
" is een " + dagVanDeWeek + " in de volgende jaren:");
for(int i = jaarBegin; i <= jaarEind; i++)
if(weekdag(dag, maand, i) == dagVanDeWeek) {
if(!schri... |
6a2ab70f-83ca-4c21-821f-66c43b692aac | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
5d6cd8b4-5c53-4921-93cf-90086f4704bf | 7 | public void method360(int i, int j, int k)
{
for(int i1 = 0; i1 < anIntArray1451.length; i1++)
{
int j1 = anIntArray1451[i1] >> 16 & 0xff;
j1 += i;
if(j1 < 0)
j1 = 0;
else
if(j1 > 255)
j1 = 255;
int k1 = anIntArray1451[i1] >> 8 & 0xff;
k1 += j;
if(k1 < 0)
k1 = 0;
else
if(k... |
b5792a80-0879-4a61-a0bf-1538fcea4743 | 6 | public double pow(double x, int n) {
double result = 1;
if (n>1||n<-1){
result = pow(x*x,n/2);
if(n%2 == 1){
result *=x;
}
else if(n%2 == -1){
result /=x;
}
}
else if (n==1){
return x;... |
4d6edf82-f5d5-43d3-a550-44b08990e276 | 1 | public void update(Map map){
x += speedX;
y += speedY;
if(IsCollision(map)){
this.canbeShoot = true;
this.restartShooting();
}
} |
462382dc-0345-44cb-9580-e24934d73e13 | 8 | public Map<String, Class<?>> filtrateControllerClass() throws ClassNotFoundException {
Map<String, Class<?>> annotationControllerMap = new HashMap<String, Class<?>>();
//遍历筛选出controller修饰的class, 并单独存入容器
Map<Class<?>, Annotation> annotationFiltrateClassMap = AnnotationHelper.filtrateClassAnnotation(Controller.clas... |
71cb4604-63a8-4e3d-a6f1-ada1646088d1 | 5 | @Override
public void onCommand(Network src, Command com) throws IOException {
switch (com.getType()) {
case MESSAGE:
Message msg = (Message) com;
if (msg.source.isEmpty()) {
System.out.println(" " + msg.message);
window.pushToWindow(msg.message);
} else {
System.out.println(msg.source + ": "... |
f7b307e4-f4e2-494f-aab0-e3fb3dff33b3 | 6 | public void allBids(){
auctions.removeAll(auctions);
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;... |
663c2031-1f74-4818-a4f8-e39eb1dced0e | 0 | public void setDescription(String description) {
this.description = description;
} |
eaad6499-3508-41c8-b91a-509c6f5c6fdd | 2 | @Override
public W<DeltaPT> delta(DC obj)
{ if(obj instanceof PT)
{ PT that=(PT)obj;
if(this.t.equals(that.t))
{ return new W(new Equality(true), new Similarity(0.0),new DeltaPT.Id(this));
}
else
{ return new W(new Equality(false), new Similarity(1.0),new DeltaPT(this,that));
... |
11aa3592-d6d4-4d77-8a50-aec3e8f258d5 | 9 | @POST
@Timed
@Path("login")
@Consumes("application/x-www-form-urlencoded")
@Produces({"application/json"})
public Response login(@CookieParam("authUser") String existingUserCookie, @FormParam("destination") String destination, @FormParam("username") String username, @FormParam("password") String pas... |
5903618e-1909-4923-b674-b7b2f4a45166 | 3 | @Override
public List<Funcionario> listByNome(String nome) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Funcionario> funcionarios = new ArrayList<>();
try {
con = ConnectionFactory.getConnection();
pstm = con.prep... |
bcbf5928-bf24-43cf-98af-5cad9b5d320b | 0 | public String getName(int i) {
return (String) this.names.get(i);
} |
c74a4ad1-69ae-4b77-9c77-3532c69dcee4 | 1 | public DocumentDTO findById(int id) throws RemindMeException {
DocumentDTO documentDTO = null;
try {
DocumentEntity documentEntity = documentDao.findById(id);
documentDTO = dtoCreatorUtil.createDocumentDto(documentEntity);
} catch (IndexOutOfBoundsException exp) {
throw new RemindMeException("No Data Fou... |
a67fe410-674e-406b-a44c-e8fde8a7caa7 | 2 | public static Dificultad getDificultadById(int d) {
if(d == FACIL.VALUE)return FACIL;
if(d == PRO.VALUE)return PRO;
return MEDIO;
} |
b55045cb-3aac-4720-9c3c-019a07e2a49d | 9 | public static Collection<Class<? extends Critter>> getAvailableCritterTypes() {
if (availableCritterTypes == null) {
availableCritterTypes = new ArrayList<Class<? extends Critter>>(0);
String typePackageStr = System.getProperty("critters.typePackageName");
String typeStr = System.getProperty("critters.avail... |
d38f6516-8777-449b-9ffb-59cd3c24d18a | 8 | public static void main(String [] args) throws java.net.UnknownHostException, java.io.IOException {
System.out.println("java.library.path="+System.getProperty("java.library.path"));
JtunDevice tunDev = JtunDevice.getTunDeviceInstance();
byte [] buf = new byte[1600];
byte [] _no_eth_frame;
if(tunDev.open()) {
... |
be4ecf0e-18f1-4413-95a6-2e12d73b6044 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Term other = (Term) obj;
if (field == null) {
if (other.field != null)
return false;
} else if (!field.equa... |
c8bebda1-8858-4510-9b54-b1dfd383222a | 6 | private StateTree generate(
TicTacToeBoard state,
Position move) throws Exception
{
LinkedList<StateTree> successors = new LinkedList<StateTree>();
if (!state.isGameOver()) {
for (int row = 0; row < TicTacToeBoard.SIZE; row++) {
for (int col = 0; col < TicTacToeBoard.SIZE; col++) {
int player ... |
b8b39b51-6030-43ea-b55d-3022373f860e | 8 | private void blackPixel(Pixel pixel, BufferedImage image){
if(image.getRGB(pixel.x + 1, pixel.y) == Color.WHITE.getRGB() && edgePixels.contains(new Pixel(pixel.x + 1, pixel.y))){
pixel.label = "" + counter;
} else if(image.getRGB(pixel.x - 1, pixel.y) == Color.WHITE.getRGB() && edgePixels.co... |
b144ba03-bf7a-4aae-b6f6-f66850f6ea06 | 1 | private static boolean insertDrug(Drug bean, PreparedStatement stmt) throws SQLException{
stmt.setString(1, bean.getDrugName());
stmt.setString(2, bean.getDescription());
stmt.setInt(3, bean.getQuantity());
stmt.setBoolean(4, bean.isControlFlag());
stmt.setString(5, bean.getSideEffect());
stmt.setB... |
a87a07d3-0fed-430a-af8e-95dd4413119b | 1 | private void programmerRunButton(java.awt.event.ActionEvent evt)
{
hidePanels(manualPanel);
// Resetting step log
world.resetStepThrough();
// Resetting speed
currSpeed = 5;
world.setSpeed(currSpeed);
speedCounter.setText("Speed: " + currSpeed);
... |
937549cf-efc2-436f-a279-81e208f96536 | 4 | private Display createDisplay(Class cl) {
try {
String className = cl.getName();
Class dcl = Class.forName(className + "Display");
if (Display.class.isAssignableFrom(dcl)) {
Display display = (Display) dcl.newInstance();
map.put(cl, display);
... |
284518c0-0cda-4b79-8263-e2d005eccc33 | 2 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
if (!this.isEmptyTable(this.table_trans)) {
if (this.getDataTable(this.table_trans)) {
frmSetupTrans obj = new frmSetupTrans(s, dataTable);
obj.setVisible(t... |
353fe03f-9156-48d5-9fa1-78c047aeb0ae | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
b40d048f-a04e-4fe3-88ba-22359603e21d | 6 | public static void save(String filename, double[] input) {
// assumes 44,100 samples per second
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
byte[] data = new byte[2 * input.length];
for (int i = 0; i... |
fdd14a3a-fa3f-473a-b2e4-06ad5a214f74 | 1 | private static BufferedImage readOrWriteNextImage(PixImage image)
throws IOException, ClassNotFoundException {
if (WRITE_MODE) {
os.writeInt(image.getWidth());
os.writeInt(image.getHeight());
os.writeObject(stringOfPixImage(image));
return ImageUtils.pixImage2buffer(image);
} else {
return imageOf... |
9f1ecb28-9eaa-4167-86d7-6047466f89a7 | 7 | public boolean alone( int x, int y )
{
return (
(!exists( x - 1, y ) || board[y][x - 1] == EMPTY) &&
(!exists( x + 1, y ) || board[y][x + 1] == EMPTY) &&
(!exists( x, y - 1 ) || board[y - 1][x] == EMPTY) &&
(!exists( x, y + 1 ) || board[y + 1][x] == EMPTY)
);
} |
314a3396-fe86-4811-bbf0-b7a5cf9160b2 | 5 | protected @Override Token getNewToken() throws ScannerException {
try {
final String s = in.readLine();
if (s == null) {
logger.error("Unexpected end of input");
throw new ScannerException("Unexpected end of input", this);
}
if ("(".equals(s))
return BEGIN_EXP;
if (")".equals(s))
return... |
f18dda54-d8da-415d-a1f7-9243aaf482b1 | 8 | private double getRingSize(int currIndex, int branchSize, double fullSize)
{
if (currIndex < 1 || currIndex > branchSize || branchSize < 1 || fullSize < 0)
{
throw new IllegalArgumentException();
}
int middleIndex = 0;
boolean isBranchSizeEven = ((branchSize) % 2 == 0);
middleIndex = (int) Math.ceil(b... |
3df48de7-1654-418d-ab0f-838f6d3148fb | 2 | public UserProfile fetchUserProfile(GoogleDocs googleDocs)
{
MetadataEntry entry = null;
try
{
entry = this.getUserMetadata(googleDocs);
}
catch (ServiceException error)
{
throw new ApiException(error.getMessage(), error);
}
... |
44a8ff4e-971e-4ced-8e79-efeb8faae39f | 3 | void parseContentspec(String name) throws java.lang.Exception
{
if (tryRead("EMPTY")) {
setElement(name, CONTENT_EMPTY, null, null);
return;
} else if (tryRead("ANY")) {
setElement(name, CONTENT_ANY, null, null);
return;
} else {
re... |
dbfba7e0-2585-4cfa-a9f6-952ad3a24643 | 2 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
for (int i = 0; i < subBlocks.length; i++) {
if (subBlocks[i] == oldBlock) {
subBlocks[i] = newBlock;
return true;
}
}
return false;
} |
55b96b1a-8342-4e0c-80fb-fdbbdbfa952e | 8 | public static void main(String[] args) throws IOException {
BufferedReader in;
StringBuilder out = new StringBuilder();
File f = new File("entrada");
if (f.exists()) {
in = new BufferedReader(new FileReader(f));
} else
in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseIn... |
be48da39-f0e8-47f0-a513-10156a727524 | 3 | public boolean hasPit(int x, int y)
{
for (Point p:pits)
{
if (p.x == x && p.y == y)
{
return true;
}
}
return false;
} |
cd3498ab-4684-42fe-bd66-370d60177fff | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Person))
return false;
Person other = (Person) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;... |
6fbcc73b-1178-4ceb-9289-29154585152a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Usuario other = (Usuario) obj;
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(othe... |
143fcd5e-72f4-44b1-92eb-dd5043300caf | 1 | public static final void register(String prefix, HashMap<String, String> map, Path appFile, Path iconDir) {
String appPath = appFile.normalize().toAbsolutePath().toString();
WindowsRegistry reg = new WindowsRegistry(true);
for (String extension : map.keySet()) {
// Make the entry that points to the app's infor... |
9dad6f82-860e-45be-8fa3-32e6933849d7 | 9 | public ArrayList<String> getTrackList(){
JsonParser jp = null;
boolean leadingKEY = false;
String ldKEY = null;
ArrayList<String> trackID = new ArrayList<String>();
try {
jp = Json.createParser(new FileReader(DaemonMainController.getDatabasePath()));
while(jp.hasNext()){
JsonParser.Event event =... |
b48594b1-32ab-441f-ae00-827a11e776bd | 5 | @EventHandler
public void onMove(PlayerMoveEvent event) {
if (this.target.get(event.getPlayer()) != null) event.getPlayer().setCompassTarget(((Player) this.target.get(event.getPlayer())).getLocation());
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
Player ct = (Player) this.target.get(p);
if (ct ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.