method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ecb1054b-85ee-48db-ac0b-574bb9320a7b | 3 | public Boolean makeQuery(String query){
/*
* ektelei to query pou tou dinetai kai epistrefei an ektelesthke kai an oxi
*/
try {
if(pS.executeUpdate()==0)
return false;
else
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStac... |
1dc309ad-865a-4cb5-9cf6-13e643b9a586 | 8 | public void tryFillInExtraneousExternal(CrossExit EX, Exit ox)
{
if(EX==null)
return;
Room linkFrom=null;
if(subMap!=null)
linkFrom=subMap[EX.x][EX.y];
if(linkFrom!=null)
{
Room linkTo=CMLib.map().getRoom(EX.destRoomID);
if((linkTo!=null)&&(linkTo.getGridParent()!=null))
linkTo=linkTo.getGrid... |
0f5b4bd2-0a5c-4b06-968c-daacbd68af68 | 3 | int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF0... |
4956b255-1b86-44ad-a03e-96b640ad7c7e | 6 | public void update(String name, PlayerCharacter p)
{
//Tests if the name of the supplied is the same as the items name.
int amount = 0;
for(Item item : p.getInventory())
{
if(item.getName().equals(itemToObtain.getName()))
{
amount++;
}
}
if(p.getWeapon() != null)
{
if(p.g... |
a3e7dca7-cc47-4794-8917-5f4cfa4fefae | 7 | private void adjustScale(double v, double theta)
{
int i = 0;
while (i < _launchVelocity.length && theta > _launchAngle[i])
i++;
if (i == 0)
i = 1;
double temp = v / _launchVelocity[i-1];
// avoid setting velocity to NaN
... |
9bf408a9-0788-4eda-9d12-9a20c435a13a | 4 | public void moveDown(Area currentWorld){
for(int count = stats.speed; count > 0; count--){
if(currentWorld.locWalkable(x, y + size + 1)
&& currentWorld.locWalkable(x + size, y + size + 1)
&& currentWorld.locWalkable(x - size, y + size + 1)){
y++;
}
}
} |
dbfa758b-9de6-414d-9362-6ffe985d6ca9 | 6 | public void draw(Graphics2D g) {
// Draw Emotes
if(emote == CONFUSED) {
g.drawImage(confused, (int)(x + xmap - cwidth / 2), (int)(y + ymap - 40), null);
}
else if(emote == SURPRISED) {
g.drawImage(surprised, (int)(x + xmap - cwidth / 2),... |
a845a835-81d9-4d83-9d33-8dc78da975c2 | 5 | private static boolean isOverlappingNextBase(MapPoint place, UnitType type) {
if (place != null && !type.isBase()
&& UnitCounter.getNumberOfUnits(TerranSupplyDepot.getBuildingType()) >= 1) {
MapPoint nextBase = TerranCommandCenter.findTileForNextBase(false);
if (nextBase == null) {
return false;
} el... |
748e3375-30ba-4f33-9555-80fad66225c2 | 4 | public boolean readConfig() {
buttonConfig = new Configuration(new File(configDir + "config.yml"));
File finder = new File(configDir + "config.yml");
if(!finder.exists()) {
//Setting Defaults in the file
buttonConfig.set("econmode.mode", "money");
buttonConfig.set("econmode.itemid", 264);
buttonConfig... |
cb7c2247-7bbf-45b7-a701-5184441c5308 | 9 | public void perform()
{
if (!OKConfig.useSecondaryGroups)
{
Player player = Bukkit.getPlayer(this.parameters.get(0));
if (player != null || OKFunctions.hasAccount(this.parameters.get(0)))
{
String playerName = this.parameters.get(0);
if (player != null)
{
playerName = player.g... |
0dbc16b3-8b6a-4c86-80e5-6e21286f360b | 4 | public Boolean checkIfAllChildrenIsFinished(int Id) {
boolean result = false;
for (int i = 0; i < tasks.size(); i++) {
if (tasks.get(i).getParentID() == Id && tasks.get(i).getTaskID() != Id) {
System.out.println("statusID : " + tasks.get(i).getStatus().getStatusID());
... |
f1988467-b59a-4259-98e3-5754f1a1bd00 | 4 | public void draw(int x, int y, int orientation, int data){
TexInfo currentTexInfo = getTexInfo(data);
Color4F color = currentTexInfo.getColor4F();
glColor4f(1f, 1f, 1f, 1f);
glColor4f(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
Boot.getTexHandler().bindTexture("terrain");... |
50c257ae-01dd-446a-a773-3b8139d4cc54 | 7 | private void editFeatDialog(Feat feat) {
feats.remove(feat);
JLabel nameLabel = new JLabel("Feat name:");
nameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
JTextField nameField = new JTextField(feat.getName());
nameField.setAlignmentX(Component.LEFT_ALIGNMENT);
JLabel ... |
34cad895-dc3c-40c0-9a88-c1764b1eef86 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
19f28b2a-6aad-4f88-8ed1-f225c730356a | 6 | public void upload( String source, String target )
{
try
{
String local = convertPath( source );
String remote = convertPath( target );
if ( isDirectory( local ) && !isDirectory( remote ) )
{
throw new IllegalStateException(
"Can not send a directory to a file!" );
}
File f = new File(... |
d722fddc-d349-4b6e-87f8-7bacf9038d0a | 0 | public static void main(String[] args) {
MutablePropertyValues properties = new MutablePropertyValues();
properties.addPropertyValue("helloWorld", "Hello! Justin!");
RootBeanDefinition definition = new RootBeanDefinition(HelloBean.class);
definition.setPropertyValues(properties);
BeanDefinitionRegistry reg = ... |
6a491681-52b6-4a50-bcc9-0c4fa13984ee | 6 | public void update(Observable obs, Object obj) {
//When StartEvent
if((state.getCurrentCWSEvent() instanceof CarWashStartEvent)){
System.out.println("Fast machines: " + state.getAvailableFastWashes());
System.out.println("Slow machines: " + state.getAvailableSlowWashes());
System.out.print("Fast distrib... |
0a4b3cde-3300-402f-92c8-7c3597f8429b | 3 | public CookieHandler(Map<String, String> httpHeaders) {
String raw = httpHeaders.get("cookie");
if (raw != null) {
String[] tokens = raw.split(";");
for (String token : tokens) {
String[] data = token.trim().split("=");
if (... |
161805c8-845e-4f08-8afe-b0f0080cb356 | 1 | public static void showRoomInfo(int inRoom) {
try {
Rooms.visitedRooms[Rooms.currentRoom] = 1;
GUI.log("\n--- "+Rooms.currentRoomName+" --- \n\n" +
Rooms.RoomDescription);
} catch(ArrayIndexOutOfBoundsException e) {
GUI.log("There is no room in that direction.");
}
} |
a826d43e-8dfa-4729-8082-a26d8d7c2b05 | 1 | public void removeAllFromBasket(int productId) {
if (basket.containsKey(productId)) {
numProductsInBasket -= basket.get(productId).getQuantity();
basket.remove(productId);
}
} |
30ed2f57-0868-4ba2-8c4c-9e3cfb781b0f | 6 | public static void main(final String[] args) {
setPen();
shape = createShape();
jFrame = new JFrame();
bgs[0] = jFrame.getBackground();
jFrame.add(new JComponent() {
private static final long serialVersionUID = 2257038010168418793L;
@Override
protected void paintComponent(final G... |
a2a08253-caf1-48d6-960c-9ef36630d22c | 7 | public static void main(String[] args)
{
try
{
// Print out 10 hashes
for(int i = 0; i < 10; i++)
System.out.println(PasswordHash.createHash("p\r\nassw0Rd!"));
// Test password validation
boolean failure = false;
System.out... |
1be230dd-43fe-41a6-a839-588e26d501dd | 1 | private static String argsToExpression(String[] args) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < args.length; i++)
builder.append(args[i]);
return builder.toString();
} |
5356c0d6-7c90-4e57-8a19-666099a3c322 | 5 | @Override
public void changed(
ChangeEvent event,
Actor actor )
{
// find the selected item
Item selectedItem = null;
int selectedIndex = ( (SelectBox) actor ).getSelectionIndex();
if( actor == shipModelSelectBox ) {
... |
2aec8713-c4fa-4da4-bd05-7bb612394e16 | 8 | private static int method524(char ac[])
{
if(ac.length > 6)
return 0;
int k = 0;
for(int l = 0; l < ac.length; l++)
{
char c = ac[ac.length - l - 1];
if(c >= 'a' && c <= 'z')
k = k * 38 + ((c - 97) + 1);
else
if(c == '\'')
k = k * 38 + 27;
else
if(c >= '0' && c <= '9')
k = k * ... |
9fe8dd2b-35e3-49bc-8f15-4add519b0970 | 4 | private void saveFile()
{
File outFile = new File("C:");
DataOutputStream oStream;
JFileChooser fileChooser = new JFileChooser(outFile);
//Terminate the method early if the user does not pick a file.
if(fileChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION)... |
a892d9ea-b687-48af-89f0-dd694a5548c4 | 1 | private void configBarraStatus() {
this.txtFuncao.setText(usuarioLogado.getTipo());
this.txtNomeLogado.setText(usuarioLogado.getNome());
if (usuarioLogado.getTipo().equals("Diretor")) {
//Esse teste e feito pois diretor nao possui departamento
this.txtDepartamento.setTe... |
8e154514-1bfa-4577-9394-8669aa35d84c | 2 | @Override
public void run() {
while(true) {
try {
System.out.println("Fps: " + fps);
fps = 0;
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
d8950ee3-60aa-48d5-85bf-9d4f08f5c7f7 | 3 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
firstNameId = buf.readShort();
if (firstNameId < 0)
throw new RuntimeException("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0");
la... |
6cb934f7-96ea-4076-89ae-edab001aa28d | 0 | public String getNote() {
return note;
} |
39e2ff0a-9fa8-40e3-80f8-4311f5d18b01 | 7 | public String toString()
{
final StringBuffer buf = new StringBuffer();
buf.append("L-Data");
buf.append(mc == MC_LDATA_IND ? ".ind" : mc == MC_LDATA_REQ ? ".req" : ".con");
if (mc == MC_LDATA_CON)
buf.append(isPositiveConfirmation() ? " (pos)" : " (neg)");
buf.append(" from ").append(source).append(" to ... |
73f83a0d-b1f4-4052-bdce-53e5fd763730 | 7 | public void mousePressed(MouseEvent e) {
Card selectedCard;
int selectedCardRow;
int selectedCardCol;
if (noMoreTableCards || noMoreAvailableMoves) {
return;
}
Point pressPt = e.getPoint();
Point rowColOfSelectedCard = getRowColOfSelectedCard(pressPt);
... |
a26d4ae5-1eab-4961-8de8-99784c44a2fb | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((lValue == null) ? 0 : lValue.hashCode());
result = prime * result + ((op == null) ? 0 : op.hashCode());
result = prime * result + ((rValue == null) ? 0 : rValue.hashCode());
result = prime * result + ((src =... |
deb33fec-0ad6-49df-ba94-0b0cb8bdb2f2 | 9 | public void run() {
System.out.println("marketMgr.donmap.size " + marketMgr.donmap.size());
try {
long startTime = onMessage.startCall();
while( true ) {
getOrderBookKeys();
for( int i = 0; i < orderBookKeys.length; i++ ) {
System.out.println(marketMgr.marketBook.size());
StringBuffer symbo... |
c899296e-f31b-49ac-8489-eb6b7ee67a34 | 9 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("cryptcow.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cryptcow.out")));
message = f.readLine();
boolean pos = true;
/... |
98d18b2f-3845-45eb-86ef-feeee61c3f7c | 5 | public static void main(String[] args) {
//Utilise le style système natif
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (UnsupportedLookAndFeelException e) {
}
catch (ClassNotFoundException e) {
}
catch (InstantiationException e) {
}
catch (IllegalAccessExcep... |
aa004659-ce91-4df5-a140-eeedf2bb91b3 | 9 | public void act() {
if (backToMenuButton.wasClicked()) {
// go to start state
gameScreen.setState(gameScreen.getStartState());
}
String key = Greenfoot.getKey();
if (arrowLeftButton.wasClicked() || (key != null && key.equals("left"))) {
currentHighscoreLevel--;
if (currentHighscoreLevel < 1) {
... |
e4632a4a-cd05-4023-9cb6-3f5d20465562 | 1 | @Test
public void worksWithSeveralFieldFilters() {
citations.add(c1);
citations.add(c2);
citations.add(cnull);
filter.addFieldFilter("author", "Kekkonen");
filter.addFieldFilter("author", "Isoherra");
List<Citation> filtered = filter.getFilteredList();
List<Ci... |
0e0220a3-0f4b-404a-a1b0-dccea163cf97 | 5 | int alignmentConstant (String align) {
if (align.equals("LEFT")) return SWT.LEFT;
if (align.equals("RIGHT")) return SWT.RIGHT;
if (align.equals("TOP")) return SWT.TOP;
if (align.equals("BOTTOM")) return SWT.BOTTOM;
if (align.equals("CENTER")) return SWT.CENTER;
return SWT.DEFAULT;
} |
3eed4e6f-2527-46b5-b690-3575386f4cad | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseEntity other = (BaseEntity) obj;
if (createdDate == null) {
if (other.createdDate != null)
return false;
} else if (!createdDate.equ... |
386cb0b6-f840-4c51-a3eb-b2b4b463c317 | 8 | public Ghost(int ghostType)
{
Point P = new Point();
this.ghostType = ghostType;
if(ghostType == 0){
P.setLocation(290,270);
gcolor = Color.RED;
}
else if(ghostType == 1){
P.setLocation(250,... |
1ef347c7-7cea-496c-9a72-795ae5f5ad95 | 5 | public boolean keydown(KeyEvent ev) {
if (focusctl) {
if (focused != null) {
if (focused.keydown(ev))
return (true);
return (false);
} else {
return (false);
}
} else {
for (Widget wdg = child; wdg != null; wdg = wdg.next) {
if (wdg.keydown(ev))
return (true);
}
}
return... |
fdd2105f-f991-4277-b230-f84a7e972f29 | 8 | private boolean r_shortv() {
int v_1;
// (, line 49
// or, line 51
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 50
if (!(out_grouping_... |
39c2cb21-8655-4fab-bf15-f794cb772693 | 4 | public static void headerWrite(Mode m, String[] nameArray, StringBuilder sb)
throws IOException {
Cache cache = getCache(60 * 15);
String column = (String) cache.get("namecolumn");
if (column == null) {
WakeBackends wb = new WakeBackends();
column = wb.newColumn();
}
sb.append("<html><head><link href... |
b0facd46-87f8-4c81-94cd-180d668070fd | 5 | private Tile getTileAt(int x, int y) {
try {
x -= 10;
y -= 10;
x /= 15;
y /= 15;
if (x < 0 || y < 0 || x > 42 || y > 39) {
throw new IndexOutOfBoundsException("Click was out of bounds: [" + x + "] [" + y + "]");
}
} ... |
38b441ef-80eb-49bf-8ce7-a251fa8df956 | 6 | public void update() {
int x = Main.m.input.mouse.getX();
int y = Display.getHeight() - Main.m.input.mouse.getY();
mouseOver = mouseDown = mouseClicked = false;
if (x >= posX && x <= posX + width && y >= posY && y <= posY + height) {
mouseOver = true;
if (Main.m.input.mouse.isDown(0))
mouseDown = true... |
667d9b7c-6085-4f25-bdab-f55453dec0de | 5 | public Bytecode compileBody(CtBehavior method, String src)
throws CompileError
{
try {
int mod = method.getModifiers();
recordParams(method.getParameterTypes(), Modifier.isStatic(mod));
CtClass rtype;
if (method instanceof CtMethod) {
... |
db28c749-c4ae-437f-acca-953404ae5027 | 7 | private void drawSolutionProgress(Graphics2D g2)
{
if (numSolutions == 0)
{
return;
}
//System.err.println("---- " + currentHelp1Counter + " / " + numSolutions);
if (HelpParadigm.Classic.equals(slateComponent.getSlateSettings().getHelpParadigm()))
{
// Draw circular progress of number of soluti... |
2e5b002d-0f4d-4603-9e97-b1aac7549b3e | 5 | @Override
public String toSql(String tblName,List<String> headers,List<String> columns,
HashMap<String,ForeignKey> foreignKeys) {
StringBuilder builder = new StringBuilder();
builder.append("INSERT INTO ");
builder.append(tblName);
builder.append("(");
builder.append(horizontalKeyName);
builder.append("... |
1a8230cd-d29a-4ff1-b52a-f8a511a0313d | 2 | public static int Cardinality(Object obj, Collection<Auction> coll){
for(Object o : coll){
if(o.equals(obj)){
total++;
}
}
return total;
} |
a0045a1d-720a-42dd-ad25-1a2902a13542 | 9 | public static boolean renderItemIn3d(int par0)
{
if (par0 == 0)
{
return true;
}
if (par0 == 31)
{
return true;
}
if (par0 == 13)
{
return true;
}
if (par0 == 10)
{
return true;... |
a4b858f6-02e4-4604-917c-a26cfab61e91 | 3 | public void paintComponent(Graphics g) {
super.paintComponent(g);
for (BoardCell cell : cells) {
cell.draw(g, cellXSize, cellYSize);
}
for (BoardCell target : targets) {
target.draw(g, cellXSize, cellYSize);
}
for (Player p : players) {
p.draw(g,cellXSize,cellYSize);
}
// This is ghetto but wh... |
ea9bf477-b68e-48f1-ad4d-174cad67e165 | 6 | private void setDataModelConnection( Alignment align ) {
// Prostor za optimizaciju? Prvo ispitivati najvjerovatnije sravnjenje (11)?
if ( (align.x2 == -1) && (align.y2 == -1) ) {
if (align.y1 == -1) {
return; /* Deletion (10) makes no connections in the DataModel */
}
else if (align.x1 == -1) {
re... |
40c00a09-0a0b-41cf-9d66-39955804d4f3 | 2 | public synchronized void dispose()
{
if ((splash != null) && splash.isVisible())
splash.close();
} |
a119c3f8-3b8d-491f-9950-920043e5d831 | 6 | public Connexion(String serveur, String bd, String pass, String user)
throws SQLException
{
Driver d;
try {
if (serveur.equals("local")) {
d = (Driver) Class.forName("oracle.jdbc.driver.OracleDriver")
.newInstance();
DriverManager.registerDriver(d);
conn = DriverManager.getConnection(
"jdbc:oracle:thin... |
9412b8b8-f52c-4977-b8c7-9422c937213d | 1 | private Inicio() {
//this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setUndecorated(true);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
this.pack();
... |
70cc4f4d-994a-45be-ba28-b7a539b705db | 1 | public void setCompanies(Company companies) {
if (verify(companies)){
Companies.add(companies);
Order(Companies);
setCantCompany(CantCompany = +1);
}
} |
c1363632-4d55-4cb3-b243-82683f8d22b2 | 7 | public String stringForValue(keyForValues value)
{
String val = mxGraphMlConstants.ALL;
switch (value)
{
case GRAPH:
{
val = mxGraphMlConstants.GRAPH;
break;
}
case NODE:
{
val = mxGraphMlConstants.NODE;
break;
}
case EDGE:
{
val = mxGraphMlConstants.EDGE;
brea... |
873506b8-5bb9-4c62-bae0-a195a21ab5f6 | 2 | public void gotoURL(String url) {
if (!url.startsWith("http://")) {
URL u = this.getClass().getResource(url);
url = u == null ? "" : u.toString();
}
goNew(url);
} |
184f9b43-fa79-4bf2-acc1-81c896f7c4a8 | 2 | public void removeEntity(Entity entity) {
// Delete any components owned by it too
List<IComponent> entityComponentList = entity.getAllComponents();
for (IComponent IComponent : entityComponentList) {
// Get the class of the component
Class<?> componentClass = IComponent.getClass();
/*
* Remove the e... |
f821f02e-6bf6-42dd-af00-3fcaa1915e7a | 0 | public void setName(String name) {
this.name = name;
} |
a5492469-da09-4314-b8fc-67c6c5ff0f23 | 4 | public void updateGrid(final boolean[][] grid)
{
if (lifeGrid != null)
{
Graphics g = lifeGrid.createGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, width, height);
g.dispose();
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
... |
ce75a983-eb2c-48c5-8d63-65d954152824 | 8 | public static Point getMoveInput () {
String input = "";
int x = 0;
int y = 0;
boolean inputOK = false;
Scanner sc = new Scanner (System.in);
while (! inputOK) {
String message = null;
System.out.print("Geef een veld in (rij + kolom): ");
input = sc.nextLine();
if (input != null) {
if ... |
0eeeed66-e3dd-4244-a2b8-cb6f449ceaa2 | 7 | private void activityListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_activityListValueChanged
int indx = activityList.getSelectedIndex() - 1;
if (indx + 1 == oldIndx) {
return;
}
//System.out.println(editingAct);
transferChanges(false)... |
52a70751-ff87-4936-91a3-5a6728f09d21 | 0 | protected boolean test6 () { return true; } |
be56106a-11a4-4436-9027-b42468d68c99 | 2 | public static Job recv(BufferedReader in){
Job job = new Job();
try {
job.id = Integer.parseInt(in.readLine());
job.query = in.readLine();
job.source = in.readLine();
job.destination = in.readLine();
} catch (NumberFormatException e) {
... |
fc8b87e4-f3dd-40cc-bb73-683ccd154b15 | 4 | static HashMap<String, String> validateFields(Class model, Object object) {
HashMap<String, String> errors = new HashMap<>();
Field[] fields = getFields(model);
for (Field f : fields) {
try {
if (f.get(object) == null) {
errors.put(f.getName(), Ser... |
f299b42d-f2e1-4463-aba0-3d97a63b4dd5 | 9 | public void setProfBoard(Player player, String profession) {
Scoreboard board = resetBoard(player);
Objective objective = board.getObjective(player.getName());
objective.setDisplayName(ChatColor.BOLD + profession);
Map<String, Object> levels = plugin.getConfig().getConfigurationSection("... |
0520724f-76bb-4e4f-9085-b2082963a7b5 | 1 | public static void saveConfigFile(String filename) {
StringBuffer buf = new StringBuffer();
buf.append(XMLTools.getXMLDeclaration());
String line_ending = "\n";
buf.append(line_ending);
PropertyContainerUtil.writeXML(buf, frameInfoList, 0, line_ending);
try {
FileTools.dumpStringToFile(new File(filename)... |
c81e3d39-4fbe-4d8e-83c5-fbf6deb558bd | 7 | public synchronized void hideNode( final Node hideNode, final Node focusNode ) {
if (hideNode==null || focusNode==null) return;
new Thread() {
public void run() {
synchronized(LocalityUtils.this) {
if (!locality.getCompleteEltSet().contains(hideNode) ... |
510930ef-c5c8-4935-82ea-2b482342ad3f | 4 | public void receive() {
String[] data = client.receiveMessage();
if (data == null) return;
/* ICMP message */
if (data.length == 3) {
int type = Integer.parseInt(data[0]);
String src = data[1];
String message = "";
if (type == ICMP_Header.UNREACHABLE) {
String badHost = data[2];
... |
a8c95996-2e16-4223-95ea-f59def2d533e | 4 | @Override
public void focusLost(FocusEvent evt) {
if (evt.getSource()==buynumber){
if (buynumber.getText().equals("")) buynumber.setText("0");
}
if (evt.getSource()==sellnumber){
if (sellnumber.getText().equals("")) sellnumber.setText("0");
}
} |
9902b352-4367-4474-8f5d-b45097e111ee | 5 | public static String[] or(String expression) {
ArrayList se = new ArrayList(); // Subexpressions.
int start = 0;
int level = 0;
for (int i = 0; i < expression.length(); i++) {
if (expression.charAt(i) == '(')
level++;
if (expression.charAt(i) == ')')
level--;
if (expression.charAt(i) != '+')
... |
57728f51-88c3-492e-94a4-bba798bf6255 | 5 | public void analyse() throws UnsupportedAudioFileException, IOException, ParserConfigurationException, SAXException
{
File[] filearray = getAllFiles();
for(File f : filearray)
{
Load loader = new Load(config);
Map<String,String> contentfolder1 = loader.loadFilenameToContentMap(config.getTestordnerPath() + ... |
2ecf7dcf-cbab-4570-a191-9b6f05489ec6 | 0 | public boolean getUp(){
return moveUp;
} |
9f0c014d-e74f-4da1-b832-2a2d29e06724 | 7 | public void actionPerformed(ActionEvent e){
Object o = e.getSource();
if(o == tPause){
if(tPause.isSelected())
tPause.setText("Start");
else
tPause.setText("Pause");
setPause();
}else if(o == tComboBox){
String tTime = (String)tComboBox.getSelectedItem();
sleeptime = Integer.parseInt(tTime)... |
d9fde0f2-5771-45bf-934d-43012aa93d88 | 4 | public void leaveArena(Player player)
{
for (int i = 0; i < this.teams.size(); i++)
if (((Team)this.teams.get(i)).containsPlayer(player))
{
PlayerInfo p = ((Team)this.teams.get(i)).findPlayer(player);
p.teleport((Location)this.winArea.Spawn.get(p.team.TeamId));
((Team)this.team... |
dcbf5b84-b522-4983-820b-d1d03daa8430 | 3 | public static void main(String[] args) {
ArrayList list;
int length;
double sum;
double mean;
boolean running = true;
while(running){
list = ordering();
length = list.size();
sum = 0;
for(int j=0; j < length; j++){
... |
80f0ca40-4c58-4f0a-b025-455f1a04491e | 3 | public boolean createKey(String key) {
try {
if (METHOD_CREATE_KEY_EX == null) {
METHOD_CREATE_KEY_EX = getMethod(mRoot.getClass(), "WindowsRegCreateKeyEx", int.class, byte[].class);
}
OpenResult result = new OpenResult((int[]) METHOD_CREATE_KEY_EX.invoke(mRoot, new Object[] { mRootKey, toCstr(key) }));
... |
4b97813a-a047-4195-a141-a54f187402ec | 0 | public boolean isSelected(TreeNode node) {
return selectedNodes.containsKey(node);
} |
889b2171-6102-47db-85d4-54bd81e145c0 | 0 | public void setIsNull(String isNull) {
this.isNull = isNull;
} |
b9e831ad-a9eb-48e8-bd19-ed375f0893f9 | 9 | public boolean isStillBacking() //connect ball
{
Ball tempList[] = (Ball[]) stack.peek();
Ball ball = tempList[0].getConnect();
int[] xer = ball.getSmallXCoor();
int[] yer = ball.getSmallYCoor();
boolean tf = false;
if(tempList.length>1)
for(int i=0; i<ball.getSmallBallNum(... |
47432194-d3ae-4fc6-872b-1c221168d25e | 6 | public static void main(String[] args) {
int count = 0;
if(args.length < 1){
System.exit(-1);
}
while(count < args.length){
switch(args[count]){
case "-h":
System.out.println("Metatagger");
System.out.println("-g runs gui mode");
System.out.println("-t initates tagger mode");
count... |
b4da7831-8b3f-4d47-b77f-927e490f88cb | 0 | @Override
public void testAssumptionFailure(Failure failure) {
setFailedOrIgnoredForFailureOrAssumptionFailure(failure, TestState.blocked);
} |
dd0fedc6-1808-499d-a6ce-d77ae777c20f | 4 | private boolean isMoving(){
if(state == StateActor.UP || state == StateActor.DOWN || state == StateActor.LEFT || state == StateActor.RIGHT){
return true;
}
else return false;
} |
defe6c39-22fc-40d5-b8b6-6f871021d3b2 | 6 | private Set<TKey<?, ?>> setupGeneralKeys() {
Set<TKey<?, ?>> generalKeys = new HashSet<>();
generalKeys.add(DatasetKeys.NAME);
generalKeys.add(DatasetKeys.IDENTIFIER);
generalKeys.add(DatasetKeys.COUNTRY);
generalKeys.add(DatasetKeys.INGESTION_STATUS);
generalKeys.add(Dat... |
53513d80-cd7c-4365-a8b4-af8eba5adccc | 1 | @Override
public void removeServerStopListener(ServerStopListener listener) {
if (serverStopListenerList != null) serverStopListenerList.remove(ServerStopListener.class, listener);
} |
0abf65c8-12ee-4d32-a397-f3e079cf1ee8 | 8 | public static void main(String[] args) throws IOException, ParseException {
int mb = 1024*1024;
Runtime rTime = Runtime.getRuntime();
System.out.println("totalMem\t:"+rTime.totalMemory()/mb);
int classNumber = 5; //Define the number of classes in this Naive Bayes.
int Ngram = 1; //The default value ... |
45d53417-785e-4a60-ba66-3f3a539e39ea | 9 | public boolean hasCycles() {
// check for cycles
boolean[] bDone = new boolean[m_nNodes];
for (int iNode = 0; iNode < m_nNodes; iNode++) {
// find a node for which all parents are 'done'
boolean bFound = false;
for (int iNode2 = 0; !bFound && iNode2 < m_nNodes; iNode2++) {
if (!bDone[iNode2]... |
0aface90-bdc8-4e05-ac3a-5749bb4fa948 | 9 | public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof ChiTietSachId) ) return false;
ChiTietSachId castOther = ( ChiTietSachId ) other;
return ( (this.getMaSach()==castOther.getMaSach()) || ( this.getMaSac... |
2838ab23-21c8-48d7-bafb-4ba92fa63630 | 5 | public static String md5sum(File file) {
String localMd5Sum = null;
if (file.exists() && file.isFile() && file.canRead()){
try {
MessageDigest md = MessageDigest.getInstance("MD5");
DigestInputStream dis = new DigestInputStream(new FileInputStream(file), md);
dis.on(true);... |
daa41fea-3c3d-4d73-85ff-5debad59d7d8 | 6 | @SuppressWarnings("unchecked")
public Object getProperty(String path) {
if (!path.contains(".")) {
Object val = root.get(path);
if (val == null) {
return null;
}
return val;
}
String[] parts = path.split("\\.");
Map<St... |
55713334-bcc6-4058-8b6b-9c270f0d24ce | 1 | public String getScore() {
if (ifScore) {
return score.toString();
} else {
return "Счет не ведется";
}
} |
2c843c64-1edc-4676-a532-5ed576c68a10 | 6 | public static int stringMatch(String str, String match) {
if (match == null || match.length() == 0)
return 0;
int[] table = KMPStringMatch.buildPrefixTable(match);
for (int i = 0, j = 0; i < str.length();) {
if (str.charAt(i) == match.charAt(j)) {
if (j == match.length() - 1)
return i - j;
... |
907b8f58-3fd6-4b52-940d-6cf7fad8857f | 2 | public void openDoors(Vector3f translation) {
for(Door door : doors)
{
if(door.getTransform().getTranslation().sub(translation).length() < OPEN_DISTANCE)
{
door.openDoor();
}
}
} |
b8f53158-57d1-4dc9-877f-1d85f0077068 | 5 | public void print(String message) {
if(message == null){
message = "null";
}
StringBuilder output = new StringBuilder();
String[] words = message.split(" ");
for(int i=0; i<words.length; i++){
if((words[i].length() + output.length()) * 8 > MAX_WIDTH){
break;
}
output.append(" " + words[i]);
... |
1cb46483-a864-45dd-8b9c-20db16cc3d68 | 6 | private List<PseudoSequence> buildProjectedDatabaseForSingleItem(Integer item, List<PseudoSequence> initialDatabase,Set<Integer> sidSet) {
// We create a new projected database
List<PseudoSequence> sequenceDatabase = new ArrayList<PseudoSequence>();
// for each sequence in the database received as parameter
loop... |
fc28a88e-4c3b-44d4-8321-c87824973f1e | 6 | private Map<MoveMessageType, Board> getAppropriateMoveAfterShift(
Board board, int playerID, Position targetPos, Position shiftPos,
boolean shiftTarget) {
PositionType forbiddenPos = board.getForbidden();
if (!shiftPos.isInsertablePosition())
throw new IllegalArgumentException("Invalid position of shiftca... |
27cb3e80-4689-478f-a71b-c586eafb88c8 | 0 | @Override
public boolean isSourceMethod(SootMethod sMethod) {
return this.matchesMethod(sMethod, this.sourceMethods);
} |
333b79f0-1b6f-45bb-aa99-9b51d800fffd | 7 | public Object[] compileToClassFiles(String source,
String sourceLocation,
int lineno,
String mainClassName)
{
Parser p = new Parser(compilerEnv, compilerEnv.getErrorReporter());
Sc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.