method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e7f9a2ef-0a19-47e6-a8ae-3dfd2b012d60 | 6 | private static Member getMember(Element data) {
String name = getTextValue(data, "name");
String type = data.getAttribute("type");
String bs;
int id, width, height;
int bx, by, bw, bh;
width = getIntValue(data, "width");
height = getIntValue(data, "height");
Bounds b;
if (getTextValue(data, "bound... |
acf46226-b697-4626-9789-778db072875d | 1 | @Override
public boolean moveable(Direction direction) {
if (getRemainingActions() <= 0)
return false;
return true;
} |
8f03a6fe-eaf5-4966-a4d8-82dce00b3119 | 4 | public void buttonClicked(int ID)
{
switch (ID)
{
case 0:
count++;
if (count > limit)
{
count = limit;
}
else parent.amountIncremented(id);
break;
case 1:
count--;
if (count < minimum)
{
count = minimum;
}
else parent.amountDecremented(id);
break;
}
} |
bffb621d-002c-4872-b0ff-17f64ae9fbbe | 4 | public static void main(String[] args) {
File f;
// If given, attempt to open the file given as a command line parameter
switch (args.length) {
case 1:
f = new File(args[0]);
if (f.exists() && f.canRead()) {
break;
} else {
System.err.println(args[0] + "does not exist at the specified"
+... |
93e6e6d7-c376-493e-bf62-6b0ba0e3422d | 6 | private static void process(String dbName, ConfigEntry configEntry) {
System.out.println("\tStart " + dbName);
Console console = System.console();
String dbUser = "";
while (dbUser.trim().equals("")) {
dbUser = console.readLine("Enter %s database login: ", dbName);
... |
c7347cb6-b6e7-43d2-833f-c91d89a282d4 | 8 | BitMatrix buildFunctionPattern() {
int dimension = getDimensionForVersion();
BitMatrix bitMatrix = new BitMatrix(dimension);
// Top left finder pattern + separator + format
bitMatrix.setRegion(0, 0, 9, 9);
// Top right finder pattern + separator + format
bitMatrix.setRegion(dimension - 8, 0, 8,... |
1aecb6ac-a707-4065-9654-1c7d83100700 | 1 | @Override
public boolean endCondition()
{
Color last = lastStanding();
return last != null || getDay() > 30;
} |
8ceb3a45-424f-48f1-ba25-16b4796a7709 | 6 | private static AlignmentCell getACel(int x, int y, int affinePenalty,AlignmentCell[][] cels,
float gapPenalty, SubstitutionMatrix sm, String s1, String s2)
throws Exception
{
float top = Float.NEGATIVE_INFINITY;
float left = Float.NEGATIVE_INFINITY;
if( affinePenalty >0 ) // linear gap
{
top... |
c51f5c6b-1a09-4d63-8056-98b77e122383 | 0 | public void setHint(String hint) {
this.hint = hint;
} |
0b1a5e16-ca62-4b95-81fb-9e3d6c0a9c92 | 8 | public static String stringFor_cl_mem_object_type(int n)
{
switch (n)
{
case CL_MEM_OBJECT_BUFFER: return "CL_MEM_OBJECT_BUFFER";
case CL_MEM_OBJECT_IMAGE2D: return "CL_MEM_OBJECT_IMAGE2D";
case CL_MEM_OBJECT_IMAGE3D: return "CL_MEM_OBJECT_IMAGE3D";
ca... |
2168cb57-161d-464f-9fd6-d170f7263491 | 0 | @Deprecated
@MethodInfo(comments = "deprecated method", date = "Nov 17 2012")
public static void oldMethod() {
System.out.println("old method, don't use it.");
} |
ac55e0fc-d7f9-46c8-aeb4-d9e3fef04951 | 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... |
c12158ea-c2e3-4869-8d88-14454de524dc | 4 | public void run(){
for(;;){
try{
Thread.sleep(1000*60*5);
}catch(InterruptedException e){
//no problem, really
}
synchronized(cache){
for(Entry<String, SoftReference<U>> ent : cache.entrySet()){
if(ent.getValue().get() == null){
cache.remove(ent.... |
1b3d0b52-2ddc-462a-b968-1af75107c505 | 9 | public double associationAttributeClasses(double[][] counts){
List<Integer> supportSet = new ArrayList<Integer>();
List<Integer> not_supportSet = new ArrayList<Integer>();
double discriminatingPower = 0;
int numValues = counts.length;
int numClasses = counts[0].length;
int total = 0;
d... |
0f1d7700-48a5-4a74-9e82-4faf91e1cb54 | 1 | protected void processValueChangeEvent(ValueChangeEvent e) {
if(valueChangeListener != null) {
valueChangeListener.valueChanged(e);
}
} |
be83bfa0-a7d7-4e1a-bee5-9f3cd61b91c5 | 6 | private String getFile(String link)
{
String download = null;
try
{
// Open a connection to the page
URL url = new URL(link);
URLConnection urlConn = url.openConnection();
InputStreamReader inStream = new InputStreamReader(urlConn.getInputStrea... |
355a0f6f-0575-4cf7-b7cb-8c3c108325ab | 5 | static long permutation(int [] A, int n, int v){
long count = 0; // Let count be the number of all possible permutations in P(n,k)
Arrays.sort(A); // Sort the array in lexical order
do{
count = visit(A, n, v, count); // visit A[1...n]
// Find the max j with A[j] > A[j+1], scanning from... |
3103a9a0-4855-46d6-ac52-12ec711ec83f | 7 | private void handleQueryTime(Sim_event ev)
{
int src = -1; // the sender id
boolean success = false;
int tag = -1;
int transID = -1;
try
{
ARObject obj = (ARObject) ev.get_data();
double userZone = obj.getTimeZone();
double resZo... |
75f1c29b-9710-48c0-a11e-011e5d39a437 | 8 | private static void move(int p, int s, int f) {
int start = s;
int finish = f;
int loops = (finish - start) / 13;
if (p == 0) {
if (finish == 13) { finish++; }
if (finish <= 12) {
fillBeans(start + 1, finish);
} else {
... |
9bf42da9-fcc0-451f-aa8b-4b9601520ba6 | 0 | public void setDirection(int direction) {
this.direction = direction;
} |
0e6f70af-dab1-48b6-a4a8-e2ae41b3a127 | 0 | public void setSeatNumber(String value) {
this._seatNumber = value;
} |
bd648fa9-2887-461a-8bf6-3663a0deeffa | 4 | public Image getIcon(int iconKind) {
switch (iconKind) {
case ICON_COLOR_16x16:
return iconColor16;
case ICON_COLOR_32x32:
return iconColor32;
case ICON_MONO_16x16:
return iconMono16;
case ICON_MONO_32x32:
... |
f116fd39-6a65-4a8d-8359-5ebce3e5885d | 9 | @Override
public double[] calculateJulia3DWithPeriodicity(Complex pixel) {
iterations = 0;
check = 3;
check_counter = 0;
update = 10;
update_counter = 0;
period = new Complex();
Complex[] complex = new Complex[2];
complex[0] = new Complex(pixel);//... |
ea9d3502-650d-4989-bf55-e4bd89f98de2 | 3 | public static void main(String[] args) throws Exception {
try {
Locale.setDefault(Locale.US);
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) { /* Failure is somewhat unimportant. */
}
if(!isDevelopmentEnvironment()) {
// We only need to manually load the libr... |
16e4726f-e637-4f60-9938-45aaa32b4bce | 0 | public static RuntimeException wrapException(String message,
Exception exception) {
return new RuntimeException(message, exception);
} |
5cf19941-7a52-49bf-b48f-4b25225e88e2 | 8 | public static Surrogate internLogicObjectSurrogate(Symbol name) {
if (!((Module)(Stella.$MODULE$.get())).clearableP()) {
{ OutputStringStream stream000 = OutputStringStream.newOutputStringStream();
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.se... |
fc82dc8f-e6d4-4ebc-89b3-cb61f649511a | 7 | public static void main(String[] args) {
final double EPSILON = 0.00000001;
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
while (n != 0) {
boolean found = false;
long a = 0;
long c = 0;
enumerate: {
for (a = 1; a < 4000; a++) {
// a is greater than c
// a, c cann... |
123799f7-e11a-4cca-b893-a25eb9c1ad87 | 8 | public void gestionDuClavier(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.VK_RIGHT && serpent.getDirection() != Direction.VERS_LA_GAUCHE) { // touche flèche droite
serpent.setDirectionTmp(Direction.VERS_LA_DROITE);
} else if (event.getKeyCode() == KeyEvent.VK_LEFT && serpent.getDirectio... |
29e39ea6-52a4-4b96-89a4-69b2dab4c75e | 3 | public void checkConsistent() {
super.checkConsistent();
if (subBlocks[0].jump != null
|| subBlocks[0] instanceof SequentialBlock || jump != null)
throw new alterrs.jode.AssertError("Inconsistency");
} |
7099b026-dff8-489a-b3e6-fc6aca2fb3d8 | 5 | @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
PrintWriter out = res.getWriter();
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
String deviceToken = req.getParam... |
53ff369a-81e1-4019-a9ec-ed25c286e71c | 1 | private void resaveParamsSaveCountry(SessionRequestContent request) {
Country currCountry = (Country) request.getSessionAttribute(JSP_CURRENT_COUNTRY);
if (currCountry == null) {
currCountry = new Country();
currCountry.setDescription(new Description());
}
currCou... |
15cbe8ab-b6cb-41a2-9564-384e6db57ded | 2 | @Override
public void run() {
Job job = null;
try {
while ((job = manager.getNextJob()) != null) {
job.run();
}
} catch (InterruptedException e) {
BukkitCLI.getPlugin().getLogger().info("Worker stopped. Thread interrupted.");
}
} |
3b40c6d1-1027-40db-ad2f-5288d5c455c4 | 3 | private void addChildrenToHeuristicMap(Map <Integer, Integer> heuristicMap) {
for (TrieNode child : this.children.values()) {
Integer weight = heuristicMap.get(Integer.valueOf(child.getId()));
if (weight == null) {
try {
heuristicMap.put(Integer.valueOf(child.getId()), Integer.valueOf(child.g... |
69a61dc6-801a-478d-b795-cb6fd87898bc | 9 | final private boolean jj_3R_17() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_21()) {
jj_scanpos = xsp;
if (jj_3_5()) {
jj_scanpos = xsp;
if (jj_3R_22())
return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos)
return false;
}
else if (jj_la == 0 && jj_scanpos == jj_lastpos)
retu... |
c83452d0-87e8-4145-ab67-5caa726b517d | 4 | void insertBars(Ladder ladder, Coordinate leftPoint, Coordinate rightPoint) {
// int에서 1을 빼는 로직을 for문의 조건으로 넣었다. 개선의 여지가 있을까...
for (leftPoint.getX(); leftPoint.getX() < columns - 1; leftPoint.incrementX()) {
for (leftPoint.getY(); leftPoint.getY() < columnLength; leftPoint.incrementY()) {
System.out.println... |
a1f0d89a-6eaa-4435-ad21-152883a2edb3 | 9 | private boolean solute(char[][] board, int left)
{
if (left == 0) return true;
Set<Integer> cset = null;
int min = 10;
int x =0;
int y =0;
for (int i = 0; i< 9;i++)
{
for (int j = 0; j<9; j++)
{
if (board[i][j] == '.')
{
Set<Integer> tmp = findSuitSet(i, j);
if (tmp.size() == 0) r... |
df6fd8b0-c8f7-41c4-b658-e179874eec09 | 4 | @Override
public CardCheckResult check() {
CardCheckResult result = CardCheckResult.OK;
if(super.check() != CardCheckResult.OK) {
result = super.check();
} else {
Calendar calendar = Calendar.getInstance();
int today = calendar.get(Calendar.DAY_OF_WEEK);
... |
e46a8afd-8732-4aaa-a63e-c48b60cefc03 | 6 | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... |
56cdde94-a9d3-48b9-9704-c5a6041a6951 | 5 | public ErrorTypeGUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 539, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 537, 271)... |
fe8eba72-0220-4224-9dac-3ab2289a0424 | 2 | public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 4){
System.err.println("Usage: <int> <out> <clusterIDMap> <k>");
System.exi... |
1c52ee29-6cf1-4c4b-8795-c41db8664b7f | 1 | public boolean InsertarActividad(Actividad p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
b571713f-a22c-4535-b220-b6898c8ac3e3 | 1 | public InputStream openClassfile(String classname) {
String cname = classname.replace('.', '/') + ".class";
ClassLoader cl = (ClassLoader)clref.get();
if (cl == null)
return null; // not found
else
return cl.getResourceAsStream(cname);
} |
8fd9a916-7157-404b-9ecb-906b3cde016c | 9 | public static String getUrlRegex(String url1, String url2){
StringBuilder firstPart = new StringBuilder();
StringBuilder secondPart = new StringBuilder();
int i=0;
if (url1.length()<url2.length()){
for (; i<url1.length(); i++){
if(url1.charAt(i)==url2.charAt(i)){
firstPart.append(url1.charAt(i));
... |
6bc52c72-0bb5-45b1-b207-045e2b3eae84 | 1 | public Card getCard() {
if (card == null)
card = new Card();
return card;
} |
182554b3-8ee4-4a2c-8e98-391af60a7735 | 0 | public int getMATK() {
return mAtk;
} |
e3c4fbc9-a140-45c3-8072-234dc9842c4b | 3 | public static void handleLogIn(User newUser) {
user = newUser;
titleField.setText(titleField.getText() + "| Logged in as: " + newUser.fullName);
removePanel();
switch (user.utype){
case Student:
//Load the Student StudentGUIPanel
... |
cb9db2d8-9de0-4cde-8603-1226a8d98916 | 1 | public void visitEnd() {
super.visitEnd();
if (fv != null) {
fv.visitEnd();
}
} |
ef7aaf31-93cc-411b-98b6-96e407fad6d4 | 8 | public void comb_filter(final float[] exc,
final int esi,
final float[] new_exc,
final int nsi,
final int nsf,
final int pitch,
final float[] pitch_gain,
... |
387e16d0-cff0-463f-8591-cae17cc71609 | 5 | public void save() {
String savePath = new Control_GetPath().getStreamRipStarPath();
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
int[] intOptions = new int[12];
String[] strOptions = new String[7];
try {
XMLEventWriter writer = outputFactory.createXMLEventWriter(
new FileOutp... |
c1cb9060-f674-4eec-a0a6-56f1b5e1dbf4 | 5 | @Override
public final boolean equals(final Object object) {
if (object == this) return true;
if (!(object instanceof FEMType<?>)) return false;
final FEMType<?> data = (FEMType<?>)object;
return this._id_ == data._id_;
} |
0e1d0482-ee97-4e61-84a6-31bb8d87bc20 | 3 | public byte[] getPacket() {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
long longLength = currentFile.length();
int dataLength = (int) longLength;
if (dataLength != longLength)
throw new IOException("File size >= 2 GB");
byte[] data = ... |
f2100c72-17b5-45b3-bf46-776130c32a33 | 4 | public static int findMin(int[] arr, int biggerThan) {
int tmp = 0;
int idx = -1;
for (int i = 0; i < arr.length; i++) {
if (i == 0) {
tmp = arr[i];
} else {
if (arr[i] < tmp && arr[i] > biggerThan) {
tmp = arr[i];
idx = i;
}
}
}
return idx;
} |
aa6df419-d9c5-4225-a8fc-dc7907f363cc | 1 | protected AudioFormat getAudioFormat() {
if (fmt == null) {
Decoder decoder = getDecoder();
fmt = new AudioFormat(decoder.getOutputFrequency(),
16,
decoder.getOutputChannels(),
true,
false);
}
... |
070b4f28-fcc4-4e5b-b912-a37f6b614e99 | 6 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
HttpSession sesionOk = request.getSession();
if (sesionOk.getAttribute("usuario") != null) {
String alert="";
response.setContentT... |
ffd2e0a3-0a27-4609-8f3a-e825a8649963 | 5 | public byte[] getEncoded() {
try {
byte[] versionBytes = new byte[]{(byte) majorVersion,
(byte) releaseVersion};
BERTLVObject versionObject = new BERTLVObject(VERSION_LDS_TAG,
versionBytes);
byte[] tagListAsBytes = new byte[tagList.size()];
for (int i = 0; i < tagList.size(); i++) {
int dgTag... |
e0016720-5ecd-45dc-bb32-c90c826a3ae1 | 8 | public void copyValuesByName(VariableMap source) {
if (source == null)
return;
for (int i=0; i<source.getSize(); i++) {
Variable sourceVar = source.get(i);
if (sourceVar.getName() != null) { //has name?
Variable target = this.get(sourceVar.getName());
if (target != null) {
//Constraint
ta... |
31f20a81-35c3-4810-991b-7f2f027aa1c8 | 8 | public void setFont (Font value) {
checkWidget ();
Font oldFont = getFont ();
super.setFont (value);
Font font = getFont ();
if (font.equals (oldFont)) return;
GC gc = new GC (this);
/* recompute the receiver's cached font height and item height values */
fontHeight = gc.getFontMetrics ().getHeight ();
se... |
75de22d9-5ab2-440d-b7be-a343dcfe7894 | 8 | private int getCellSize(int x, int y) {
int width = 0, height = 0;
for(int w= x; w < Img.getWidth(); w++){
int c = Img.getRGB(w, y);
if(!Color.isDark(c)) {
width++;
} else break;
}
for(int w= x; w > 0; w--){
int c = Img.getRGB(w, y);
if(!Color.isDark(c)) {
width++;
}... |
49fb406c-fe56-4816-b971-022d9ce87756 | 4 | public Long create(String name) {
boolean isCreated = false;
Long genre_id = -1L;
if (DataUtils.isEmpty(name)) {
logger.warn("Contains null fields");
} else {
try {
prepSt = prepStatements[CREATE_GENRE];
prepSt.setString(1, name.toL... |
65b63ba4-fb3b-406d-8b97-22ef69560a1c | 4 | public void initialize() throws ResourceInitializationException {
File collectionFile = new File(((String) getConfigParameterValue(PARAM_INPUT)).trim());
mLanguage = (String) getConfigParameterValue(PARAM_LANGUAGE);
mCurrentIndex = 0;
mNumberOfLines = 0;
docsArray = new ArrayList<String>();
... |
da43e655-fa14-4e2f-90e7-41a28bf94ce0 | 2 | public void save() throws SQLException {
Map<String, String> values = new HashMap<String, String>();
values.put("initiatorId", String.valueOf(initiatorId));
values.put("name", name);
values.put("venueId", String.valueOf(venueId));
values.put("startTime", String.valueOf(startTime));
values.put("endTime", Str... |
cda09aed-4572-49e0-b006-f96ff746d896 | 0 | public long getRunTime()
{
return endTime - startTime;
} |
c4caf240-d9ee-4838-aae4-dad1eb16d60a | 9 | public static String getWebpageTitle(String s) {
//Stolen from https://github.com/zack6849/Alphabot/blob/master/src/com/zack6849/alphabot/Utils.java :3
String title = "";
String error = "none!";
try {
Document doc = Jsoup.connect(s).userAgent("Mozilla/5.0 (Windows NT 6.2; WOW... |
d7a82823-bd38-45f3-8c2c-b1ab28d163a6 | 6 | private void removeFoundNode(TreeNode removingNode) {
TreeNode parentNode;
if (removingNode.left == null || removingNode.right == null) {
parentNode = removingNode;
} else {
parentNode = successor(removingNode);
removingNode.value = parentNode.value;
... |
1a03bc20-bff8-48d7-aa73-824ca8b4a05c | 4 | public static String guessFileExtension(String contentType){
switch(TranslateContentTypeToEnum(contentType)){
case TURTLE:
return "ttl";
case RDF:
return "rdf";
case NT:
return "nt";
case N3:
return "n3";
default:
return "txt";
}
} |
338c9a1c-896d-4290-87b5-6f1f0231aaf5 | 5 | @Override
public void actionPerformed(ActionEvent e)
{
System.out.println("Button clicked");
JButton source = (JButton) e.getSource();
switch (source.getName())
{
case "Add":
add();
break;
case "Remove":
remove();
break;
case "Finish":
finish();
break;
case "Management":
... |
8a4e4eeb-e0ec-4e95-88c0-3ed6ef4af401 | 8 | public ListNode Solution(List<ListNode> lists) {
if(lists == null || lists.size() == 0){return null;}
//Ok, the idea is using PriorityQueue to solve this list
//First, let's make a priorityqueue with modified Comparator to compare the value of the nodes inside the list
... |
3f6550e9-b6c8-4169-b30d-b282490abf6d | 6 | private void queryToSave() {
if (saveItem.isEnabled() && file != null || file == null
&& saveAsItem.isEnabled()) {
if (JOptionPane.showConfirmDialog(null,
"Data Changed. Want to save?", "Save?",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
if (file != null)
saveDesign(file);
e... |
55987511-d3d5-404b-a0d5-f8fd8f19b046 | 9 | public int[] getRooms(String name, int low, int high, String world)
{
freeRoom = "";
// i[0] ist die anzahl aller zimmer
// i[1] ist die anzahl belegter zimmer
// i[2] ist die anzahl freier zimmer
int i[] = new int[3];
// HotelCount is just checking ... |
f0125370-0106-4255-a924-6f3e480ad5d9 | 1 | public void unregisterClassLoader(ClassLoader cl) {
synchronized (registeredCLs) {
ScopedClassPool pool = (ScopedClassPool)registeredCLs.remove(cl);
if (pool != null)
pool.close();
}
} |
726f9bb9-e755-4998-a652-ea17939225fc | 1 | public Uhash(final int num, final int bits, final int range) {
super(num);
Random rnd = new Random(SEED);
this.bits = bits;
int len = num * bits;
this.lut = new Integer[len];
for (int i=0; i<len; i++) lut[i] = rnd.nextInt(range);
} |
101584ed-92ed-4bc6-ae40-4968de891eee | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Language)) {
return false;
}
Language other = (Language) object;
if ((this.key == null && other.key != null) ||... |
158b5f29-f247-4dab-bf06-56df41bb0c9f | 5 | public int drawNames(String[] names, Screen screen, Integer y) {
List<Vector<String>> data = new Vector<Vector<String>>();
data.add(new Vector<String>());
data.add(new Vector<String>());
for (int i = 0; i < names.length; i++) {
String string = names[i];
if (i % 2 == 0) {
Vector<String> tmp = data.get(... |
1ec96bc9-e7a7-4f38-820c-2a03bdd710b8 | 7 | public void render()
{
ArrayList<Integer> indexes = new ArrayList<Integer>();
for(int i=0,stop=tiles.size();i<stop;i++)
{
if(tiles.get(i).getY()+32<720+32 && tiles.get(i).getX()+32<1280+32 && tiles.get(i).getY()>-32 && tiles.get(i).getX()>-32)
{
tiles.get(i).render();
if(tiles.get(i).isOverlayable(... |
19c02a85-ce6a-4562-942f-46735502ca9f | 1 | public void deletePlayerFromTeam(String userName){
try {
cs = con.prepareCall("{call DELETE_PLAYER_FROM_TEAM(?)}");
cs.setString(1, userName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
191dfbbb-b716-42d4-92bf-34c84194969d | 0 | public String toStringHHMMSS() {
return String.format("%02d%02d%02d", hora, minuto, segundo);
} |
5a2f63cc-ec43-4555-b9f6-f633115ddf2e | 4 | private void visitComments(CompilationUnit node) {
List comments = ((CompilationUnit)node).getCommentList();
if (comments != null) {
for (int i=0; i < comments.size(); ++i) {
Comment comment = (Comment) comments.get(i);
if (comment != null && comment.getParent() == null)
comment.accept(this);
}
... |
2408cb65-b629-459b-969c-33acc0444924 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In monument handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
exchange.getResponseHeaders().set("Content-Type", "appliction/json");
try {
//TODO veri... |
9ff8f8c2-34ce-427a-af37-4273a0d54fd8 | 7 | @Override
public void onUnlockFile(String path, long byteOffset, long length,
DokanFileInfo arg3) throws DokanOperationException {
try {
FileHandle handle;
synchronized (handles)
{
handle = handles.get(arg3.handle);
}
if (handle == null)
throw new DokanOperationException(net.decasdev.dokan.... |
d51ec797-9180-40c2-8f1c-156454ebb0f8 | 1 | public boolean removeAll(final Collection<?> c) {
return queue.removeAll(c);
} |
263f81d7-f564-489a-97b4-df84c2d526f3 | 6 | public static void loadSpriteAnimationStatesAndAttributes(String pathToSprite,
String xmlOfSpriteType,
ArrayList<String> animationStates,
ArrayList<String[][]> animationAttr... |
7b9eb3ec-8cfe-49e5-9c0c-45ce25c21b68 | 7 | public static void main(String[] args){
int numberOfRounds = 5000;
int messagesPerRound = 5;
int port = 0;
String filename = "";
if (args.length == 2) {
port = Integer.parseInt(args[0]);
filename = args[1];
}
else if (args.length == 4){
port = Integer.parseInt(args[0]);
filename = args[1];
... |
5060a48d-7f9b-4c1e-89fb-7adc831af90d | 9 | protected static double[] getValuesFromObjects( Object[] pthings ) throws NumberFormatException
{
double[] returnDbl = new double[pthings.length];
for( int i = 0; i < pthings.length; i++ )
{
// Object o = pthings[i].getValue();
Object o = pthings[i];
if( o == null )
{ // NO!! "" is NOT "0", blan... |
3d4e7201-ac95-47a6-a2e3-988b44b438b0 | 9 | public int[][] generateMatrix(int n) {
int line[] = new int [4];
line[0]= line[1]=line[2]=line[3]=0;
int direction = 0;
int [][]result = new int [n][n];
int i=0, j=0,num=1;
while (num<=n*n){
result[i][j]=num;
num++;
switch (direction){
... |
e13f803f-83d8-418c-9838-c69bdf65cd29 | 8 | private Command parse(String userInput)
{
if (userInput == null)
{
return null;
}
StringTokenizer tokenizer = new StringTokenizer(userInput);
if (tokenizer.countTokens() == 0)
{
return null;
}
CommandName commandName = null;
String userName = ... |
64d8b8f5-6ed4-482e-a766-be5b8f2ab060 | 7 | @Override
public Object getValueAt(int row, int col) {
FindReplaceResult result = getResult(row);
if (col == 0) {
int type = result.getType();
if (type == FindReplaceResult.TYPE_DOC) {
return result.getDocument().getTitle();
} else if (type == FindReplaceResult.TYPE_FILE) {
return result.getFil... |
1cb52b3b-11b4-4849-a4a1-3b8679bf51cf | 9 | private void addJumpMoves(CkMove m, int sx, int sy, boolean kingFlag) {
// Determine the range of directions to examine. If not a king,
// they can only move forward.
int startD = 0;
int endD = 4;
if (!kingFlag) {
startD = (plrTurn == 0 ? 0 : 2);
endD = startD + 2;
}
// Save the current move to... |
256e26b7-a9c1-4e50-9ce1-acab5f792b26 | 5 | @EventHandler
public void onCommand(PlayerCommandPreprocessEvent e){
Player player = e.getPlayer();
UtilPlayer u = CookieSlap.getCookieSlap().pm.getPlayer(player);
if(u.getGame() != null && u.isAlive()){
if(!e.getMessage().startsWith("/cslap") && !(player.isOp() || player.hasPermission("cookieslap.admin"))... |
99850676-2d70-41a7-bcbd-b8cbe5bd3a53 | 1 | public final static BufferedImage loadImage(String filePath) {
BufferedImage loadedImage = null;
try {
loadedImage = ImageIO.read(FileManager.class.getResource(filePath));
} catch (IOException e) {
logger.error("Failed loading an image :: ", filePath);
}
return loadedImage;
} |
2da2a259-85f5-4f5b-b01e-818212501b1d | 7 | private Tree234Node split(Tree234Node node) {
int key = node.key2;
Tree234Node child1 = new Tree234Node(null, node.key1);
child1.child1 = node.child1;
child1.child2 = node.child2;
Tree234Node child2 = new Tree234Node(null, node.key3);
child2.child1 = node.child3;
child2.child2 = node.child4;
if ... |
42fab1ca-fece-4b54-b9cd-17e508a0d9a6 | 7 | public void processReadPackets()
{
if (this.sendQueueByteLength > 1048576)
{
this.networkShutdown("disconnect.overflow", new Object[0]);
}
if (this.readPackets.isEmpty())
{
if (this.timeSinceLastRead++ == 1200)
{
this.netwo... |
28aa0fb9-9e9b-4609-99e2-54cf6b019f3f | 6 | @Override
public Command planNextMove(Info info) {
// TheGameView.
if (info.getEnemies().size() > 0) {
InfoDetail ui = info.getEnemies().get(0);
double myp = info.getX()+info.getY();
double range = ui.getX()+ui.getY();
double max_prvni = Math.abs(myp - range);
System.out.print(myp+" "+ma... |
63423c6e-25e3-479b-8ee3-54d6920e93f2 | 5 | public void setClassesAsAttributesOrEnums() {
for(ClassMeta c : EntityMeta.all_classes.values()) {
c.setAttribute();
System.out.println("Id: " + c.id + "Name: " + c.name + " Attr: " + c.is_attribute + " Enum: " + c.is_enum);
if(c.is_attribute)
handleClassThatIsAttribute(c);
if(c.is_enum)
handleCla... |
9fe8f676-3607-4326-8bef-f6b1a0ea68f7 | 3 | private ArrayList<ArrayList<Integer>> helper(int[] candidates, int from, int target) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (target == 0) {
result.add(new ArrayList<Integer>());
return result;
}
for (int i = from; i < cand... |
c46407ae-dd42-40f0-86b1-5db4ef0c9f38 | 1 | private void eliminarThread()
{
if (threadBusqueda != null)
threadBusqueda = null;
} |
58f0e9e6-fa87-489b-bc3d-ee83114d0558 | 0 | public void setToDate(String toDate) {
this.toDate = toDate;
} |
8514c131-4cb5-4f98-903d-0b248b061de2 | 7 | public void shoot() {
int dx = me.getCenterX() - me.getPlayer().getCenterX();
int dy = me.getCenterY() - me.getPlayer().getCenterY();
Random r = new Random();
if (Math.abs(dx) < Math.abs(dy)) {
if (dy < 0) {
if (r.nextInt(2) == 0) me.shoot(Direction.DOWN);
... |
88e0860e-732d-4bf6-aa48-5a07b9a39e7b | 8 | void optimise( UnattachedSet unattached ) throws MVDException
{
if ( incoming.size() == 1 && outgoing.size()==1
&& outgoingSet.equals(incomingSet) )
{
Arc a = incoming.get( 0 );
Arc b = outgoing.get( 0 );
if ( !a.isParent() && !a.isChild()
&& !b.isParent() && !b.isChild() )
{
char[] cData ... |
bf98897d-5bf7-4e6f-9b1f-447678998136 | 8 | public static void serializeCommit( Commit m, OutputStream os ) throws IOException {
boolean needDcNamespace = m.authorName != null || m.description != null || m.timestamp != Commit.TIMESTAMP_NONE;
OutputStreamWriter w = new OutputStreamWriter(os);
List<String> tags = Arrays.asList(m.tags);
Collections.so... |
680b905f-593c-4646-b4c0-da1435775206 | 5 | public static void connectHelper2(TreeLinkNode root){
if (root == null) return;
if (root.left != null &&root.right != null) {
TreeLinkNode rootLeft = root.right.left;
TreeLinkNode rootRight = root.left.right;
while (rootLeft != null && rootRight != null) {
rootRight.next = rootLeft;
rootRight = roo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.