method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5a86ef25-2818-41b9-98aa-f2414699a67d | 7 | public static void main(String [] argumentos) {
ObjectInputStream objeto =null;
try {
borrarPantalla();
objeto = new ObjectInputStream(new FileInputStream("ficheros/personasModificadas.dat"));
try {
Persona var=(Persona)objeto.readObject();
... |
9acc4d7a-96c8-432e-90b4-f2474f341358 | 2 | private static String encode(final String content, final String encoding) {
try {
return URLEncoder.encode(content, encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET);
} catch (UnsupportedEncodingException problem) {
throw new IllegalArgumentException(problem);
}... |
3d11a0c4-2ee8-4692-9da2-ff45584161d6 | 3 | public static void updateCompte(Compte compte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from compte where id_compte=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, compte.getId_compte());
... |
49786937-15f6-4a31-ab22-2f484c05212b | 3 | public static String[] arrangeAnagram (String[] aos) {
// 1. arrange the input date in a HashMap
HashMap<String, List<String>> hm = new HashMap<>();
for ( String ss : aos) {
String key = getKey(ss);
if ( !hm.containsKey(key) ) {
hm.put(key, new LinkedList<String>());
}
List<String> bucket ... |
4bee4b4e-8005-49a0-9f82-59d1ddd1f466 | 9 | protected void plan() {
isFinished = false;
//cancel already finished subgoals first
//most of the time, we won't get any units back from this
Iterator<Goal> git = subGoalList.iterator();
while (git.hasNext()) {
Goal g = git.next();
if (g.isFinish... |
a72a69fc-d8b4-438c-9108-fa69d2cb1c03 | 0 | protected int getMaxAge()
{
return MAX_AGE;
} |
5f9903ea-6838-4130-92ea-6de3a0703c40 | 2 | private static TPoint[] parsePoints(String string) {
List<TPoint> points = new ArrayList<TPoint>();
StringTokenizer tok = new StringTokenizer(string);
try {
while(tok.hasMoreTokens()) {
int x = Integer.parseInt(tok.nextToken());
int y = Integer.parseInt(tok.nextToken());
points.add(new TPoint(... |
acca4422-451f-4dcf-a6bd-feafc5198756 | 6 | public int hasVariable(Variable v){
// If this predicate has no variables we can directly return -1.
if(varNum == 0){
return -1;
}
boolean found = false;
int i = 0;
while(i < varList.size() && !found){
boolean this_isDef = (varList.get(i) instanceof DefaultVariable);
boolean v_isDef = (v ... |
d6307c8a-4fa0-4aca-939a-8475839f90b6 | 0 | public Knight(boolean isWhite, ImageIcon imgIcon) {
super(isWhite, imgIcon);
this.setIcon();
} |
f2869eb1-9382-4217-95b3-b108be62abe7 | 4 | public void generateCode(String fileLocation){
//Make a list of Strings and populate it with the generated code
//from the generator.
Vector<String> output = CodeGenerator.generateCodeForVectorOfClasses(components);
//for each string in the list (which is a file)
for (String file:output){
//find out the na... |
c6ff8d65-7175-4c39-aeb3-6024231df3f5 | 4 | private boolean doesWordContainLetter(String selection) {
int loc = -1;
int letterCount = -1;
// Check if the random word contains the selection
if (randomWord.contains(selection)) {
// If word was passed in check if it is right
if (randomWord.equals(selection)) {
isWinner = true;
displayWord... |
39e26fdc-acb3-47c4-adc9-8f1e09905be7 | 8 | private void buildRuleList(String[] readedHolder) {
for (int y = 0; y < valueArray.length; y++) {
if (readedHolder[y].contains("*")) {
ruleList[y] = new Rule(1);
} else if (readedHolder[y].contains("\"R")) {
if (readedHolder[y].contains(",.")) {
... |
346047fe-7240-4bff-9838-be6273c5376e | 3 | public void run() {
while (true) {
if (year!=w.year) {
year=w.year;
}
synchronized (this) {
repaint();
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
} |
f9cb7715-4887-41c4-a50c-217d8f8dfdfb | 2 | public void stats(){
int[] cycleLengths = new int[bucket.size()];
double[] activities = new double[bucket.size()];
double cycleLengthMean, activityMean;
int cycleLengthMedian, cycleLengthUQ, cycleLengthLQ;
double activityMedian, activityUQ, activityLQ, activityVar, activityStdDev, cycleLen... |
152d44f6-929c-49ef-ba50-472a0cd79b76 | 7 | public void delayRebirth() {
final Element element = this;
new Thread(new Runnable() {
public void run() {
try {
if (!active) {
Thread.sleep(rebirth_delay);
List<Integer> positions = Server.getPlayersPositio... |
c71de067-d7cd-42e0-ac09-14479b4c8dff | 8 | @SuppressWarnings("unchecked")
private void load() {
try {
Project lastProject = null;
Date lastEntryDate = new Date(0);
Object o = null;
if (new File(SAVE_FILE).exists()) {
ObjectInputStream ois = new ObjectInputStream(
new FileInputStream(SAVE_FILE));
o = ois.readObject();
ois.close... |
6793f804-f1ec-49b3-8eb8-79452484a155 | 1 | public void testToStandardHours() {
Period test = new Period(0, 0, 0, 0, 5, 6, 7, 8);
assertEquals(5, test.toStandardHours().getHours());
test = new Period(0, 0, 0, 1, 5, 0, 0, 0);
assertEquals(29, test.toStandardHours().getHours());
test = new Period(0, 0, 0, 0... |
7f30aa79-d44b-41bf-93b1-0a72b24ac333 | 5 | public Customer getCustomerForPallet(Pallet pallet) {
String sql =
"Select name, address "+
"from Orders,Customers "+
"where Orders.customerName = name and Orders.id = ? ";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.setLong(1, pallet.orderId);
} catch (SQLExceptio... |
f5a5892e-2dad-4b5c-8d57-e6ab0b87af1d | 5 | public void fireAddnewDestroyerPressed() {
destroyerType = null;
String id = txtId.getText();
if (id.isEmpty()) {
JOptionPane.showMessageDialog(null, "You must fill a name first!");
return;
}
if (ironDomeRadioButton.isSelected()) {
destroyerType = ironDomeRadioButton.getText();
} else if (shipRadio... |
be07a175-2ba4-4c2a-a5ca-2f44707e7034 | 2 | /* */ @EventHandler
/* */ public void onInventoryClick(InventoryClickEvent event)
/* */ {
/* 342 */ if (!(event.getWhoClicked() instanceof Player))
/* */ {
/* 344 */ return;
/* */ }
/* */
/* 348 */ Player p = (Player)event.getWhoClicked();
/* */
/* 350 */ if... |
e3977bfb-084b-49ec-8972-82aefa2976ff | 2 | public void updateButtons(LinkedList<ClickableObject> selection) {
for(ClickableObject selectable : selection) {
for(Ability ability : selectable.getAbilities()) {
addHability(ability);
}
}
} |
abc3145c-87a4-4252-afae-ccbcabdaa366 | 8 | public void putAll( Map<? extends Double, ? extends Float> map ) {
Iterator<? extends Entry<? extends Double,? extends Float>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends Float> e = it.next();
this.put( e.get... |
e86372f3-cb4a-438d-acd6-fec86f6ee2da | 1 | public void run() {
// The following line nullifies timestamp-diff-cache.
if (!useTimestampDiffCache){
apicaCommunicator.checkResultTimeStamps.clear();
}
apicaCommunicator.populate(metrics);
DumpToStdOut(metrics);
write... |
85de4cba-7b70-49a9-a6f5-9a3e0ad2b9a0 | 0 | public void setBlockSheet(int[][] blockSheet) {
this.blockSheet = blockSheet;
} |
81325920-7fc2-4e81-99d3-d45c2cbd862d | 8 | private boolean[] attsTestedBelow() {
boolean[] attsBelow = new boolean[m_numAttributes];
boolean[] attsBelowLeft = null;
boolean[] attsBelowRight = null;
if (m_right != null) {
attsBelowRight = m_right.attsTestedBelow();
}
if (m_left != null) {
attsBelowLeft = m_left.attsTestedBe... |
16fedbb6-59e7-4f5e-9715-95d2fbe48a5a | 7 | private boolean confirm() {
if (!checkAndSetUid(uidField.getText(), pageTextBox, dialog))
return false;
pageTextBox.setBorderType((String) borderComboBox.getSelectedItem());
pageTextBox.putClientProperty("border", pageTextBox.getBorderType());
pageTextBox.setBackground(bgComboBox.getSelectedColor());
pageT... |
b2a5568d-bc6a-4b57-935e-dfebf2f16b1f | 4 | private void indicateSelection(JPanel panel) {
if (panel == this.pnlDashboard) {
this.mntmDashboard.setEnabled(false);
}
else {
this.mntmDashboard.setEnabled(true);
}
if (panel == this.pnlProducts) {
this.mntmProducts.setEnabled(false);
}
else {
this.mntmProducts.setEnabled(true);
}
if (pa... |
fd56e4c6-0ef9-4627-926b-32b8a5e07d5d | 8 | public void pushSolution(String failedPath, Host[] updatedHosts, Host... failedHosts) {
ArgumentCheck.checkNotNull(failedPath, "Cannot broadcast a null failed path.");
ArgumentCheck.checkNotNull(updatedHosts, "Cannot broadcast a null list of updated hosts.");
ArgumentCheck.checkNotNull(failedHos... |
05825bff-6ece-4aed-908c-a33ad393a309 | 4 | public void compare(HashSet<Area> aAreas)
{
for (Area area : aAreas)
{
if (area == this) continue;
if (contains(area))
{
for (int tile : area.getTiles())
mTiles.remove(tile);
mBombs -= area.mBombs;
}
}
} |
b26a1853-177f-4c70-96c8-98426fcd3ed2 | 8 | public boolean crear(Object[] estructura) throws SecurityException{
String dir[]= (String[])estructura[0];
String dublin[]= (String[])estructura[1];
//try{
// crear un log
GregorianCalendar hoy = new Gre... |
4fd8bf35-fbf3-4de8-ba48-eaeab9b554b4 | 2 | public void testPropertyAddToCopyYear() {
LocalDate test = new LocalDate(1972, 6, 9);
LocalDate copy = test.year().addToCopy(9);
check(test, 1972, 6, 9);
check(copy, 1981, 6, 9);
copy = test.year().addToCopy(0);
check(copy, 1972, 6, 9);
copy = te... |
be77bbfe-5039-4382-8514-f6bc04c83a43 | 5 | private static int getMeasure(final String stem)
{
List<Letter> letters = PorterStemmer.getLetters(stem);
int m = 0;
int start = 0;
int length = letters.size();
if (length == 0)
{
return 0;
}
// if the last element is a vowel, skip it
... |
54fc5b33-ed22-4349-b3c1-5e44f0d2c3d6 | 0 | public InPackage( String targetPackage )
{
this.targetPackage = targetPackage;
} |
46fe8be3-a1c3-4ddd-b8db-30230c8c00d6 | 7 | private void findMaxMinCB(boolean max) {
double maxMin = (max)
? Double.NEGATIVE_INFINITY
: Double.POSITIVE_INFINITY;
Instances cBCurve = m_costBenefit.getPlotInstances();
int maxMinIndex = 0;
for (int i = 0; i < cBCurve.numInstances(); i++) {
Instance cur... |
7cd75524-b5e3-4349-89fc-bfd20410b812 | 1 | public Integer fetchInteger() throws InputMismatchException, NumberFormatException {
if(peek().isEmpty())
throw new InputMismatchException("There are no integer arguments to fetch from.");
else {
Integer i = Integer.valueOf(pop());
return i;
}
} |
e67df3bf-2da0-4a9f-a337-35b1bde5e0ee | 1 | public boolean ModificarProducto(Producto p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
0c05016b-22fa-489f-8c6f-876594aa1575 | 8 | void setVisibilityFlags(BitSet bs) {
/*
* set all fixed objects visible; others based on model being displayed note
* that this is NOT done with atoms and bonds, because they have mads. When
* you say "frame 0" it is just turning on all the mads.
*/
for (int i = 0; i < meshCount; i++) {
... |
ecf21487-3051-4c5b-ae7d-0bf7edc9bdad | 8 | @Test
public void testSubgroupsOrder(){
Collection<? extends Symmetry<Point4D>> subgroups;
Collection<? extends Symmetry<Point4D>> rotationsymsub;
Reflection4D extEl;
int subgroupCounter;
for (Symmetry4DReflection g : Symmetry4DReflection.getSymmetries()) {
subgroupCounter = 0;
subgrou... |
d84c14dc-fb1f-4722-8ded-224490198264 | 4 | private void teleportToMine() {
if (Util.inAuburyShop()) {
NPC aubury = NPCs.getNearest(Util.auburyId);
if (aubury.interact("teleport")) {
int time = 0;
while (!Util.inEssenceMine() && time <= 4000) {
time += 50;
Time.sleep(50);
}
}
}
} |
ceb23474-03dc-42ba-9097-68a5a5b348b4 | 3 | public static String display(char[][] array){
int k = 4;
String format = "%-3s";
String limit = " +"+new String(new char[array.length]).replace("\0","---+");
String deca = new String(new char[k]).replace("\0"," ");
String res = deca;
char row = 'A';
int line = 1;
//loop to display row letter
for(i... |
a11a2200-fcae-4e7c-8fbf-1c186a3b7d72 | 9 | public void setQueue2(FloatQueue t) throws MismatchException {
if (t == null)
throw new NullPointerException("the arg cannot be null");
if (q1 != null) {
if (t.getLength() != q1.getLength())
throw new MismatchException("queue 1 and 2 have different lengths!");
if (t.getPointer() != q1.getPointer())
... |
e0de6413-09cf-4568-a47f-b5119b5ba4e4 | 7 | public void keyPressed(KeyEvent e) {
super.keyPressed(e);
// ctrl key
if (e.getModifiersEx() == 128) {
switch (e.getKeyCode()) {
// s key
case 83 :
file.promptSave();
break;
// o key
case 79 :
if (file.promptOpen()) {
undoManager.discardAllEdits();
}
break;
// ... |
fe609a62-8a1a-433b-9262-a6631d385edf | 2 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Spel spel = new Spel();
List<logic.Onderwerp> onderwerpen = spel.getOnderwerpen();
spel.setOnderwerp(onderwerpen.get(1));
List<logic.Onderdeel> ondrln = spel.getOnderdele... |
9cd3e27f-9ddf-4215-836b-c2fca6ee5cfe | 7 | public BitSet diversify(List<Subset> neighborhood){
if(neighborhood == null)
return m_Sbest.subset;
BitSet result = new BitSet(m_numAttribs);
double [] counts = new double[m_numAttribs];
int numNeighborhood = neighborhood.size ();
for (int i = 0; i < m_numAttribs; i++) {
if(i == m_... |
2f218a1a-2844-4258-8cf8-08bf3276c069 | 0 | protected void onMode(String channel, String sourceNick, String sourceLogin, String sourceHostname, String mode) {} |
7d4526d6-fe51-40af-8281-949d552b9fef | 3 | public double getTFIDF(String termName, String document){
Term searchTerm = null;
for(Term term: tree){
if(term.getName().compareTo(termName.toLowerCase().trim()) == 0){
searchTerm = term;
}
}
if(searchTerm != null) {
termFrequency = ... |
46e1cc85-6738-4605-acff-d52e6af49820 | 9 | public boolean stageOne() {
int smallest = 0, index = -1;
ArrayList<Node> tempNodeList = new ArrayList<Node>(4);
ArrayList<Integer> distance = new ArrayList<Integer>(4);
// Initialise 4 slots in distance ArrayList to -1
for (int i=0; i<4; i++) {
distance.add(-1);
tempNodeList.add(new Node(-1, -1));
}
... |
9cabd4a1-1292-4e45-9869-0a6aa276a792 | 9 | public void keyReleased(KeyEvent ke)
{
try
{
if (ke.getKeyCode() == 38)
{
if ((ke.getSource() == this.jtfCommand_Broadcast) || (ke.getSource() == this.jtfCommand_Private) || (ke.getSource() == this.jtfTerminalCommand))
{
moveCommandUp();
}
}
else if (... |
72d3ba4f-f512-42f1-8508-e7cfbd86a929 | 7 | protected void encodePacket(OutputStream out, String sharedSecret, RadiusPacket request)
throws IOException {
// check shared secret
if (sharedSecret == null || sharedSecret.length() == 0)
throw new RuntimeException("no shared secret has been set");
// check request authenticator
if (request != null && ... |
f7026b15-fab2-4dcf-a49a-5b14e25de320 | 2 | public static void main(String args[]) {
NewThread3 ob1 = new NewThread3("One");
NewThread3 ob2 = new NewThread3("Two");
try {
Thread.sleep(1000);
ob1.t.suspend();
System.out.println("Suspending thread One");
Thread.sleep(1000);
ob1.t.resume();
System.out.println("Resuming thread One");
ob2.t.s... |
151e91c4-75f4-4c29-9fb7-c1ae17c0ca07 | 0 | public void setSkillName(String skillName) {
this.skillName = skillName;
} |
c191429d-787a-4692-bc0a-3c431d94bf35 | 0 | public Serializable getObject() {
return theMainObject;
} |
509fe733-828f-4bab-81d6-795420087c0a | 4 | private void postProduct() throws IOException {
if (!getTextArea().getText().isEmpty() && getTextField_name().getText().length() > 0) {
JSONObject postData = ApiUtil.fetchObject("products", getTextField().getText());
JSONObject result = postData.getJSONObject("result");
String name = result.get("name").toStr... |
fd6a92a6-bbc5-45dd-9c8e-16debec97fbb | 2 | private static int getTrackerId(Statement statement, String trackerName) throws SQLException {
int id = -1;
ResultSet resultSet = statement.executeQuery("select id from " + Settings.DB_TABLE_TRACKER + " where name like '"
+ trackerName + "' limit 1"); // SQL injection ?
if (resultSet.next()) {
... |
5ca5ccf8-daf5-49d2-82b7-7e3e7e009a94 | 4 | private void check() {
synchronized (ui) {
if (tgt && !wrapped.hasfs())
wrapped.setfs();
if (!tgt && wrapped.hasfs())
wrapped.setwnd();
}
} |
ace50de4-2e5e-4ff4-a050-fbf18019c1d1 | 6 | @Override
public String printStorage() {
String print = new String();
for (int i = 1; i <= aisleCount; i++) {
System.out.println(i);
Aisle aisle = (Aisle) manager.get("A" + i);
if (aisle == null) {
i++;
aisle = (Aisle) mana... |
53b13d28-26aa-4ccf-8a5c-72cb90e9a478 | 8 | public void init(File ff) {
try {
JarFile jf = new JarFile(ff);
System.out.println("------------------------------------------------------------");
String name = jf.getManifest().getMainAttributes().getValue("plugin-name");
String verStr = jf.getManifest().getMain... |
9ee88142-1b43-4f9b-a76c-7565ffb6542a | 9 | public static synchronized BufferedImage layoutAndRender(OdeAccess access) {
// Init sizes for layout generations
initSizes(access);
lindex++;
Graph conn = GraphIO.readGraph("graph-" + lindex + ".txt");
Visode[] vert = GraphIO.readVisodes("vishy-" + lindex + ".txt");
OdeAccess copy = null;
if (c... |
b42d912c-9952-426f-b109-fcea341c51ff | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... |
2aaf11cf-9673-4829-9d88-69ad9d89c1aa | 1 | public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
}
return this.reference;
} |
151d7ea0-67bc-4e17-b894-217892235c45 | 7 | private void btnCrearOfertaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCrearOfertaActionPerformed
if(tbxMonto.getText().trim().length() != 0 && tbxTipoCambio.getText().trim().length() != 0
&& cmbTipoOferta.getSelectedItem() != null)
{
try
{
... |
deb00377-1cb6-4ddb-bc7b-a6c0f78a6d6d | 3 | @Test
public void testRemoveClient() {
BlockingQueue<Client> currentObjectsList = null;
Client client1 = new Client("Diego", "111", "diego.sousa@dce.ufpb.br",
18, 11, 1988);
Client client3 = new Client("Kawe", "333", "kawe.ramon@dce.ufpb.br",
18, 11, 1988);
facade.addClient(client1);
facade.addCli... |
e8df2c82-88ca-4398-9b26-7362b8f4353f | 7 | public void listenerButtonVideau()
{
if (!session.getParametreSession().isUtiliseVideau())
{
vuePartie.getPaneldroitencours().getVideau().setEnabled(false);
}
else
{
vuePartie.getPaneldroitencours().getVideau().addMouseListener(new MouseListener(){
@Override
public void mouseClicked(M... |
88aba317-8790-4203-b5b0-00489e36c39b | 7 | private boolean mtChecker(LinkedList<String>left,LinkedList<String>middle, LinkedList<String>consequent)
{
/*
* assume ~~~c
* assume ~~(b=>c)
* mt 1 2 ~~~b
*
* */
/*
* Potential Problems:
* - c
* - ~(b=>c)
* - ~b
*
* assert size at bottom of method might break things
... |
30aa7fd0-e3c6-488f-9c98-052d6c896f32 | 9 | public String string2Json(String s) {
StringBuffer sb = new StringBuffer();
for (int i=0; i<s.length(); i++) {
char c = s.charAt(i);
switch (c){
case '\"':
sb.append("\\\"");
break;
case '\\': ... |
9d9c6912-7f29-4fe6-a322-75f356d9fa90 | 7 | public void paint(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHints(rh);
g2d.drawImage(backgroundBuff, null, 0, 0);
if (backgroundBuff == null)
createBackground();
if (initDone && !participants.isEmpty()) {
... |
0dc89219-5948-47f9-a836-1a880a707875 | 9 | private void setfnames( String filename )
{
if( used() ) use(); // close previous files
String f = filename;
int l = f.length();
ext = (( l>4 && f.charAt(l-4) == '.' ) ? f.substring(l-3) : "" );
if( ext.toLowerCase().equals("dbf") ) { dbfname = f; f = f.substring(0,l-4); }
else { ext = "DBF" ; db... |
3e0532df-9e1b-4f84-b274-91d37e6dfd1a | 9 | @Override
public void keyTyped(KeyEvent e) {
if (e.getKeyChar() == 'w') {
selectedItem = (selectedItem + 1) % items;
}
if (e.getKeyChar() == 's') {
if (selectedItem > 0) {
selectedItem--;
} else {
selectedItem = items - 1;
}
}
if (e.getKeyChar() == ' ') {
SoundManager.stop("chiptune"... |
c3dd5a49-f5a8-4e11-af7f-a336af02e2be | 1 | @Override
public void stop(int objectId) {
AudioChannel channel = channels.get(objectId);
if (channel != null) {
alSourceStop(channel.source);
}
} |
47ce73b8-d51a-4852-be7e-36175133872e | 0 | public boolean isCompleted() {
return PeerState.COMPLETED.equals(this.state);
} |
9871ffae-9147-4622-b73f-27739a3abf4e | 6 | public static boolean save() {
if (KeyList.values().size() == 0) { //If queue is empty OR economy is disabled.
KeysFile.delete();
return true;
}
ColorKeys.Log(Level.INFO, "Saving keys...");
try {
if (!KeysFile.exists()) {
if (!KeysFile.createNewFile()) {
ColorKeys.Log(Level.SEVERE, "Error c... |
b805d922-dd41-4d41-bb87-7d2b0aecc27e | 7 | public Direction hitObj(GameObj other) {
if (this.willIntersect(other)) {
double dx = other.pos_x + other.width /2 - (pos_x + width /2);
double dy = other.pos_y + other.height/2 - (pos_y + height/2);
double theta = Math.atan2(dy, dx);
double diagTheta = Math.atan2(height, width);
if ( -diagTheta <= ... |
2421a97a-6bcf-48de-9559-6324ffd5e4a3 | 4 | public boolean onCommand(CommandSender s, Command command, String label, String[] args) {
if (args.length == 0 || getCommands(args[0]) == null) {
s.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.BOLD + "------------------[" + ChatColor.AQUA + ChatColor.BOLD + " Hubber " + ChatC... |
f84827bf-29cd-4552-aacb-ef6fc687da90 | 5 | public Transition parseTransition(Id leftId, Id rightId, String transitionExpr) {
Transition transition = new Transition(leftId, rightId);
String[] leftAndRight;
if(transitionExpr.contains("-.-")) {
transition.usingLineStyle(Styles.LineStyle.Dashed);
leftAndRight = trans... |
8d1eff9d-f307-4f17-b360-17139ff2678c | 9 | protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
{
init();
this.options = options;
// an iterator for the command line tokens
Iterator iter = Arrays.asList(arguments).iterator();
// process each command line token
while (iter.... |
a796205b-79ed-40c4-9603-c474d2cba98b | 3 | public Command getCommand(String inputLine)
{
//String inputLine = ""; // will hold the full input line
String word1;
String word2;
StringTokenizer tokenizer = new StringTokenizer(inputLine);
if(tokenizer.hasMoreTokens())
word1 = tokenizer.nextToken(); //... |
fc389317-a5fe-4206-898a-206061367b17 | 7 | public ArrayList<GeoEvent> eventDataGenerator(JsonObject jsonObject){
ArrayList<GeoEvent> events = new ArrayList<GeoEvent>();
try {
JsonObject jobject = (JsonObject) jsonObject.getAsJsonObject("events");
JsonArray eventOb = jobject.getAsJsonArray("event");
for(JsonElement s : eventOb){
JsonObject even... |
0c1b8fa6-e85b-47f4-913a-ba625ba79009 | 7 | public void run()
{
try{
System.out.println("Connecting on port: " +port);
InetAddress server = InetAddress.getByName(ip);
sConn = new Socket (server, port);
conInf=("Connected to: "+sConn.getInetAddress().getHostName()
+" on po... |
a8ff1466-2a7c-43fe-b622-0b01d43c5a2a | 9 | public static String getRelativePath(PackageDoc packDoc, PathType eparamssource)
{
String pkgPath = packDoc.name().replace('.', '/') + "/";
switch(eparamssource)
{
case eInterfaceHeader: return pkgPath + "interfaces.h";
case eProxyHeader: return pkgPath + "proxys.h";
case eProxySource: return pkgPath +... |
1fafa232-fd82-472f-8516-93bb7df3773c | 3 | @RequestMapping(value = {"/search"})
public String findDepartments(@RequestParam(value = "name", required = false) String name, @RequestParam(value = "page", required = false) Integer page, Model model) {
if (name == null) {
name = "";
}
if (page == null) {
page = 0;
... |
5eba6e57-5c6a-480b-8a33-6085fd4c2301 | 2 | public BESong getById(int id) throws SQLException {
for (BESong aSong : getAll()) {
if (aSong.getId() == id) {
return aSong;
}
}
return null;
} |
87885972-0189-41bd-a39e-51e1554315e6 | 4 | protected void effect() {
if (radius > 1) {
for (int x = -radius; x <= radius; ++x) {
for (int y = -radius; y <= radius; ++x) {
for (int z = -radius; z <= radius; ++z) {
Location loc = world.getBlockAt(X + x, Y + y, Z + z).getLocation();
world.playEffect(loc, effect, direction);
}
}
... |
bbcfed59-74b2-4ad5-84f5-415102da36ff | 8 | static void handleUpdate(UpdateSet update)
{
ArrayList vmUpdates = new ArrayList();
ArrayList hostUpdates = new ArrayList();
PropertyFilterUpdate[] pfus = update.getFilterSet();
for(int i=0; i<pfus.length; i++)
{
ObjectUpdate[] ous = pfus[i].getObjectSet();
for(int ... |
a65fefc6-3fc0-4010-ae90-496a37e01401 | 7 | public Animation getAnim()
{
Animation anim = null;
switch(state)
{
case IDLE:
anim = idleAnimation;
break;
case WALK:
anim = walkAnimation;
break;
case JUMP:
anim = jumpAnimation;
break;
case FALL:
anim = fallAnimation;
break;
case LAND:
anim = landAnimation;
break;
}
... |
db1d76fa-a096-42b2-b445-81c45a807413 | 6 | public void removeTask(Task task)
{
if (DEBUG) log("Find the taskWidget that contains the desired task");
TaskWidget target = null;
for (TaskWidget tw : taskWidgets)
{
if (tw.getTask() == task)
{
target = tw;
}
}
if (target == null)
{
if (DEBUG) log("Failed ... |
82f5451a-4989-46ae-948e-b5e605026e48 | 2 | public Map<String, Object> getAllTypes() {
Map<String, Object> types = new HashMap<String, Object>();
// Cr�ation de la requ�te
java.sql.Statement query;
try {
// create connection
connection = java.sql.DriverManager.getConnection("jdbc:mysql://"
+ dB_HOST + ":" + dB_PORT + "/" + dB_NAME, dB_... |
22ea4afa-70be-4317-9d10-170ea60091fa | 4 | private static int[][] calculateDistances2(double[][] points,int N) {
int[][] distanceMatrix= new int[N][N];
for(int i=0; i<N;i++){
for(int j=0;j<N;j++){
if(j==i){
distanceMatrix[i][j]=0;
} else if(i<j){
distanceMatrix[i][j]=distance(points[0][i],points[0][j],points[1][i],points[1][j]);
} e... |
76a8c60d-e759-41ba-95ce-d6aa8389e862 | 0 | public Group(GoGame game1)
{
game = game1;
pieces = new HashSet<Piece>();
liberties = new HashSet<Square>();
} |
e9ff414d-44c0-4fa9-985f-e0869e927ac3 | 1 | public boolean hasPathTo(Node to)
{
if (edgeTo.containsKey(to))
{
return true;
} else
{
return false;
}
} |
7dc65ad9-cd62-43da-8faf-5824634106f4 | 1 | public static String changeExtension(String a){
int cnt = 0;
String tempo = "";
while(cnt < (a.length() - 5)){
tempo = tempo + a.charAt(cnt);
cnt++;
}
tempo = tempo + ".jpg";
return tempo;
} |
20fa9450-6270-49ca-8f64-6a885a05b067 | 8 | static void calculate_sprites_areas()
{
//UINT8 sx,sy;
int[] sx=new int[1];
int[] sy=new int[1];
int i,minx,miny,maxx,maxy;
for (i = 0x00; i < 0x20; i++)
{
if ((i >= 0x10) && (i <= 0x17)) continue; /* no sprites here */
if (get_sprite_xy(i, sx, sy)!=0)
{
minx = ... |
bff316ee-3dd9-4c15-bf76-dd9f87386c8a | 9 | boolean whitelisted(String page, String user, String summary, String project) {
if (config.whitelistModel.contains(user + "#" + project)
|| config.tempwhitelistModel.contains(user + "#" + project))
return (true);
else {
int size = config.regexpwhiteModel.getSize(), i;
for (i = 0; i < ... |
651f1c39-0c42-4995-aec4-8e1fa57ef045 | 8 | public static boolean isValid(final List<S2Loop> loops) {
// If a loop contains an edge AB, then no other loop may contain AB or BA.
// We only need this test if there are at least two loops, assuming that
// each loop has already been validated.
if (loops.size() > 1) {
Map<UndirectedEdge, LoopVer... |
96693ad1-9d32-44fd-be69-2cbe96d5573e | 1 | public boolean isBlack() {
if (myColor.equals(BLACK))
return true;
return false;
} |
d29ddbe8-e597-4add-a54d-9d9f1d3bc3a0 | 1 | public CtMethod[] getMethods() {
try {
return getSuperclass().getMethods();
}
catch (NotFoundException e) {
return super.getMethods();
}
} |
e7e4327a-6ddb-436c-91a6-76bf4002adf2 | 1 | private void getTourCollection(List<Direction> directions, AbstractDao dao, Criteria criteria) throws DaoException {
for (Direction dir : directions) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_DIRECTION, dir.getIdDirection());
crit.addParam(DAO_TOUR_STATUS, criter... |
fc324eed-9b32-4737-b710-47378e43dca8 | 0 | public int getWildCardRank()
{
return wildCardRank;
} |
28cf5ffb-9445-41de-8ea1-e9c0edadaf60 | 5 | private void botonAniadirCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAniadirCompraActionPerformed
// Esto sólo añade a la lista, NO al map, para que se añada al map se debe guardar
DefaultTableModel modeloCompra = ((DefaultTableModel) jTableCompras.getModel());
... |
26d3bd03-058e-4b74-9389-79a35cbacbb0 | 4 | private void removeHighlight(int start, int end) {
Highlighter.Highlight remove = null;
for (Highlighter.Highlight h : editor.getHighlighter().getHighlights()) {
if (h.getStartOffset() == start && h.getEndOffset() == end) {
remove = h;
break;
}
... |
a5330a4c-112b-4cd4-88e1-901b0f9e5821 | 4 | int[] loadIntArray() throws IOException {
int n = loadInt();
if (n == 0)
return NOINTS;
// read all data at once
int m = n << 2;
if (buf.length < m)
buf = new byte[m];
is.readFully(buf, 0, m);
int[] array = new int[n];
for (int i = 0, j = 0; i < n; ++i, j += 4)
array[i] = luacLittleEndian ? (b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.