method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bc60815b-fe5a-4838-9a04-091862ebfcf5 | 8 | public void write(OutputStream outputStream, File requestResource) {
switch (this.httpStatusCode) {
case -1:
Log.warn("HTTP -1 write output from cache");
break;
case 200:
Log.info("HTTP success 200 - OK");
break;
case 403:
Log.info("HTTP error 403 - Forbidden");
break;
case 404:
Log.info... |
b1c457ec-7d5b-45f4-b750-2c14b07e592e | 0 | public BitTreeDecoder(int numBitLevels)
{
NumBitLevels = numBitLevels;
Models = new short[1 << numBitLevels];
} |
c1d57713-2895-43d0-8acd-24b8747b25e4 | 6 | public void run() {
int i = 0;
while (running) {
if (address != null && port > 0) {
sendPlayerData();
sendRobotData();
sendOobabooData();
sendMonsterData();
if (i % 25 == 0) {
sendPlaceableDat... |
46cf9e10-1641-468c-b728-887fc3bfbf5f | 0 | public void stop() {
mb.stop();
} |
870113d2-c29e-4825-af73-0e3852d386a8 | 3 | @Override
public String toString() {
String retour = "Trajet n°"+id+" de "+villeDepart+" à "+villeArrivee+", départ "+dateDepart.toString(outDTF);
if(hasConducteur()){
if(hasPlacesLibres())
retour+=", "+(placesLibres())+" places disponibles";
else
retour+=", plus de places disponibles";
retour+="... |
b88eea60-fb8f-4682-afca-92fac53a504b | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
747ace2d-56f6-4f84-91f8-4e74c1a93ce9 | 7 | private Item getItem(boolean allFlag, Room srchRoom, Item srchContainer, MOB srchMob, String itemID)
{
Item deadItem=null;
deadItem=(srchRoom==null)?null:srchRoom.findItem(srchContainer,itemID);
if((!allFlag)&&(deadItem==null))
deadItem=(srchMob==null)?null:srchMob.findItem(null,itemID);
if(deadItem==null)
... |
fb081904-b282-48ec-a8b8-f226edfedd1f | 5 | protected int getColofvalue(int a) {
int lngCol = 0;
if(this.lisCol.get(0).contains(a)) {
lngCol = 0;
}else if(this.lisCol.get(1).contains(a)) {
lngCol = 1;
} else if(this.lisCol.get(2).contains(a)) {
lngCol = 2;
} else if(this.lisCol.get(3).c... |
2d0781c9-9758-4334-9094-5036c3b68f94 | 9 | public void generateChildren() {
children = new ArrayList<State>();
if (popEligible) {
Permutation q = p.delete(0);
State child = new State(q, q.length() > 0);
int[] childInsertionCandidates = new int[insertionPoints.length];
for (... |
43b456a9-5493-40ae-85da-d3b3dfcc9eba | 0 | public HBox getActionBox() {
return actionBox;
} |
306ba169-9148-4b84-856b-1079236045e9 | 4 | public static final synchronized StdImage createColorizedImage(StdImage image, Color color) {
String name = REVERSE_MAP.get(image);
StdImage img = null;
if (name != null) {
name = name + color + COLORIZED_POSTFIX;
img = get(name);
}
if (img == null) {
img = ColorFilter.createColorizedImage(image, col... |
6cf2f6ee-0301-4fec-a796-9750ab706745 | 0 | public String getResultFilePath() {
return resultFilePath;
} |
c1329a30-904d-4dca-a023-ac6329582ce4 | 4 | private void reportStats()
/* The statistics:
- the summed periods for all the iterations in this interval
(period is the amount of time a single frame iteration should take),
the actual elapsed time in this interval,
the error between these two numbers;
- the total n... |
b3a9f896-6ac4-4d8e-9120-526c929f7f4e | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
fdb6eb51-c740-4d18-b650-729cd628969a | 7 | public static void appendHexChar(StringBuilder s, String src) {
int n = src.length();
for (int i = 0; i < n; ++i) {
char c = src.charAt(i);
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) {
s.append(c);
} else if (c >= 'A' && c <= 'F') {
s.append((char) ((int) c + 32));
}
}
} |
3a50e344-64ea-4034-9f3a-393292f1bbf8 | 1 | public static void main(String[] args)
{
Backend connections = new Backend();
while(connections.mainMenu())
{
//program running
}
} |
72fa595a-3d09-4e11-a21a-0a2a9c4377f5 | 2 | public static float[] getCrossPointSS(float[] g1, float[] g2)
{
//get cross point straight-straight
//Berechnet den Schnittpunkt zweier Geraden, nur wenn er von g1 aus in positiver richtung liegt
//Geraden werden als floats mit 4 Elementen angegeben (0,1 = Ortsvektor; 2,3 = Richtungsvektor)
//Rueckgabewert ist... |
49f6048e-09f0-4491-81b5-8c1de56efedc | 0 | public void actionPerformed(ActionEvent event) {
displayHelp(environment.getActive());
} |
3cb161b7-b46f-440b-92bc-a7c54ae0ad10 | 0 | public static FalseStartLabel getInstance()
{
return instance;
} |
75f667a1-89a3-4786-8463-d472be79e5d6 | 2 | public static void main(String[] args) {
String[] govInfoList = CSVStrings.GOV_INFO.split("~");
System.out.println();
try {
// Output File - clear it down first.
File outputFile = new File(OUTPUT_FILE);
outputFile.delete();
FileWriter fw = new FileWriter(OUTPUT_FILE,true);
... |
7c7c49d8-9794-413d-a94d-aab09f711361 | 4 | public void setHasLargestArmy(Boolean b) {
if (hasLargestArmy == true && b == false)
victoryPoints--;
else if (hasLargestArmy == false && b == true)
victoryPoints++;
hasLargestArmy = b;
} |
59159f62-ba0a-4ca4-9013-8d0a248e6737 | 0 | @Test
public void minimalTest()
throws Exception
{
Thread.sleep( 5000 );
assertTrue( this.timedTask.getInvocationsTimedTaskA() > 0 );
} |
97134b42-8c88-4e83-9d46-04f96ff4f889 | 3 | @Override
public Position obtenirPositionProposee() throws Exception
{
String ligneDeTexteLue = null;
try
{
ligneDeTexteLue = this.lecteurDeLignesDeTexteSurLEntreeStandard
.readLine();
if (ligneDeTexteLue == null)
throw new IOException();
if (ligneDeTexteLue.length() == 0)
throw new IOExce... |
70954a45-eabd-4923-882e-e17ca4085b46 | 4 | private static void saveUsername(){
File lastlogin = new File(Util.getWorkingDirectory() + File.separator + "lastlogin");
if(LauncherFrame.PwCheckBox.isSelected()){
if(lastlogin.exists()){
lastlogin.delete();
}
FileWriter outFile;
try {
outFile = new FileWriter(lastlogin);
PrintWriter out = ... |
2036a412-fd7a-4adf-add5-db1414491512 | 7 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
final Player player = (Player) cs;
if (Lobby.started && !Game.started) {
if (DatabaseHandler.hasPass(player)) {
if (!Lobby.forcedTraitors.contains(player) && !Lobby.forcedDetect... |
06e174ae-f05d-4418-8abe-1e9fb202bb2c | 4 | public void update(String table, String nameColumn, String valueColumn,
String nameID, int valueID) {
try {
con = DriverManager.getConnection(url, user, password);
String stm = null;
stm = "UPDATE " + table + " SET " + nameColumn + " = '" + valueColumn + "' WHERE "
+ nameID + " = " + valueID;
p... |
9bca37b8-4e50-4a78-bd88-371b0a04dc53 | 8 | public Boolean handleCommand(Player player, String command) {
command = command.substring(1);
String[] tokens = command.split("\\s");
if (tokens.length < 1)
return false;
tokens[0] = tokens[0].toLowerCase();
if (aliases.containsKey(tokens[0])) {
String args = new String("");
if (command.length() > 1... |
5b8e0c3c-4a98-416a-b8cf-08dbd191b664 | 3 | public void fire(Player player, Environment enviro){
if(canShoot){
canShoot = false;
float xPos = player.getPosition().x();
float yPos = player.getPosition().x();
float zPos = player.getPosition().x();
Position posToShootFrom = player.getNewPosition();
Position posToShootTo = Position.screenToWorld(... |
88fc1b29-6172-4a41-ac98-dee71394dbf6 | 9 | public void writeBinaryFile(final String path, final String mode, final LoggedDataInputStream dis, int length)
throws IOException {
if (DEBUG) {
System.err.println("[writeBinaryFile] writing: " + path); // NOI18N
System.err.println("[writeBinaryFile] length: " + lengt... |
c77b0e13-1058-45ab-ae03-4dac7839ba88 | 5 | private void updateStateToolNotFound(List<Keyword> keywords, List <String> approval, List<String> terms) {
if (approval != null && !approval.isEmpty()) {
if (approval.get(0).equals("yes")) {
getCurrentDialogState().setCurrentState(KitchenAssistance.KA_WAITING_FOR_TYPE);
return;
}
else {
getCurrentDialogState().setCurre... |
8941fb6a-2361-48f7-b5dd-e1abfecadc8f | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
fbd7378f-8ff5-4c06-8add-fb6dbea1b987 | 7 | public Asteroid(double xPos, double yPos, double anAngle, int aSize, int frameWidth, int frameHeight)
{
generator = new Random();
x = xPos;
y = yPos;
fWidth = frameWidth;
fHeight = frameHeight;
angle = anAngle;
rotAngle = anAngle;
size = aSize;
... |
ce698e62-8e7f-4314-bf67-dea34d3dcf30 | 5 | @SuppressWarnings(value = "unchecked")
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
// next line makes compiler complain for unsafe check
// but seems r... |
d2d8afe1-b723-46bf-86ca-38d637401a78 | 9 | public EntityTreeNode<EC> update( EntityRange er, EntityUpdater<EC> u, Collection<EC> newEntities ) {
if( !EntityRanges.intersects(er, this) ) return this;
// TODO: If no entities are changed, return self
// rather than pushing unchanged entities into the newEntities list
for( EC e : localEntities ) {
... |
86b0efde-da27-4834-8307-7f4199d36554 | 1 | public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new InternalError(this+": "+ex);
}
} |
5b2b05ef-9314-4101-9034-e93010b29db3 | 2 | private void setBounds(int lowerBound, int upperBound) {
if ((upperBound <= 0) || (upperBound - lowerBound) <= 1) {
System.out.println("Invalid Bound Values!");
this.lowerBound = 0;
this.upperBound = 6;
// sets to a default 6 sided dice.
} else {
... |
8b446c6d-9db4-4c77-ae42-3ab22282e96c | 0 | public Double getTheta() {
return theta;
} |
fccb14ff-2c59-459a-a735-39d823cd39ed | 0 | public static HandlerList getHandlerList() {
return handlers;
} |
a0a2bea3-40dd-43a8-907d-e1e48dc88517 | 7 | public boolean isLegal(Player p) {
if (_controller != null) return false;
int inc_roads = 0;
for (Edge e : _edges) if (e.road() && e.controller() != p) inc_roads++;
if (inc_roads >= 2) return false;
for (Vertex v: neighbors()) if (v.controller() != null) return false;
return true;
} |
dba1fb31-f0a1-40c5-9f84-cef39643c28a | 1 | public KeywordChecker(String[] keywords)
{
this.keywords = new String[keywords.length];
for (int i = 0; i < keywords.length; ++i)
{
/* We remove the accents */
this.keywords[i] = Normalizer.normalize(keywords[i], Normalizer.Form.NFD)
.replaceAll("[^\\p{ASCII}]", "").toUpperCase();
}
} |
3f018f95-b6e1-47a3-a980-3dc19f62090a | 5 | private String defineDay(int day) {
String dayOfWeek;
switch (day) {
case 0:
dayOfWeek = "Mon";
break;
case 1:
dayOfWeek = "Tue";
break;
case 2:
dayOfWeek = "Wed";
break;... |
cab3f36e-4e2e-4eaf-9907-57ba2e4d03c6 | 5 | public static Colour getNearestColour(int r, int g, int b) {
Colour color = null;
Colour[] colors = Colour.getAllColours();
if ((colors != null) && (colors.length > 0)) {
Colour crtColor = null;
int[] rgb = null;
int diff = 0;
int minDiff = 999;
... |
e7a05aae-d447-4c9d-bcad-c03e9ee5ea63 | 6 | public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LOCALS) != 0) {
if (declare != null)
writer.println("declaring: " + declare);
if (done != null)
writer.println("done: " + done);
writer.println("using: " + used);
}
... |
78b34c34-55e1-4cef-bb19-568e4f5a6ae3 | 6 | protected void press() {
switch (selected) {
case 0:
setState(gameId);
break;
case 1:
if (!Game.DEV) {
options[1] = "Multiplayer doesn't work";
} else {
setState(multiplayerId);
}
break;
case 2:
setState(instructionsId);
break;
case 3:
setState(aboutId);
b... |
3da1e1e2-0e83-41d3-9419-134831be63f8 | 6 | public static void main(){
/*
* 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 detail... |
e9bf96ad-cc25-40e6-a12b-87d6be995630 | 2 | @Override
public void paint(Graphics g, JComponent c) {
JButton button = (JButton)c;
ButtonModel model = button.getModel();
Insets insets = button.getInsets();
if (model.isPressed()){
g.drawImage(UIResources.PRESSED_ROUND_BUTTON_IMAGE, insets.left,insets.top, c);
} else {
g.drawImage(UIResources.ROUND_... |
8104762f-03b0-4334-885f-ff05716f460d | 8 | static public void main(String args[])
{
if ( args[0].compareTo("6j") == 0 )
{
try
{
String m1 = "6" ;
String t1 = "1 2 -3 -1 5 6" ;
Str... |
99f1fb27-0cb1-49e2-b13e-58d6cba18f5a | 4 | @Override
public FutureMeeting getFutureMeeting(int id) {
Meeting meeting = null;
FutureMeeting futureMeeting = null;
for (Meeting curr : allMeetings) {
if (curr.getId() == id) {
meeting = curr;
}
}
if (meeting instanceof FutureMeeting... |
1f7f2d01-44b4-40d7-a1e6-e59d2461cc14 | 0 | public ApplicationConfParser(String confFilename)
throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
rootNode = mapper.readValue(new File(confFilename), JsonNode.class);
} |
1078a9a5-eeed-4f4a-879a-a82681f956e0 | 0 | @Test
public void testPrintWorld() {
System.out.println("printWorld");
World instance = new World();
instance.generateRandomContestWorld();
instance.printWorld();
} |
1b7a308f-2e61-4b06-bc15-7e88a96af810 | 3 | @Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
if (callback != null) {
callback.onNameEntered(enteredName);
}
leaveInputMode();
break;
case KeyEvent.VK_ESCAPE:
leaveInputMode();
break;
}
} |
0a52b92f-5e42-4305-ad95-32d4ed0f9225 | 2 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(!(sender instanceof Player)){
return true;
}
Player player = (Player) sender;
Inventory inv = Bukkit.createInventory(null, 9 * 4 , "Jobs GUI");
for(int i = 0; i < Plugin.getJobs().siz... |
38d0fc15-9a2a-4cb6-887a-036151b4f432 | 0 | @Override
public void keyTyped(KeyEvent ke) {
// TUrha metodi.
} |
82fc181b-4b97-4fd5-9f1c-db4d7fcec8b9 | 1 | @Override
public void printFiles(PrintFilesEvent event) {
for (File file : event.getFiles()) {
EventQueue.invokeLater(new DeferredPrint(file));
}
} |
5730038d-780f-4154-83c2-a766700b5f70 | 2 | public void checkAPIResponse(int status,HttpURLConnection connection)
throws AftershipAPIException,IOException,ParseException,JSONException{
if (status>201){
BufferedReader rd;
StringBuilder sb;
String message = "";
String type = "";
rd ... |
de4ce16e-8567-4978-ba21-dea907929f8c | 3 | private boolean cmdGlobalAgree(CommandSender sender) {
plugin.getPlayerHandler().addPlayer(sender.getName());
try {
if (plugin.getPlayerHandler().agreed(sender.getName())) {
sender.sendMessage("You have already agreed to the Global Chat rules!");
return true;
}
if (!plugin.getPlayerHandler().readRu... |
14b47d52-4e41-4cf5-ad23-f43d343e5656 | 8 | private void generalUpdate(List<Keyword> keywords, List<String> terms,
List<String> approval, boolean inAden, boolean askPrice) throws WrongStateClassException {
boolean finished = false;
if(keywords.isEmpty() && (approval.isEmpty())) {
DialogManager.giveDialogManager().setInErrorState(true);
return;
}
i... |
7286c3a8-95dd-45a5-8bd4-47576a3886bd | 6 | public void paint(Graphics g, int yOffset) {
removeDeadFlyUps();
g.setColor(Color.BLACK);
int bottomEdge = 15 * flyups.size();
bottomEdge += (permanentFlyUp.equals(""))?0:15;
float rgb = (bottomEdge <= (200 + yOffset)) ? 0.0F : 1.0F;
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
g.drawString(perman... |
00aa168a-b236-43fd-a45a-de7881153209 | 4 | @Override
public int compare(fringeObject x, fringeObject y) {
if (x != null && y != null) {
if (x.getTotalCostToGoal() < y.getTotalCostToGoal()) {
return -1;
}
if (x.getTotalCostToGoal() > y.getTotalCostToGoal()) {
return 1;
}
}
return 0;
} |
3dbebc13-1304-4830-aec8-0f14f4bc51e4 | 2 | public void process(){
try{
this.processHandler.process(this);// 业务处理
if(!this.responseMsgsNotCode.isEmpty()){// 不为空进行写出信息
this.coderHandler.process(this);// 协议编码处理
//this.inputMonitorWorker.registeWrite(key);
this.sendMsgs();
}
}catch(Exception e){
e.printStackTrace();
this.close();
}
... |
1575ba4c-93f0-4007-8878-c3f7ed06e4c6 | 1 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == cbtn) {
close();
return;
}
super.wdgmsg(sender, msg, args);
} |
61b4b628-58c1-45c9-9e12-7ed34a8ad779 | 6 | public void visitPhiJoinStmt(final PhiJoinStmt stmt) {
if (stmt.target() != null) {
stmt.target().visit(this);
}
print(" := Phi(");
if (stmt.hasParent()) {
final Tree tree = (Tree) stmt.parent();
final Block block = tree.block();
final Iterator e = block.graph().preds(block).iterator();
while... |
d5d1c698-589d-4e7a-836a-85b754d143bc | 4 | private static double getIconRatio(BufferedImage src, BufferedImage icon)
{
double ratio = 1;
if (src.getWidth() > icon.getWidth()) {
ratio = (double) (icon.getWidth()) / src.getWidth();
}
else {
ratio = (int) (icon.getWidth() / src.getWidth());
}
if (src... |
208fe319-8566-4cc4-aa27-0c44c6f3aef9 | 3 | @Override
public boolean getJoystickButton(int joystick, int button) {
int numButtons = getNumJoystickButtons(joystick);
if (button < 0 || button >= numButtons) {
return false;
}
return joystickButtons[joystick].get(button) == 1 ? true : false;
} |
adaf3002-3df6-4466-9924-8e3ec9cf83b7 | 1 | public void setStorageUnit(StorageUnit storageUnit) {
if (this.storageUnit != storageUnit) {
this.storageUnit = storageUnit;
clearSelection();
}
} |
926e71c6-231e-4f41-adca-4f8fd74e358d | 8 | public void handleAccept(final Player player, boolean ifFriendly) {
if (canAccept(player)) {
Player other = getOther(player);
player.getTemporaryAttributtes().put("accepted", true);
other.getPackets().sendIComponentText(ifFriendly ? 637 : 631,
ifFriendly ? 20 : 41, "Other player has accepted.");
play... |
0016f956-0e13-4580-b4d0-dc6d07776eb4 | 9 | private static Map<TypeVariable<?>, Type> getTypeVariableMap(
final Class<?> clazz) {
if (clazz == null) {
return Collections.emptyMap();
}
final Map<TypeVariable<?>, Type> map = new LinkedHashMap<TypeVariable<?>, Type>();
final Class<?> superClass = clazz.getSuperclass();
final Type superClassType = cl... |
425b8c08-a7d8-428e-80a1-b74401fe6ef0 | 2 | public void setDateLength(long len) {
if (len < HAS_EXTEND_DATA) {
this.payloadLen = (byte) len;
this.payloadLenExtended = 0;
this.payloadLenExtendedContinued = 0;
} else if (len < 1 * Short.MAX_VALUE * 2) {// UNSIGNED
this.payloadLen = HAS_EXTEND_DATA;
this.payloadLenExtended = (short) len;
this.... |
005fd145-84e0-4a6c-9362-478e96ff620a | 8 | public void printTree() throws CloneNotSupportedException {
int korkeus = laskeKorkeus(this.getRoot());
int tamanHetkinenKorkeus = korkeus;
int solmujenMaara = 1;
int korkeudenLaskemisraja = 1;
boolean tulostetaankoEkatValit = true;
// Tehdään puusta "täydellinen" puu
... |
efa068cb-f230-4d69-8742-c764dec4831a | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
//取号数组
ArrayList<Integer> arrayList1=new ArrayList<>();
//数组对应状态
ArrayList<Integer> arrayList2=new ArrayList<>();
//此时对应位置的人数
ArrayList<Integer> arrayList3=new ArrayList<>();
Scanner scanner = new Scanner(System.in);
String in... |
54b68cdb-9d7a-458a-a562-80646b94bff0 | 1 | private boolean checkData(){
int valueLength = Integer.parseInt(textFieldResult.getText());
if (valueLength == 0){
showMessage("error","The length of array is null!","Data Error!");
return false;
}
else {
return true;
}
} |
0fd15a2c-19d4-4695-8308-58290f05de6f | 4 | void aStarAlgo() {
/*
openList.add(depart);
while(openList.size()>0){
Node current = findBestOpen();
closedList.add(current);
openList.remove(current);
current.setColor(Color.cyan);
if(current.getState() == ARRIVE){
break;
... |
c4800ce9-e25a-4b49-9ce8-8984d647ffd0 | 9 | public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
log.info("WANcostResummingServlet Got a GET...");
caches.reload();
link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()];
for (int i = 0; i < caches.lSources.size(); i++)
for (int j = 0; j <... |
0e0fbfb2-8518-4767-b791-9801740c4dc0 | 1 | public boolean bored() {
if(bored >= BoredLevel){return true;}
return false;
} |
9cd39540-e780-40f5-9526-254b16ef7244 | 4 | public boolean updateBullet(long elapsedTime){
this.setX(this.getX()+(float)ddx);
this.setY(this.getY()+(float)ddy);
//anim.update(elapsedTime);
if(this.getX() < -r || this.getX() > WashStart.screen.getWidth() - TileMapRenderer.offsetX + r ||
this.getY()... |
9a86d755-817a-4879-a23c-4be61e401c73 | 2 | @Override
public String getOldChoix(String p) {
if(p.equals(player1)) {
return this.oldChoise1;
}
else if (p.equals(player2)) {
return this.oldChoise2;
}
return "aucun";
} |
bd9cf380-2e68-4fc3-8f02-0530e0095bb2 | 6 | public void executeJavaMethod(String command, String params)
{
System.out.println("<- " + command + "(" + params + ")");
int id = -1;
if(command.equals("get-devices"))
{
talkToJavaScript("get-devices", _midiSystem.getDevicesXML());
}
else if(comma... |
446cec7b-1dd4-438b-b2fe-0fdbc56b0429 | 3 | public static void main(String[] args) {
long start = System.nanoTime();
Long num = new Long("600851475143");
long factor = 0;
// Loop starts at the maximum possible factor and descends until a
// number is found that is prime and also a factor
for (Long i = (long) Math.sqrt(num) + 1; i > 0; i -= 2) {
i... |
3d660938-3b2c-4e85-af9e-a3cd4ff26cb4 | 5 | private MavenVersion verifyVersionInRepo(String repo, Artifact artifact) throws IOException, DownloadException, SAXException, ParseException {
Metadata artifactMetaData = getArtifactMetaData(repo, artifact);
if (!artifact.getGroupId().equals(artifactMetaData.getGroupId())) {
throw new Downl... |
dd655477-e33b-4be7-94e9-9dce3d508f93 | 2 | @Override
public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
if(o instanceof MyCustomEventApplicationEvent) {
try {
String data = converter.toJsonString(((MyCustomEventApplicationEvent) o).getMyCustomEvent());
... |
be24b36c-660c-426c-85ce-b80ec11d01ae | 4 | public void confirmarTema(List<Tema> listaTemas, int temaEscolhido) {
Tema escolhido = null;
if (listaTemas != null) {
for (int i = 0; i < listaTemas.size(); i++) {
if (i == temaEscolhido - 1) {
escolhido = listaTemas.get(i);
break;
... |
55b3817a-c377-4e04-bf10-21d17699d5f0 | 0 | public T1 getFoo1()
{
return foo1;
} |
e994460e-31c5-4270-a270-1e3dfd5bcc6c | 0 | public TestXML(String data) throws Exception {
doc = createDocument(data);
} |
eff55d40-6abc-40e2-a69d-09924e1f41dd | 2 | public String toString() {
StringBuffer b = new StringBuffer();
for (int i = 0; i < getLocals(); ++i) {
b.append(getLocal(i));
}
b.append(' ');
for (int i = 0; i < getStackSize(); ++i) {
b.append(getStack(i).toString());
}
return b.toString();
} |
732c4866-daac-40c0-ad51-410b99e05732 | 2 | public void addLast(AnyType item)
{
if( head == null)
addFirst(item);
else
{
Node<AnyType> tmp = head;
while(tmp.next != null) tmp = tmp.next;
tmp.next = new Node<AnyType>(item, null);
}
} |
2b565c3b-ed17-4d64-9546-6c145342d1c6 | 8 | public void moveRight()
{
Grid2d Temp; //TEMPORARY SHAPE
Temp = new Grid2d(ARRAY_ROWS,ARRAY_COLS);
boolean value;
boolean inBounds = true;
if (moveable == true)
{
for ( int r=0; r<this.maxRow(); r++)
{
for (int c=0; c < this.maxCol(); c++)
{
value = this.getElement(r,c);
if (... |
b7a2bfa1-6782-4715-b577-c9079c4088f2 | 1 | public void testValueIndexMethods() {
Single test = new Single(20);
assertEquals(1, test.size());
assertEquals(20, test.getValue(0));
try {
test.getValue(1);
fail();
} catch (IndexOutOfBoundsException ex) {
// expected
}
} |
8ee80223-be34-4327-9d7e-78eb8da35a15 | 0 | public Empresa(String nome) {
this.nome = nome;
} |
4e9d41d4-2bac-420c-8610-cd129e58936d | 7 | @SuppressWarnings({ "rawtypes", "serial", "unchecked" })
public JList<String> deleteFiles(JList<String> l)
{
list = l;
if(list.getMaxSelectionIndex() == -1)
JOptionPane.showMessageDialog(null, "Please select files to be deleted! ", "DrCleaner" ,JOptionPane.INFORMATION_MESSAGE);
... |
46a423d0-40d8-43d1-9149-5ae7d4943661 | 6 | @Override
public boolean check() {
return serverAppVersion != null
&& accepted == (passwordCorrect && !tooManyPlayer)
&& mod_name != null && mod_name.matches(FormatPatterns.MODNAME)
&& mod_uid != null && mod_uid.matches(FormatPatterns.MOD_UID);
} |
f9ba377e-dc0b-4d97-b24d-5362a875bfee | 9 | private ElementHandler computeElementHandler(String elementName) {
BlockType blockType = elementNameToBlockType.get(elementName);
if (blockType == null) {
SpanType spanType = elementNameToSpanType.get(elementName);
if (spanType != null) {
return new SpanElementHandler(spanType);
}
if (elemen... |
a4b15887-bce0-4773-95a7-bf089d806850 | 0 | @Override
public void fromMessage(Message message) throws JMSException {
this.setId(message.getStringProperty(Strings.ID));
} |
9076ba0b-9f38-4aef-bc9f-ab601d2e97bc | 2 | public static Handshake craft_obfuscated(byte[] torrentInfoHash,
byte[] clientPeerId, byte[] remotePeerId, boolean obfuscate) {
// craft random padding message
Message.PaddingMessage padding = Message.PaddingMessage.craft();
/*ByteBuffer buffer = ByteBuffer.allocate(
Handshake.BASE_HANDSHAKE_LENGTH +... |
deb46585-f534-4ae6-9a8f-57bf8950e566 | 9 | public static void main(String[] args) {
int frequency = 3560; // freq of our sine wave
double lengthInSecs = 1;
int samplesNum = (int) Math.round(lengthInSecs * SAMPLERATE);
System.out.println("Samplesnum: " + samplesNum);
double[] audioData = new double[samplesNum];
i... |
04b7b63d-f7bc-4fba-a3d9-6ac381a1afd0 | 1 | public PreferenceString getOwnerEmail() {
if (useDocumentSettings()) {
return this.ownerEmail;
} else {
return Preferences.getPreferenceString(Preferences.OWNER_EMAIL);
}
} |
a9c98050-5978-4667-bc8d-8f7b439f22ad | 6 | private void createProjectile(Ship player) {
// TODO Auto-generated method stub
Projectile p = (Projectile) ((Projectile) resourceManager.rocketSprites.get((int)(Math.random()*resourceManager.rocketSprites.size()))).clone();
p.parentId = player.id;
p.setRotation((float) player.heading.perp().getThet... |
d928e0fb-58e6-4102-8aad-b72e9d90a9ce | 3 | public GameObject createBackground(LevelColor color){
GameObject object = new GameObject(false,true,TILESIZE, TILESIZE, previousTile);;
// turn me into real GameObjects and delete Tile
for(Tile t: Tile.tiles){
tileCheck:
if(t != null && t.getLevelColor().matchesColor(color)){
object = new... |
72114723-8b3a-4bf7-85dc-d78bc8758877 | 6 | @SuppressWarnings("unchecked")
public void drop(DropTargetDropEvent e) {
try {
DropTargetContext context = e.getDropTargetContext();
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Transferable t = e.getTransferable();
Object data = null;
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
... |
a7973bd5-8f44-474e-b9e6-90bc7c442364 | 7 | public void executaCrossover() {
//ArrayList<Cromossomo> novaPopulacao = new ArrayList<>(tamanhoPopulacao);
if (count > 0) {
Iterator<Cromossomo> it = cromossomos.iterator();
while (it.hasNext()) {
if (!it.next().best) {
it.remove();
... |
ab852d6b-fefa-4ae0-acf4-ee042e01fc4c | 4 | public TDLCS(String X, String Y)
{
// The definition of the recursive solution is dependent on the indexing
// of the sequence starting from 1
X = " " + X;
Y = " " + Y;
m = X.length() - 1; // length of sequence X
n = Y.length() - 1; // length of sequence Y
l = new int[X.length()][Y.length()];
lcs = n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.