method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
748cb18f-e1a1-41e9-82a6-5f5281575856 | 5 | private static KVArray ReadArrayData(String line) throws KVException, IOException
{
currentLine++;
int startLine = currentLine;
KVArray array = new KVArray();
if (!line.trim().equals("{")) {
throw new KVException("Invalid array starter on line " + currentLine);
}
while (true) {
line = reader.re... |
1eb84db2-edf3-4652-b38d-20d71f9bd2f2 | 7 | public WumpusPerception eventShoot(AID hunterAID) {
Hunter hunter = getHunter(hunterAID);
int xCoord = hunter.getxCoord();
int yCoord = hunter.getyCoord();
int xDir = hunter.getxDirection();
int yDir = hunter.getyDirection();
WumpusPerception perception = getPerception(worldMap[xCoord][yCoord]);
... |
58d925fc-662b-48dc-b5b9-4b807577145d | 5 | public static void grindItem(final Client c, final int itemUsed, final int usedWith, final int itemSlot) {
if (isSkilling[15] == true) {
return;
}
c.startAnimation(364);
final int itemId = (itemUsed == 233 ? usedWith : itemUsed);
for (int i = 0; i < GRINDABLES.length; i++) {
if (itemId == GRINDABLES[i][... |
e27ed4f5-27da-43fc-91c6-6368de6c455c | 2 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
Usuario usuario = new Usuario();
int codGerente = Integer.parseInt(txtCodigo.getText());
usuario.setIdUsuario(codGerente);
usuario.setTipo("Encarregado");
//Cria... |
34f6b8c7-190a-421f-8087-e947dd690f16 | 0 | @Override
public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e) {
e.getChannel().write(_event);
} |
3ca87a81-ba54-4c2c-adec-0345a446cce4 | 7 | private void calculate(Territory t) {
if (fromTerrit == null && t.owner != activePlayer)
return;
if (fromTerrit == null || t.owner == activePlayer) {
if (t.units == 1) {
error("Cannot attack with only 1 troop!");
return;
}
if (fromTerrit != null)
fromTerrit.unhilite();
fromTerrit = t;
... |
b341122f-97c2-4e04-830a-164948afa7e6 | 5 | public void execute ( T event ) throws Exception {
if ( event == null )
throw new IllegalArgumentException ( "The event received is null" ) ;
String [] names = nameMask.get ( event.getType () );
/**
* If names is null it means that the handler should react to all the event... |
0e7e6841-8099-4b08-9f4e-ce95bb3efea8 | 9 | public klasse elementAt (int n)
{ if (n<0 || n>=ON)
throw new ArrayIndexOutOfBoundsException(n);
if (Gap<0 || n<Gap) return O[n];
int k=Gap;
for (int i=Gap; i<OLast; i++)
{ if (O[i]==null) continue;
O[k]=O[i]; O[i]=null;
if (k==n)
{ klasse ret=O[k];
k++; Gap=k;
if (Gap>=ON)
{ for (int j... |
9ab2db28-193b-4513-a66d-29a58f6b2385 | 2 | @Override
public boolean getOutput() {
for (int j = 0; j < getNumInputs(); j++)
if (getInput(j)) return false;
return true;
} |
8aadbaca-05e1-417f-a52e-f26de1734e2e | 5 | public void run(){
String line;
try{
is = new DataInputStream(socket.getInputStream());
os = new PrintStream(socket.getOutputStream());
SimpleSet temp = new SimpleSet();temp.put("connected", "true");
composeResponse(temp,os);
while (true) {
line = is.rea... |
5c122bad-1f06-4226-8f43-f0fa51fdc058 | 3 | public void lireNiveau(String nomTxt) throws Exception{
BufferedReader FichierEntree;
String sLine;
FichierEntree = new BufferedReader(new FileReader(nomTxt));
sLine = FichierEntree.readLine();
while(sLine != null){
if(sLine.charAt(0) == 's'){
listPosStructures.add(sLine.substring(1).split(":"));
}
... |
dca76b31-b4ba-4768-a08e-f95179f83c9a | 0 | public String getStreamTitle()
{
return streamTitle;
} |
ea11c276-f3c0-4d25-a790-7fc7b44f4dcd | 5 | public CycConstant readCompleteConstant()
throws IOException {
CycConstant cycConstant = null;
Object idObject = readObject();
if (idObject instanceof Guid) {
final Guid guid = (Guid) idObject;
final String name = (String) readObject();
cycConstant = CycObjectFactory.getCycConst... |
4bb63998-b3a6-4276-9245-d0d6916979f2 | 0 | public game() {
super("game");
} |
42cdb26d-cc27-4ba4-a3ef-1cdb3171e4fd | 0 | public void setUnprocessedInput(String input) {
myUnprocessedInput = input;
} |
a2d9c004-dbac-4cb2-87dd-8815dded5fe8 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TipoEndereco other = (TipoEndereco) obj;
if (this.idTipoEndereco != other.idTipoEndereco && (this.idTipoE... |
2c21344b-2689-49f4-89e1-bda06b7e23a0 | 3 | private void deplacementPetit(int i,Tour depart, Tour arrivee, Tour intermediaire) {
// TODO Auto-generated method stub
switch(i%3){
case 0 :
deplacer(depart,intermediaire);
break;
case 1 :
deplacer(intermediaire,arrivee);
... |
a3dd348c-998c-45e6-b1dc-5898f9f6f6bc | 7 | private void saveMenuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuButtonActionPerformed
String s = "";
int[][] theGrid = gridToArray();
for(int i=0; i<9; i++){
for(int j=0; j<9; j++){
s+=theGrid[j][i];
}
if(i... |
403c558d-970f-4a88-8385-b6f84c1b1d26 | 1 | public Path clone() {
Path path = new Path();
for (int i = 0; i < size(); i++) {
path.add(get(i).clone());
}
return path;
} |
e804d849-15af-4497-927b-95e134115d1b | 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... |
4d4eb2d6-6676-46bb-b7bc-3b31d765d1d2 | 9 | public void paint(Graphics g) {
//the objects created above are made clickable with the mouseClicked method
super.paint(g);
final Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.white);
g2d.drawImage(MenuBG, 0, 0, this);
g2d.setFont(new Font("Courier", Font.BOLD, 30))... |
bad60e50-0baf-4e7b-ad80-9dc590eb599e | 7 | public static boolean isFrozen(String player) {
if (Bukkit.getPlayer(player) == null) {
if(isJailed(player) && JailrPlugin.getPlugin().getConfig().getBoolean("auto-freeze")) {
return true;
}
return false;
} else {
Player playerObject = Bukkit.getPla... |
08a41436-594e-4178-a9d5-add6ef945134 | 0 | public static Medicament selectOnebyID(EntityManager em, String depotlegal) throws PersistenceException {
Medicament unMedicament = null;
unMedicament = em.find(Medicament.class, depotlegal);
return unMedicament;
} |
8598ffd4-08d3-4ab7-9601-937f948eade1 | 4 | void floyd(int rows) {
for (int k = 0; k < rows; k++)
for (int i = 0; i < rows; i++)
for (int j = 0; j < rows; j++)
if (d[i][j] > d[i][k] + d[k][j]) {
d[i][j] = d[i][k] + d[k][j];
}
} |
00b282a9-5d9c-4efa-9958-a39505a0aa14 | 6 | private boolean logRotation() {
try {
if (position == 0)
return false;
BufferedReader in = new BufferedReader(new InputStreamReader(
new FileInputStream(logFilePath)));
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(
archiveFileName));
out.putNextEntry(new ZipEntry(identifier... |
5ea83771-7955-4894-944c-ebfb471ff928 | 1 | @Override
public T pop() {
if (firstElement == null) {
return null;
}
T value = firstElement.value;
firstElement = firstElement.getNext();
return value;
} |
23426be1-497d-4610-b209-8946d3ae98a1 | 1 | public void addToNode(int key, ValueType value) {
for (int i = 0; i < this.keyAmount; i++) {
}
} |
768ed12a-070b-4120-a26b-f232d0694ee6 | 1 | public String resolveJvmClassName(String jvmName) throws CompileError {
if (jvmName == null)
return null;
else
return javaToJvmName(lookupClassByJvmName(jvmName).getName());
} |
fa31b129-3851-41bb-a316-1ea07ec6a574 | 1 | public static ArrayList<Quiz> getPopularQuiz() {
ArrayList<QuizCreatedRecord> records = QuizCreatedRecord.getRecentQuizCreatedRecord();
ArrayList<Quiz> quizList = new ArrayList<Quiz>();
for (int i = 0; i < records.size(); i++) {
quizList.add(records.get(i).quiz);
}
Collections.sort(quizList, new QuizSortBy... |
56456917-e8cf-4601-99d6-3f1239661841 | 0 | protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {} |
bbaf0b2d-572f-4e71-b869-88fcf965d6d0 | 5 | public Norm containsNormBeliefDiferent(Belief blf, NormType nt)
{
for ( Norm norm: getAllRestrictNorms().values() )
{
Belief b = norm.getNormResource().getBelief();
if ( b!=null && !b.getName().equalsIgnoreCase(blf.getName()) && norm.getNormType() == nt && norm.isActive() )
{
return norm;
}
}
... |
d7d19f08-0013-49d4-8801-dd6edfd59b92 | 5 | private void setStatus(String status) {
int index = 0;
int indexStatus = -1;
System.out.print(this.getClass());
System.out.print(".setStatus: ");
System.out.println(status);
//evitar item duplicado
while(index < cmbStatusDisciplina.getItemCount()... |
4cdb07f5-3f03-4678-a7e1-286dda97378f | 9 | Ray[] getCameraRays(int resX,int resY){
Ray[] rays=new Ray[resX*resY];
float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector
float[] vect2=rotateYVector(dir);
vect2[1]=0;
vect2=normalize(vect2);
float[] vect3=normalize(vectorP... |
c9c2dcbb-92e9-4ad5-b801-7aa030ec9c1e | 1 | public void setExportOnlyColumns(final String[] exportOnlyColumns) {
if (exportOnlyColumns != null) {
this.exportOnlyColumns = exportOnlyColumns.clone();
} else {
this.exportOnlyColumns = null;
}
} |
a30ad6f7-093d-42a9-916b-bd4c33a9de7f | 4 | void readCdsFileTxt() {
// Load file
String cdsData = Gpr.readFile(cdsFile);
String cdsLines[] = cdsData.split("\n");
// Parse each line
int lineNum = 1;
for (String cdsLine : cdsLines) {
// Split tab separated fields
String field[] = cdsLine.split("\\s+");
// Parse fields
if (field.length >= ... |
ef4101f5-838c-41ec-be05-774e8224e1f0 | 3 | public static final String firstSegment(String segment) {
segment = clean(segment);
Matcher segmentEndsInArrayMatcher = ARRAY_SYNTAX.matcher(segment);
Matcher isArrayIndexMatcher = ARRAY_SYNTAX_PATTERN.matcher(segment);
if(segmentEndsInArrayMatcher.matches()){
//my[0].dotted ... |
3d3cf12a-d945-4f02-acf1-c96910a63305 | 8 | public static void main(String[] args) {
// ----------------------------------------------------------------------
// initialize TF hardware
// ----------------------------------------------------------------------
while(true) {
try {
// try to connect
ipcon.con... |
1cb70bf5-bf7a-4a3c-9aa9-085fbe6aac4e | 0 | protected int getFoodLevel()
{
return foodLevel;
} |
583b6931-e848-4a5d-937e-3c7da1f06593 | 8 | public final String parseToString() {
String str = "Systemtelegramm Datenverteileranmeldelisten Aktuallisierung:\n";
str += "Lieferant Datenverteiler-Id: " + transmitterId + "\n";
str += "Änderungen Flage: " + delta + "\n";
if(objectsToAdd != null) {
str += "Hinzugekommende Objekte: [ ";
for(int i = 0; i ... |
6512f658-0838-4b77-9f6c-de3e2c6f2d67 | 2 | public double factorial(double n){
double result=0;
if(n==0 || n==1) return 1;
else
return n * factorial(n-1);
} |
5a38c077-6fd2-4bba-83e1-21a65d3b324e | 2 | public void save() {
try {
sql.Query.save(this);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
} |
6f9eb83d-00ec-405b-a5e9-4dd5e7837893 | 8 | public boolean teleport() {
if (Players.getLocal().getAnimation() == -1) {
Timer wait = new Timer(1);
final WidgetChild TELEPORT_TAB = Widgets.get(275, 46);
if (Tabs.ABILITY_BOOK.open() && !TELEPORT_TAB.visible()) {
WidgetChild magicTabButton = Widgets.get(275... |
8c9ddeaf-2802-4b2e-9d16-617ede604b1f | 8 | private void buildGameArrays(){
byte[] allGames = GameFactory.getAllGameIds();
byte[] stanGames = GameFactory.getAllBuiltInGameIds();
// Get the active games
activeGames = GameFactory.getActiveGameIds();
// Build the built in games array
builtInGames = ... |
dec8df9b-1d37-4272-9aec-cd04dc4e3658 | 9 | public static boolean isValid(String string) {
// remove non-parentheses
String temp = "";
for (int i = 0; i < string.length(); i++) {
if (string.charAt(i) == '(' || string.charAt(i) == ')' ) {
temp += string.charAt(i);
}
}
string = temp;
int count = 0;
int index = 0;
char[] array = string.... |
3c82ef7d-e32a-4b5d-8567-d5a994405a9a | 3 | private static void allianceTest(ArrayList<Kill> kills, String name) {
ArrayList<Kill> commonList = killStats.Stats.compairEntityKill(kills,
name);
Kill latestLoss = new Kill();
latestLoss.setKillTime(new GregorianCalendar(0, 0, 0, 0, 0, 0));
for (Kill k : commonList) {
if (k.getVictim().getPilot().getC... |
ea0f6126-fc48-4f88-8109-db0f16311353 | 0 | public void setProvincia(String provincia) {
this.provincia = provincia;
} |
da42b5f4-2b88-4d66-a1a8-2aeb2c10063d | 8 | @Override
public void search(Board board, Writer out) {
open = Queues.newPriorityQueue();
open.add(board);
while (!open.isEmpty()) {
Board top = open.remove();
if (top.isComplete()) {
write(out, top.getMoves().toString());
return;
}
closed.add(top... |
542fe176-7eb4-43bb-9f43-656d09fc4ad9 | 6 | private static int partition(Comparable[] array, int low, int high) {
int i = low;
int j = high + 1;
Comparable element = array[low];
while(true) {
while(array[++i].compareTo(element) < 0) {
if(i == high) break;
}
while(element.compar... |
5d9b3b0b-e7c4-49f2-a660-c99c09fdb3ca | 1 | private void handleSpellChecking(){
this.controller.onMenuItemPressed(new MenuPressedEventArgs(this.spellCheckMenuItem));
if (this.spellCheckMenuItem.getText() == Constants.SpellCheckOffText){
this.spellCheckMenuItem.setText(Constants.SpellCheckOnText);
}
else{
this.spellCheckMenuItem.setText(Constants.Sp... |
ea9f969b-8b0a-4a96-8241-d7aa77410cb5 | 8 | public void actionEditFile()
{
// use the environment?
if (!Joculus.settings.editor_use_env)
{
// use the user-specified editor (if it was specified).
File f = new File(Joculus.settings.editor_path);
if (!f.exists() || !f.canExecute())
{
Joculus.showE... |
e43d171c-ec79-415e-aa6e-96557e681a5a | 0 | public Square(Type type) {
this.type = type;
this.setTypeNumber();
this.setColors();
} |
90344d9d-14cf-47fe-9713-f74b9b107ce6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestClass2 other = (TestClass2) obj;
if (mapOfJustice == null) {
if (other.mapOfJustice != null)
return false;
} else if (!mapOfJustice.... |
a3c29d2a-1df0-4c2c-a8b2-e0ea059a9489 | 9 | private void shrink(int extra, int[] values, int[] min) {
int count = 1 + (values.length - 1) / 2;
int[] tv = new int[count];
int[] tm = new int[count];
for (int i = 0; i < count; i++) {
tv[i] = values[i * 2];
tm[i] = min[i * 2];
}
extra = distribute(-extra, tv, tm);
for (int i = 0; i < count; i++) ... |
19e80833-6baa-4093-aa14-30f99b06b393 | 1 | public boolean firesBullet() {
if (firingBullet == true) {
firingBullet = false;
return true;
}
return false;
} |
742e3e0a-d744-4ea7-8e01-7cda0e0c4cf3 | 4 | public static void main(String[] args) {
Registry registry = null;
try {
registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
//registry = LocateRegistry.getRegistry();
} catch (RemoteException rex) {
System.err.println("RemoteException occ... |
a7f5b5cc-a7b2-40a1-9a76-de123dee1332 | 3 | @Override
public int compare(Genotipo o1, Genotipo o2)
{
int m = 1;
if(mode==ComparasionMode.Maximize) {
m = -1;
}
double r1 = Double.NaN;
double r2 = Double.NaN;
switch(compMode) {
case ByValue:
r1 = o1.getFitnessV... |
3e4fe480-c75a-4d15-acf1-a0db668befe5 | 4 | @Override
public void draw()
{
glPushMatrix();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(alpha>0)
{
if(mouseOver&&!clicked)
{
int os = 3;
glColor4f(cRed, cGreen, cBlue, alpha);
//Bottom
glBegin(GL_QUADS);
glVertex2f(xpos, ypos);
glVertex2f(xpo... |
f57c3a97-d597-4c97-addd-aa79930f52e5 | 2 | private int transfereTo( ByteBuffer from, ByteBuffer to ) {
int fremain = from.remaining();
int toremain = to.remaining();
if( fremain > toremain ) {
// FIXME there should be a more efficient transfer method
int limit = Math.min( fremain, toremain );
for( int i = 0 ; i < limit ; i++ ) {
to.put( from.... |
8b2a94fb-ca2f-447e-9c5c-005adedfaac8 | 3 | public int getTotalBlocksBroken(String playerName) {
int totalBlocksBroken = 0;
try {
ResultSet rs = _sqLite.query("SELECT total(blocks_broken) "
+ "AS total_blocks_broken "
+ "FROM player, login "
+ "WHERE player.playername = '" + playerName + "' "
+ "AND player.i... |
ceba45dd-9bad-4304-af79-7030e0ea93a3 | 8 | public static void printSum(long[][] ins){
for (int i = 0; i < ins.length; i++) {
if (ins[i][0] > 0 && ins[i][1] > 0 && ins[i][0] > Integer.MAX_VALUE - ins[i][1]){
System.out.printf("Case #%d: %s\n",i, true);
}
if (ins[i][0] < 0 && ins[i][1] < 0 && ins[i][0] <... |
786c7334-6db7-4110-b899-eb277d2a38dc | 7 | public void draw(Graphics2D g, Color color) {
drawHandle(g);
if (ndFrom == null || ndTo == null || ndTo.getFrom() == null) {
drawLine(g, from.getXY(), from.getDirectP());
drawLine(g, to.getDirectP(), to.getXY());
drawLine(g, from.getDirectP(), to.getDirectP());
return;
}
drawLine(g, from.getXY(), fr... |
8a58f75b-25b6-4ff3-8970-b157adbbc66b | 1 | public Flight[] generateFlights() {
Flight[] flightList = new Flight[fecthFlightsList().length];
for (int i = 0; i < fecthFlightsList().length; i++) {
flightList[i] = new Flight(fecthFlightsList()[i]);
}
return flightList;
} |
6a718bf2-7cf0-463f-9666-dfc2a7b53fd9 | 8 | public void changeAnimation(StateActor state){
this.reset();
switch (state){
case UP :
nbSprites=7;
currentSprite = up;
break;
case DOWN :
nbSprites=7;
currentSprite = down;
break;
case LEFT :
nbSprites=7;
currentSprite = left;
break;
case RIGHT :
nbSprites=7;
currentS... |
5224c5a3-20db-4bd0-bc72-78cf7201ec35 | 3 | public void add(Item item) {
if (item == null)
throw new IllegalArgumentException("Item can't be null!");
if (items.size() >= maxItems)
throw new IllegalArgumentException("The inventory is already full!");
if (items.contains(item))
throw new IllegalArgumentException("The item is already in the inventory!... |
32bc5b8b-1d70-47ef-9704-be4653ccbb3b | 0 | public void setDestinationEnd(int value) {
this._destinationEnd = value;
} |
41edad40-0e56-4ebe-a076-36ce2bf8de3d | 8 | @SuppressWarnings("unused")
@Override
public void run() {
URL url = null;
String data = null;
long startTime = 0;
HttpURLConnection conn = null;
//String urlParameters = "key=" + Minetrends.publicKey + "&data=" + Minetrends.getData();
String urlParameters = "APIVersion=" + Minetrends.apiVersion + "&act... |
64bda37d-537f-41e4-a56b-a4e756e56a9e | 0 | @Test
public void shouldReverseString() {
assertEquals("esreveR", Reverser.reverse("Reverse"));
} |
bddd447e-6037-4e30-bc73-e6b2930f14bc | 8 | private boolean searchUpForPrevIntersectionNode( Node node, K key, Object[] ret ) {
if( node.mLeft != null && mComp.compareMinToMax( key, node.mLeft.mMaxStop.mKey ) < 0 ) {
// Request download search on left node.
ret[0] = node.mLeft;
return false;
}
while( n... |
da11bd2b-c31c-4d16-94c4-7386a496c9a6 | 2 | public void sortBU(T[] a, T[] aux, int left, int right)
{
// Do lg N passes
for (int n = 1; n < right - left + 1; n = n + n)
{// n is the subarray size
// i < N - n. The number of elements from position lo must be
// greater than the subarray size so that a split can occur... |
5122c4eb-395c-465e-8a3a-39fe89aaf380 | 3 | @Override
public void windowClosing(WindowEvent arg0) {
programExit = true;
int option = saveConfirmation();
if (option == JOptionPane.CANCEL_OPTION) programExit =false;
else
if (option == JOptionPane.YES_OPTION) ;
else
if (option == JOptionPane.NO_OPTION) System.exit(0);
} |
8a7ad54a-f617-45f7-b4fe-9357be707a1b | 9 | public static boolean isValidReservationLine(String aCsvColumnHeaderLine, String aCsvReservationLine) {
List<String> headerDescriptionList;
List<String> reservationLineList;
// 1) place reservation line in an object that we can traverse through
headerDescriptionList = Arrays.asList(aCsvColumnHeaderLine.sp... |
fc11241d-4581-450f-818e-68f667784879 | 7 | public CommandContext(CommandSender sender, Command cmd, String alias, String[] theargs, ACommand annot_) {
this.sender = sender;
this.command = cmd;
this.alias = alias;
this.originalArgs = theargs;
this.annot = annot_;
this.flags = new HashSet<String>();
ArrayList<String> argv = new ArrayList<String>(... |
ed972f87-1ff7-4525-a139-bbd656c76529 | 7 | private static double calculateCoefficient(int[] dist, int userID) {
// ///////////////////////////////////////////////////////////////////////
// Dead ratings
// double deadCount = 0;
// for (int i = 0; i < dist.length; i++) {
// if(dist[i] == 0){
// deadCount++;
// }
//
// }
// return deadCount;... |
79615586-09d3-4a49-8c65-9b8a01262941 | 1 | @Override
public boolean isOver() {
// TODO: Think of a better way to do this.
return Math.abs(unit.getIntX() - destination.x) <= tol &&
Math.abs(unit.getIntY() - destination.y) <= tol;
} |
4fe52a7a-da75-4b31-a08f-dac7029e0915 | 8 | public static List<PlageHoraire> lireLivraison(String fichierEntree, ZoneGeographique zone) throws ParseurException{
List<PlageHoraire> plageList = new ArrayList<PlageHoraire>();
SAXBuilder builder = new SAXBuilder();
FileInputStream inputStream;
try {
inputStream = new FileI... |
30b39743-db28-4c55-873b-d75741414d25 | 3 | public static void main(String[] args) {
File f = new File(".");
File[] files = f.listFiles();
for (File file : files) {
if(file.isDirectory()){
System.out.print("Directory : ");
} else if(file.isFile()) {
System.out.pri... |
1a51afce-8b16-4fd4-a517-bd270b950424 | 5 | @Override
int trimIndex(Fastq fastq) {
int qual[] = FastqTools.qualtityArray(fastq);
int i;
for( i = 0; i < qual.length - runningMedianLength; i += 2 ) {
// Sorted list of qualities
LinkedList<Integer> list = new LinkedList<Integer>();
for( int k = 1; k <= runningMedianLength; k++ )
list.add(qual[... |
42c7450e-9d15-4beb-a160-2ee944306077 | 3 | public void awaitsLISTanswer() {
try {
int buffersize = 0;
// If data are available
if ((buffersize = dSocket.getDataSocketInput().available()) != 0) {
int counter;
byte buffer[] = new byte[buffersize];
// while data are available -> read into buffer
System.out.println("< Data from Se... |
b9e34dc2-f058-4ded-9355-e279b19db66a | 7 | public static void main(String[] args) throws Exception {
List<Classifier> classifiers = new ArrayList<Classifier>();
//classifiers.add(new J48());
//classifiers.add(new NaiveBayes());
LibSVM svm = new LibSVM();
svm.setOptions(new String[] { "-B" });
//classifiers.add(svm);
BayesNet bayesnet = new BayesNe... |
db671db5-a454-4b0f-b513-58151c6d5f6b | 3 | public static int getIndexOf(Container parent, Component child) {
if (parent != null) {
int count = parent.getComponentCount();
for (int i = 0; i < count; i++) {
if (child == parent.getComponent(i)) {
return i;
}
}
}
return -1;
} |
89796e19-edaa-4293-a0fc-bb694cca1175 | 8 | private boolean matchHeadChild(PhraseStructureNode child, PrioSetMember member) throws MaltChainedException {
if (child instanceof NonTerminalNode && member.getTable().getName().equals("CAT") && member.getSymbolCode() == child.getLabelCode(member.getTable())) {
return true;
} else if (member.getTable().getName()... |
936579d4-78d3-40e4-8d22-11cc5302f7ea | 3 | private void diffOffering(ArrayList<Change> list, OffRec rec,
HashMap<String, Object> map) {
OffRec inc = makeOffering(map);
if (inc.getStart() != null) {
if (!inc.getStart().equals(rec.getStart()))
list.add(OfferingChange.setStart(rec, inc.getStart()));
}
if (inc.getDuration() != rec.getDuration())
... |
a2f3df81-6bbf-49d8-8964-baf30c80a6e8 | 4 | public boolean isCompleteMatch(List<Character> currentMatching)
{
if(currentMatching.isEmpty())
return false;
if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE)
return false;
String asString = "";
for(int i = 1; i < currentMatching.size(); i++)
... |
8c0e8249-dd55-4ee5-9b89-4bcb3d1f4eb0 | 8 | public PColorSpace getColorSpace(Object o) {
if (o == null) {
return null;
}
Object tmp;
// every resource has a color space entry and o can be tmp in it.
if (colorspaces != null && colorspaces.get(o) != null) {
tmp = colorspaces.get(o);
PCol... |
02c4a5bc-9f1a-4a9e-aa7b-6255b871c160 | 8 | public void paint(Graphics2D g) {
Color oldColor = g.getColor();
Stroke oldStroke = g.getStroke();
if (rotation != 0) {
g.rotate(rotation, x, y);
}
g.setColor(color);
float x1 = x - length * 0.5f;
float x2 = x + length * 0.5f;
if (line == null)
line = new Line2D.Float();
if (drawAxis) {
g... |
e74fbffd-4c2f-4985-86db-e6bb9b2706ef | 3 | private ArrayList<AbstractPlay> getBestPlays(){
ArrayList<AbstractPlay> result = new ArrayList<AbstractPlay>();
int bestEvaluation=-100;
for(AbstractPlay play:everyPlay){
int evaluation = play.eatNumber();
if(evaluation>=bestEvaluation){
if (evaluation != bestEvaluation)
result.clear();
... |
64164f3d-d0f4-449b-9c57-d215adc03225 | 6 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HotelInfo other = (HotelInfo) obj;
if (hotelID == null) {
if (other.hotelID != null)
return false;
} else if (!hotelID.equals(other.hotelID))
re... |
b2ef54ac-ff1f-4a73-bad7-92f199039517 | 8 | public void run()
{
if(this.command.equals(GET_MOVIES))
{
getMovies();
}
else if(this.command.equals(PLAY_MOVIE))
{
this.player.setVisible(true);
playMovie();
}
else if(this.command.equals(PAUSE_MEDIA))
{
pauseMovie();
}
else if(this.command.equals(NEXT_CHAPTER))
{
nextChapter();
... |
5f3a4976-3b32-4942-bce6-8367ac8ff28d | 5 | public void recevoir (Information <Float> information) {
informationRecue = information;
if (information.iemeElement(0) instanceof Float) {
int nbElements = information.nbElements();
float [] table = new float[nbElements];
for (int i = 0; i < nbElements; i++) {
... |
65378a0c-b9e4-4ef8-8006-c75825e0fd8f | 5 | private static int R_Q_P01_check( int p, boolean log_p )
{
if( (log_p && (p > 0)) || (!log_p && ((p < 0) || (p > 1))) )
{
return 0;
}
return 1;
} |
c1627db3-2667-4b7e-9192-3282ee53297c | 2 | @EventHandler
public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (event.getMessage().equalsIgnoreCase("/chat reload") && CatChat.hasPerms(event.getPlayer(), "catchat.admin")) {
plugin.reloadConfig();
plugin.loadConfig();
System.out.println("Chat Reloaded");
event.getPlayer().sendMes... |
d05ad1a0-e4b5-4f13-b91c-1d1a46e0e607 | 0 | public static void main(String[] args) throws Exception {
new HelloWorldSoftware().loop();
} |
2b6e5837-75b3-429d-9b7d-4ed3fcf22d84 | 0 | private void setMofNQuest(ChoiceQuest quest, ArrayList<String> answerList,
ArrayList<Boolean> answerListBool) {
quest.setQuestAnswer(answerList, answerListBool);
} |
1d308b00-70b6-44e8-85f5-11f85dbca425 | 8 | public void update(Observable obs, Object o) {
if(o instanceof String){
prepareNextTextMessage(((String)o));//looks weird
ack_buffer.addAll(members.subList(0, members.size()));//add expected acknowledgements from all the users of members.
timer.start();
sender.wakeUp();
}
if(o instanceof WindowEven... |
b802e55b-600c-454b-98f8-7088ac338638 | 0 | public void setUnit(int x, int y, Unit u)
{
grid[x][y].setUnit(u);
} |
4c41568c-a47d-4492-a319-b1a949bc1783 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof XYShapeRenderer)) {
return false;
}
XYShapeRenderer that = (XYShapeRenderer) obj;
if (!this.paintScale.equals(that.paintScale)) {
r... |
0f15fb34-0a0f-42b9-8ccb-16bdf4211f20 | 4 | @Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
Object result = null;
try {
result = method.invoke(target, args);
logger.info(method.getName());
} catch (IllegalAccessException ex) {
String output = "";
for (int i = 0; i ... |
ab9ea982-acc0-4358-be37-1d84e2eea6ac | 3 | public boolean VerificarUsuarioESenha(String usuario, String senha){
List<Usuario> ListaDeUsuario = new LinkedList<Usuario>();
ListaDeUsuario = controller.findUsuarioEntities();
for (Usuario user : ListaDeUsuario){
if(user.getUsuario().equals(usuario) && user.getSe... |
7d1a9a6a-861b-421c-b6fc-a5866e1b1091 | 1 | public void addSmses(String smes) {
if (this.smses == null) {
this.smses = new ArrayList<String>();
this.smses.add(smes);
} else
this.smses.add(smes);
} |
ab2facb0-93c6-4cd5-a17c-70163295af39 | 6 | public static void back(int size, int used, String path) {
if (size == 0 && used != 2) {
if (primes[1 + ring[sizeRing - 1]])
out.append(path.substring(1) + "\n");
return;
}
for (int i = 2; i <= sizeRing; i++)
if ((used & (1 << i)) == 0 && primes[ring[size - 1] + i]) {
ring[size] = i;
back((si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.