method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
95cb3649-ea35-455e-8759-4e8063ee9188 | 6 | private void button3MousePressed(MouseEvent event) {
if (!button3.isEnabled()) {
return;
}
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogTitle("Trove Install Location");
if (TroveUtils.... |
aa4f2247-35aa-4713-8229-e7ad34a122ff | 2 | public void handleKeyEvent(KeyEvent keyEvent) {
// The code of the key that is associated with this event.
int key = keyEvent.getKeyCode();
switch(keyEvent.getID()) {
case KeyEvent.KEY_PRESSED:
Log.debug("Pressed key: " + key);
keyPressed.add(key);
break;
case KeyEvent.KEY_RELEASED:
... |
cc8226c1-c4ec-4b8d-a52d-42529dde41e5 | 6 | void settitle1 ()
{
String S;
if (BigTimer)
S = Global.resourceString("Game_") + GameNumber + ": " + WhiteName
+ " " + formmoves(WhiteMoves) + " - " + BlackName + " "
+ formmoves(BlackMoves);
else S = Global.resourceString("Game_") + GameNumber + ": " + WhiteName
+ " " + formtime(WhiteTime - WhiteR... |
804d123d-12c8-49d2-b62e-7df321a4ec8a | 5 | public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if (!plugin.hasPerm(sender, "hunger", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 0) {
if (plugin.isPlayer(sender)) {
... |
d166ccb8-99e4-412e-a4f6-1f49767bca11 | 8 | protected Language getAnimalSpeak(final MOB M)
{
if((M!=null)
&&(canSpeakWithThis(M)))
{
final Race r=M.charStats().getMyRace();
for(Ability A : r.racialAbilities(M))
{
if(((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_LANGUAGE)
&&(A instanceof Language))
{
Ability effectA=... |
0d37f975-acd1-4ad6-98ce-fc1756f68399 | 0 | public ProgramSetupThread(String pname) {
this.pname = pname;
} |
b78632ae-ccbe-4d35-8233-2bd4372f147d | 7 | public void listCatalogs(String org) {
this.vccPreCheck();
Organization orgObj = this.getOrganization(org);
try {
Formatter.printInfoLine("Catalogs:\n");
for (ReferenceType catalogRef : orgObj.getCatalogRefs()) {
Catalog catalog = Catalog.getCatalogByReference(this.vcc, catalogRef);
Formatter.prin... |
0182c756-711f-4ea6-a3b9-6af7c7e69bd6 | 0 | public static String get(String code) {
return codes.get(code);
} |
fccb53ff-d0d8-4d7a-8389-1b0bc220891b | 4 | public double scoreCompetencesHash(Set<Competence> lstCompsCherche) {
// On initialise scoreCompetences à 0
double scoreCompetences = 0;
double poidsMotClef;
double sommePoids;
// On récupère toutes les compétences se situant dans la HashMap
Set setComps = this.m_tblComps... |
74fb821b-6888-4b95-89d6-bb2d022d682c | 7 | public int read(int width) throws IOException {
if (width == 0) {
return 0;
}
if (width < 0 || width > 32) {
throw new IOException("Bad read width.");
}
int result = 0;
while (width > 0) {
if (this.available == 0) {
this... |
cf89c32d-a0bf-456c-bfad-d31fe5a9f694 | 1 | private static int factorial(int n){
if(n<2) return 1;
return n*factorial(n-1);
} |
d2dfb54d-e6d8-4310-a980-3fef01220dea | 2 | public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
writer.println(output[type] + ((count == 1) ? "" : "2")
+ ((depth == 0) ? "" : "_X" + depth));
} |
10604e3f-144b-4eac-88ae-7846f71a6aa5 | 3 | private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
case 108:
... |
e622854a-4e36-4417-9f48-54301beefd01 | 0 | public void removeCommand(Command _command) {
this.commands.remove(_command);
} |
28c6b29e-3d9e-442c-8530-432ce5df2c66 | 0 | public String value() { return value; } |
c1e45b0c-0552-4448-9ccb-c315cf35d9fc | 9 | private Object newBuffer(Object template) {
if(template instanceof Object[])
return new Object [((Object[]) template).length] ;
if(template instanceof byte[])
return new byte [((byte[]) template).length] ;
if(template instanceof char[])
return new char [((char[]) template).length] ;
... |
cf67e509-5221-41f4-861b-bc9c8dd1923f | 8 | private String convertLength(int i) {
switch(i) {
case 1: return "s ";
case 2: return "i ";
case 3: return "i. ";
case 4: return "q ";
case 6: return "q. ";
case 8: return "h ";
case 12: return "h. ";
case 16: return "w ";
}
return "";
} |
e242b6e4-56db-4968-888c-729af3d56380 | 2 | @Override
public void Play(PlayerResponse response) {
deal();
// Send all Users their dealt hand
for (PinochlePlayer player : mP.getPlayers()) {
PinochleMessage message = new PinochleMessage();
message.setCards(player.getCurrentCards());
player.setMessage(message);
}
mP.updateAll();
// Check... |
aa770173-4572-493e-8a06-d1c0302e0fc1 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposAppConfigEntity that = (PhpposAppConfigEntity) o;
if (key != null ? !key.equals(that.key) : that.key != null) return false;
if (value != ... |
fb0e5fa2-779e-46a4-8ccc-3c47db470763 | 9 | public static int evalRPN(String[] tokens){
int result=0;
Stack<Integer> stack = new Stack<Integer>();
for(int i=0;i<tokens.length;i++){
if(!tokens[i].equals("+") && !tokens[i].equals("-")
&& !tokens[i].equals("*") && !tokens[i].equals("/")){
stack.push(Integer.parseInt(tokens[i]));
}
else{
... |
3cc10768-3c07-4e9b-b81c-8d79dc42a4b9 | 8 | public final boolean isValidMove (final char action) {
final char direct = getDirectByAction(action);
if (direct == '\0') {
// It's a invalid action.
return false;
}
final Point newPos = new Point(minerPos);
movePos(newPos, direct);
if (!isInBound... |
b0acf6c4-b69e-48e6-9859-bc38b1d5150d | 7 | private void updateSimChangeSpeedValues() {
//Since this is called many times (the GUI responds to many events...some of which
//aren't changes the simulator needs to know about), we compare the current values with
//the values the last time this is called...if no change we don't notify the simu... |
efe97462-b4d1-4426-8381-745d83c5481c | 5 | public int GetCLPrayer(int ItemID) {
if (ItemID == 10716) {
return 100;
}
if (ItemID == 10718) {
return 100;
}
if (ItemID == -1) {
return 1;
}
String ItemName = GetItemName(ItemID);
if (ItemName.startsWith("Prayer cape")) {
return 100;
}
if (ItemName.startsWith("Prayer hood")) {
return 100;... |
69c5f54c-a36e-4e12-b650-9419a1948030 | 8 | public void assignMowerTasksByFootprint(LinkedList<FootPrint> footPrint)
{
for(FootPrint fp:footPrint)
{
Util.debugPrint(fp.toDebugString(),Util.LOG_DEBUG);
Util.debugPrint("Mower Task:"+this.mowerTasks.size()+" "+this.mowerTasks.get(0).getBlocksCount(),Util.LOG_DEBUG);
if(this.mowerTasks.size()>0)
{
... |
93f5f89b-94e8-4070-8ffc-66e70b03aff2 | 6 | public static boolean createFunny(ConditionalBlock cb, StructuredBlock last) {
if (cb.jump == null
|| !(cb.getInstruction() instanceof CompareUnaryOperator)
|| !(last.outer instanceof SequentialBlock)
|| !(last.outer.getSubBlocks()[0] instanceof IfThenElseBlock))
return false;
CompareUnaryOperator ... |
d91ae7e4-146c-4873-9525-638e8009063a | 8 | public AbstractFace build() {
AbstractFace face = null;
switch (faceClass.toLowerCase()) {
case "black":
face = new BlackFace();
break;
case "white":
default:
face = new WhiteFace();
break;
}
... |
88441ac3-703f-47c0-8ccf-f9cf055d5bc8 | 7 | public void setHome(CommandSender cs, Command cmd, String string,
String[] args) {
Player player = (Player) cs;
if (args.length == 0) {
if (player.hasPermission("warpsandports.homes.set.default") || player.isOp()) {
Location loc = player.getLocation();
String world = loc.getWorld().getName();
in... |
03b29323-550a-4b3e-8d6c-3bb3217fb98f | 0 | public editUser()
{
this.requireLogin = true;
this.addParamConstraint("id", ParamCons.INTEGER);
this.addParamConstraint("password", true);
this.addParamConstraint("username", true);
this.addParamConstraint("fullName", true);
this.addParamConstraint("email", true);
this.addRtnCode(405, "permission denied"... |
0b2a3f6c-e2b6-4f13-ae03-ef0c376e4e22 | 5 | private List<FBPhoto> processPhotoData(List<Facebook> fbData) throws ParseException {
// TODO Auto-generated method stub
List<FBPhoto> list=new ArrayList<FBPhoto>();
try {
for (Facebook facebook : fbData) {
JSONObject photoJson=new JSONObject(facebook.getData());
String dateString=photoJson.getString(... |
fd4a8a0d-1465-489b-abed-ac0ca56563c9 | 0 | public String getName() {
return name;
} |
5afac99c-ec79-4f9f-ae61-89d301f81cff | 7 | private void fixCorrespondingGates(Graph<Vertex,Edge> g) {
TreeMap<String, Integer> scoreTallyOut = new TreeMap<String, Integer>();
TreeMap<String, Integer> scoreTallyIn = new TreeMap<String, Integer>();
LinkedList<String> gateways = new LinkedList<String>();
KShortestPaths<Vertex, Edge> sp = new KShortestPa... |
13c5238f-ce2b-43d1-8e25-fa7ae78be197 | 2 | private void compileShader()
{
glLinkProgram( resource.getProgram() );
if ( glGetProgrami( resource.getProgram(), GL_LINK_STATUS ) == 0 )
{
System.err.println( glGetProgramInfoLog( resource.getProgram(), 1024 ) );
System.exit( 1 );
}
glValidateProgram( resource.getProgram() );
if ( glGetProgrami( ... |
666f719e-a176-4579-9971-7bd719dd19cc | 3 | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
Connection conn;
Statement stmt;
ResultSet rs;
HttpSession hs=request.getSession(true);
hs.setAttribute("... |
ee7922f0-e6c5-4a69-81bf-a5801895abbf | 0 | public float getA() {
return a;
} |
89222d09-5c9e-43b4-8360-e39680067caa | 4 | private void DeleteTopmost() {
ConstructEditor deleteMeEditor = mConstructSelector.getSelected();
if(deleteMeEditor.getParent() != null)
{
int index = deleteMeEditor.construct.parent.children.indexOf(deleteMeEditor.construct);
int added = AddChildrenTo(deleteMeEditor.construct, deleteMeEditor.construct.par... |
221c108d-c5c8-4e0d-9b1d-e839a700851f | 6 | public void ProcessVulnerabilityXML(javax.swing.JTextField XMLFileName, javax.swing.JTextField XSSAttackName, javax.swing.JTextArea XSSAttackCode, javax.swing.JTextArea XSSAttackDesc, javax.swing.JTextField XSSAttackLabel, javax.swing.JTextArea XSSAttackBrowser, javax.swing.JList XSSAttackNames) {
//Adapted fro... |
59490eb6-7310-4e2c-a193-f5a73c37731a | 6 | private void save(){
Calendar calendar = Calendar.getInstance();
calendar.set(
(Integer)dateReceivedYearField.getSelectedItem(),
(Integer)dateReceivedMonthField.getSelectedItem()-1,
(Integer)dateReceivedDayField.getSelectedItem(),
(Integer)... |
f23b369a-e303-4378-ae68-2189353c2185 | 8 | private boolean validateValue(String value)
{
value = value.toLowerCase();
if (value.lastIndexOf("ms") != -1)
{
if (Integer.parseInt(value.replaceAll("ms", "")) > 999)
{
return false;
}
}
else if (value.lastIndexOf("s") != ... |
7c5f249a-ffce-4a2b-838c-009bcb359614 | 0 | public void setPos(Point2D p)
{
myBottomLeft = new Point2D.Double(p.getX(), p.getY());
} |
c48da208-9b99-45ac-9ad0-41de62f86e67 | 0 | public String getName()
{
return name;
} |
d52236eb-57fc-43ed-9938-5fd62b899897 | 4 | private String getSituacao(Integer situacao){
switch(situacao){
case 0: return "Aberto";
case 1: return "Em Julgamento";
case 2: return "Julgado";
case 3: return "Cancelado";
}
return null;
} |
538d3a75-f7a3-452d-8994-2136e237440b | 5 | public static InputTableModel getModel(Automaton automaton, boolean multipleFile) {
InputTableModel model = (InputTableModel) INPUTS_TO_MODELS
.get(new Integer(inputsForMachine(automaton)));
if (model != null && (model.isMultiple == multipleFile)) {
model = new InputTableModel(model);
// Clear out... |
727685ed-c828-4026-ad30-a41b9e4129e4 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Token token = (Token) o;
if (type != token.type) return false;
if (value != null ? !value.equals(token.value) : token.value != null) return fal... |
71384d98-d571-45e5-a63b-210f8ed9a206 | 5 | public static HashMap<String, Integer> rankVarianceWeight(LinkedHashMap<String, HashMap<String, Double>> listOfWeightMaps) {
HashMap<String, ArrayList<Double>> attributeVals = new HashMap<String, ArrayList<Double>>();
HashMap<String, Double> attributeMeans = new HashMap<String, Double>();
for (H... |
f04a9ec6-08ee-4705-ac8a-73c7db7eb2af | 8 | private boolean isPrimeable(int n) {
if (n < 10) {
return true;
}
int[] numbers = Problem30.getNumbers(n);
for (int i = 0; i < numbers.length; i++) {
int x = numbers[i];
switch (x) {
case 1:
case 3:
case 7:
case 9:
break;
default:
return false;
}
}
int mod = n % 6;
... |
5741e467-0dec-4e68-83da-7fd8b0454cd8 | 5 | @Override
public User findByEmail(String email) {
User user = null;
try {
connection = getConnection();
ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE email =?;");
ptmt.setString(1, email);
resultSet = ptmt.executeQuery();
result... |
4867878f-2140-4d0f-a53b-289e4386c99b | 0 | private double edgeX(int x, int y, double[][] smoothedGray) {
return 1*smoothedGray[x-1][y-1] + 2*smoothedGray[x][y-1] + 1*smoothedGray[x+1][y-1] -
1*smoothedGray[x-1][y+1] - 2*smoothedGray[x][y+1] - 1*smoothedGray[x+1][y+1];
} |
c7f836bf-a135-4aa4-a1a9-8d22ae2e3f84 | 3 | public RunGenerator(){
// Makes it look pretty
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// ... |
99202f39-ff85-4ff1-bcfc-d9f85148baad | 2 | public void set(Block block,int x,int y,int z){
Block current = blocks[x%16][y%16][z%16];
if(current != null)current.removeFromParent();;
if( block != null) block.addToWorld(x, y, z);
blocks[x%16][y%16][z%16] = block;
} |
2fd2d156-a205-4712-8071-b50432cf583f | 8 | private void interpolate(int iLower, int iUpper) {
int dx = xRaster[iUpper] - xRaster[iLower];
if (dx < 0)
dx = -dx;
int dy = yRaster[iUpper] - yRaster[iLower];
if (dy < 0)
dy = -dy;
if ((dx + dy) <= 1)
return;
float tLower = tRaster[iLower];
float tUpper = tRaster[iUpper];
int iMid = allocRast... |
2f2ebe98-b807-4274-84e7-65ab804ac9ec | 6 | @Override
public void run() {
File musicFolder = new File(dir, "music");
File stepsFolder = new File(new File(dir, "newsound"), "step");
File digFolder = new File(new File(dir, "sound3"), "dig");
File randomFolder = new File(new File(dir, "sound3"), "random");
File newMusicFo... |
fa91d85f-12ff-407e-a164-4c2a49e24107 | 8 | private void cliques(
List<Vertex> likelyC,
List<Vertex> C,
List<Vertex> F)
{
List<Vertex> candidates_array = new ArrayList<Vertex>(C);
if (!allEdgesSeen(C, F)) {
for (Vertex candidate : candidates_array) {
List<Vertex> new_candidates =... |
d4adcd9d-20a3-4759-83bf-8a21630beaa1 | 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... |
324e259e-075b-45ca-8c10-6b017641bc40 | 5 | public static void keyReleased(KeyEvent e) {
key.clear(e.getKeyCode());
if (!key.get(KeyEvent.VK_SPACE)) {
setFire(false);
}
if (!key.get(KeyEvent.VK_LEFT)) {
setX(0);
}
if (!key.get(KeyEvent.VK_RIGHT)) {
setX(0);
}
if (... |
debf64f3-80c7-4ce8-b382-959906984a84 | 7 | public void disconnect(){
try {
if(input != null) input.close();
}
catch(Exception e) {}
try {
if(output != null) output.close();
}
catch(Exception e) {}
try{
if(socket != null) socket.close();
}
catch(Exception... |
a8b044a9-7bb9-412c-bb6a-27c05d3c330e | 3 | public void visit_swap(final Instruction inst) {
// 0 1 -> 1 0
if (Tree.USE_STACK) {
saveStack();
final StackExpr s1 = (StackExpr) stack.pop1();
final StackExpr s0 = (StackExpr) stack.pop1();
final StackExpr[] s = new StackExpr[] { s0, s1 };
manip(s, new int[] { 1, 0 }, StackManipStmt.SWAP);
} e... |
e7922622-f7b0-4bcd-bf55-6ac5ca8b2dd0 | 8 | public void pintar(int x, int y, int type) {
int [] xy = new int [2];
if(type == 5) {
xy = buscaType(5);
if((xy[0] != -1) && (xy[0] != -1)) {
cambiarCasilla(tablero[xy[0]][xy[1]],7);
}
}
if(type == 6) {
xy = buscaType(6);
if((xy[0] != -1) && (xy[0] != -1)) {
... |
70c20c1c-b1a5-4a5d-ad87-e3d825baee72 | 2 | public void update (double elapsedTime) {
Dimension bounds = myView.getSize();
for (Assembly a : myAssemblies) {
a.update(elapsedTime, bounds, myActiveForces);
}
int lastKey = myView.getLastKeyPressed();
if (myKeyPresses.containsKey(lastKey)) {
myKeyPresse... |
6559748c-2702-4629-9542-fca00570a857 | 6 | public static EntityMinecart placeCart(GameProfile owner, ItemStack cart, WorldServer world, int x, int y, int z) {
if (cart == null)
return null;
cart = cart.copy();
if (cart.getItem() instanceof IMinecartItem) {
IMinecartItem mi = (IMinecartItem) cart.getItem();
... |
2cde307b-4d5d-4b3c-8455-6fc064ff9527 | 3 | private void makeCircularStreetList(Street street, ArrayList<FieldCircularList> fieldArrayList) {
for(int i = 0; i < fieldArrayList.size(); i++) {
if(fieldArrayList.get(i) instanceof Street && ((Street) fieldArrayList.get(i)).isSameColor(street)) {
street.setNextGroupElement(((Street) fieldArrayList.get(i)));
... |
54bc8db9-3ebd-4a25-8c08-86836e58ba07 | 3 | public boolean valideCoord(int x,int y){
return ( x < row && y < col
&& x > 0 && y > 0);
} |
977b8d4f-e009-4bc2-b4e7-3d394971a6ab | 9 | public boolean intersects(S2Polygon b) {
// A.intersects(B) if and only if !complement(A).contains(B). However,
// implementing a complement() operation is trickier than it sounds,
// and in any case it's more efficient to test for intersection directly.
// If both polygons have one loop, use the more ... |
62ac589b-3c85-4cc9-9197-6fed182dd028 | 8 | public ArrayList<Tile> adjacent(int r, int c)
{
ArrayList<Tile> temp = new ArrayList<Tile>();
if (getTile(r+1,c) != null) {temp.add(getTile(r+1,c));}
if (getTile(r-1,c) != null) {temp.add(getTile(r-1,c));}
if (getTile(r,c-1) != null) {temp.add(getTile(r,c-1));}
if (getTile(r,c+1) != null) {temp.add(getTil... |
20928698-12fa-4549-9d17-216dd529bc6b | 5 | private WarMachine platziereWarMachine(WarMachine newWarMachine) {
boolean invalidInput = true;
String input = null;
Koordinate platzKoordinate = null;
Ausrichtung platzAusrichtung = null;
while (invalidInput) {
try {
input = generateRandomKoordinate() + ","
+ generateRandomAusrichtung();
} ... |
02262dd7-fdad-4a87-882c-41b2a9b54156 | 3 | private Map func_27415_a(File var1, File var2, File var3) {
return var1.exists()?this.func_27408_a(var1):(var3.exists()?this.func_27408_a(var3):(var2.exists()?this.func_27408_a(var2):null));
} |
11cdc4d8-80fb-4578-ba97-53fe78229cc3 | 8 | @Override
public List<OrderDetail> getOrderDetailByID(final Integer id) {
Connection conn = null;
PreparedStatement stmt=null;
List<OrderDetail> OrderDetailList=new ArrayList<>();
ResultSet rs =null;
try {
conn = dataSource.getConnection();
stmt = co... |
83a4b258-89f9-4143-9d24-926043ba6c42 | 1 | public void test_isoChrononolgy_Chicago() {
DateTimeZone zone = DateTimeZone.forID("America/Chicago");
Chronology lenient = ISOChronology.getInstance(zone);
try {
new DateTime(2007, 3, 11, 2, 30, 0, 0, lenient);
fail();
} catch (IllegalArgumentException ex) {
... |
b3f87a99-91d0-4014-96dc-62718686fe40 | 1 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
for(HashBucket bucket : map) {
sb.append(bucket.toString());
}
sb.append("]");
return sb.toString();
} |
7e50a157-ade8-431b-8212-1535d7b6ac21 | 4 | public void listen(int port) {
try {
server = new ServerSocket(port);
listening = true;
while (listening) {
new TCPClient(server.accept()).start();
}
} catch (Exception ex) {
if (!ex.getMessage().equals("socket closed") && !server.isClosed())
ex.printStackTrace();
}
} |
4489e746-d3b2-4c4f-9ee8-175706550aa2 | 9 | public static ToolsRunner getRunnerTool(String actionName) {
Preconditions.checkNotNull(actionName, "No Action is set. Please see usage:\n" + getUsageStr());
Preconditions.checkArgument(
actionName.equals("sar") || actionName.equals("jobserver") || actionName.equals("schemaserver") || a... |
0d53b06c-a281-4fca-be33-2df20d68f7d3 | 2 | protected void setDirtiness(double dirtiness) {
this.dirtiness = dirtiness;
if (this.dirtiness < 0) {
this.dirtiness = 0;
}
else if (this.dirtiness > 0.25) {
this.dirtiness = 0.25;
}
} |
57d4e087-6c36-4308-b072-95367e98ab2f | 8 | public static void removeProject(Project project, boolean delete) {
int sym = project.getSym();
boolean found = false;
ArrayList<Project> projects = new ArrayList<Project>();
if( project.isLocal() )
projects = getProjects(project.getDir());
else
projects = getProjects(sym);
int i = 0;
for (Pr... |
1db5583e-fb95-44f1-8e85-a32783eca051 | 6 | public byte[] getCode(int bit) {
byte[] res;
assert ((bit == 0) || (bit == 1)) : "getCode: input isn't a bit!";
if (bit == 0) {
if (code0 == null) return(null);
res = new byte[code0.length];
for (int i = 0 ; i < code0.length ; i++)
res[i] = co... |
3ef8f870-916a-4ad1-8c24-a0e00439994f | 9 | protected void doubleLoop(RasterAccessor src,
RasterAccessor dst,
int filterSize) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
double dstDataArrays[][] = dst.getDoubleDataA... |
90d6116c-b12b-407a-ab28-01b4d539bff0 | 2 | protected void setLineList(List<String> lines) {
if ((lines == null) || (lines.size() == 0)) {
IllegalArgumentException iae = new IllegalArgumentException("The list must not be null or without entries!");
Main.handleUnhandableProblem(iae);
}
this.uiFileLines = new ArrayL... |
bac75db7-9a18-4aed-bf77-75d1dabbaeaa | 8 | private void selectAndPossiblyCenter(JTextComponent component, int start,
int end) {
component.setSelectionStart(start);
component.setSelectionEnd(end);
Rectangle r = null;
try {
r = component.modelToView(start);
if (r == ... |
19b41712-42c9-438e-82db-5c89f7db460a | 1 | private static boolean deleteSchedule(Schedule bean, PreparedStatement stmt) throws SQLException{
stmt.setDate(1, bean.getWorkDay());
stmt.setString(2, bean.getUsername());
int affected=stmt.executeUpdate();
if(affected==1){
System.out.println("Employee with username "+bean.getUsername()+" is not work... |
753c9112-8161-44d7-98ae-5281b4874570 | 0 | public void teleopPeriodic() {
// Runs commands & stuff
Scheduler.getInstance().run();
} |
90ab1d29-99a9-48e3-9587-e8ee0e6a8d0b | 4 | public ArrayList<Libros> getById(Libros l){
PreparedStatement ps;
ArrayList<Libros> libros = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Libros WHERE codigo=?");
ps.setString(1, l.getCodigolibro());
ResultSet rs = ps.executeQuery();
... |
7f398429-85f4-4c32-99f5-c87d521b86ae | 0 | public static void FinalBoss() {
currentRoomName = "Final Boss";
currentRoom = 9;
RoomDescription = "The door swings open and as you take a step in, the lights turn on and confetti falls from the " +
"ceiling, a party of giant dancing lobsters come out from hiding and start to boogie.\n\n" +
"Congratulat... |
27248bca-217c-4804-a992-28f71a876cb1 | 8 | public static void getServerList() {
if (Global.FIRST_IP.equals(Global.NO_FIRST_SERVER)) {
Donnees.fillingServers(false);
return; // premier serveur
}
Stockage.Donnees.fillingServers(true);
try (SocketChannel clientSocket = SocketChannel.open()) {
InetSocketAddress local = new InetSocketAdd... |
737a4e86-75f6-4df2-a455-e46f348ef18b | 5 | private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed
if (txtConclusao.getText().equals("")
|| txtHoras.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Erro ao realizar o Lançamento !!! \n Por Favor Preencha os... |
2925de5c-d021-4e41-98ab-46491a57d0b8 | 4 | public RSStub() {
String source;
try {
source = getPageSource(getCodeBase());
Matcher aMatcher = aPattern.matcher(source);
if (aMatcher.find()) {
Matcher pMatcher = pPattern.matcher(source);
while (pMatcher.find()) {
String key = pMatcher.group(1);
String value = pMatcher.group(2);
p... |
87b08ade-d0c1-4a91-940c-6965b8218d3a | 5 | private static double hue_2_RGB(double v1, double v2, double vH) {
if (vH < 0.0) vH += 1;
if (vH > 1.0) vH -= 1;
if (6 * vH < 1) return ( v1 + (v2-v1) * 6.0 * vH);
if (2 * vH < 1) return ( v2 );
if (3 * vH < 2) return v1 + (v2-v1) * ((2.0/3.0) - vH) * 6;
return v1;
} |
ece3f950-4387-46cf-b733-daa6b7f9423a | 0 | public String getStworz() {
return stworz;
} |
fd207d78-8068-4055-84d7-3b59704852d9 | 4 | private BlankExpression evalExpression(String rawExpression) throws Exception
{
BlankVar var; // variavel auxiliar para guardar uma BlankVar
String[] analysis = rawExpression.split(operationIdentifier.toString());
// Identifica a operação realizada
Matcher operationMatcher = operationIdentifier.matcher(rawExp... |
c57eb331-c1ca-4a8d-907d-2e485fb3be27 | 1 | public String getSimpleCode(){
String str = "";
if(expression != null){
str += expression.getSimpleCode() +
this.printLineNumber(true) +
identifier.getNewName() + " := " + expression.place + "\n";
}
return str;
} |
800d26e8-40c4-448c-935b-c2af7084cdd3 | 3 | @Override
public Map<String, Integer> getIngressoDisponiveis(Evento evento){
Map<String, Integer> ingresso = new HashMap<>();
try{
conn = ConnectionFactory.getConnection();
String sql = " SELECT secao.nome " +
" ,count(ingresso.id) AS ingr... |
d2674720-aebf-48ed-9482-25d09d680f6a | 5 | public boolean close() {
if (!isOpen()) {
return true;
}
Widget close = ctx.widgets.getValidated(new Filter<Widget>() {
@Override
public boolean accept(Widget element) {
return element.getParentId() == WIDGET_ID && element.getId() == CLOE_COMP_... |
dd1ecb7e-e3f2-40ae-9a34-fd746cf25634 | 5 | void jMenuItem_zoom_actionPerformed(ActionEvent e) {
int zoomFactor = 0;
if (e.getSource() == jMenuItem_zoom1)
zoomFactor = 1;
else if (e.getSource() == jMenuItem_zoom2)
zoomFactor = 2;
else if (e.getSource() == jMenuItem_zoom4)
zoomFactor = 4;
else if (e.getSource() == jMenuItem_zoom8)
zoomFactor... |
a7272516-e208-42ba-99be-4a6af4aaf35e | 5 | protected static boolean isFlacSpecial(OggPacket packet) {
byte[] d = packet.getData();
byte type = d[0];
// Ensure 0x7f then "FLAC"
if(type == 0x7f) {
if(d[1] == (byte)'F' &&
d[2] == (byte)'L' &&
d[3] == (byte)'A' &&
... |
3de726c2-cf36-42bb-9328-4bd5ec487ca8 | 2 | public static List<Utilisateur> selectUtilisateur() throws SQLException {
String query = null;
List<Utilisateur> util = new ArrayList<Utilisateur>();
ResultSet resultat;
try {
query = "SELECT * from UTILISATEUR ";
PreparedStatement pStatement = (PreparedStatemen... |
3008f6f4-10a9-4f93-a2bb-35b346e84e4e | 8 | private void handleSpecialistQueues() {
for (int i = 1; i < 8; i++) {
HospitalPart hp = HospitalPart.values()[i];
Sector sec = sectors.get(hp);
LinkedBlockingDeque<Patient> q = doc_queues.get(hp);
if (sec.hasBusyDoc()) {
int[] tmp = sec.getFinishTimes();
for (int j = 0; j < sec.getDocCount(); j++... |
f48878bd-84d0-4bed-a8a9-65ebffc3c386 | 3 | public static void addStock(String uid, String id, int amount) {
if(checkUserExistance(uid))
{
stocks = UserControl.getUserStock(uid);
if (stocks.containsKey(id)) {
stocks.put(id, stocks.get(id) + amount);
} else {
stocks.put(id, amount);
}
t... |
d53c1da6-3a6e-4902-97d3-a03c07e45817 | 9 | private void calcG(int choice) {
/* calculates the g values. choice parameter is the stage selection */
int index, grstep, i;
double d2;
switch (choice) {
case 1:// initialization
for (i = 0; i < ngr; i++) {
g[i] = 0.0;
}
... |
b27b6084-f151-4e9a-9d4e-5e1de9c14061 | 4 | /*Update Permissions*/public boolean changePermissions(String username, PermissionsList list){
try{
if(username.length() > 40)return false;
select1.setString(1, username);
ResultSet rs = select1.executeQuery();
while(rs.next()){
if(rs.getString("username").equals(username)){
updatePermissi... |
7a02c097-70bc-407b-bf7d-70e75fe8d557 | 1 | public String getRoomNames(){
Set<String> keys = chatRooms.keySet();
StringBuffer ret = new StringBuffer(keys.toString().length()+11);
ret.append("Chat rooms: [");
for (String key : keys){
ret.append(""+chatRooms.get(key).getName()+", ");
}
ret.delete(ret.leng... |
7f102be1-db33-4065-a7b5-e6272c16a2c7 | 9 | static private DamageCause[] getTypes() {
if (typecache != null) return typecache;
List<DamageCause> causes = new ArrayList<DamageCause>();
Field[] materialFields = DamageCause.class.getFields();
for (Field f : materialFields) {
try {
Object got = f.get(null);
if (got instanceof DamageCause) {
... |
c515e677-170a-4f23-8d5e-a99828da43df | 0 | public void showPauseMenu(){
pauseMenu.show();
} |
64b4078e-73d2-4ad5-a447-989018514503 | 5 | @Override
public String toString()
{
String result = "";
if(useShift)
{
if(System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0)
result+='\u2191';
else
result+="SHFT";
}
if(useControl)
result+="CTRL";
if(useMeta)
result += "\u2318";
for(int x : shortcuts)
{
result += ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.