method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
06703e44-8a5a-4748-8c9a-8cea1eabc258 | 3 | private static void updateFlights()
{
int i;
Date lastFlightDate = new Date();
Date nextFlightDate = new Date(System.currentTimeMillis()+ 24*60*60*1000);
ArrayList<Flight> newFlightList = new ArrayList();
for(Flight flight:flightList)
{
... |
6d83776c-e0ce-455b-bab0-3e73ce105069 | 4 | public Point getPoint(Widgets widgets) {
for (Widget w : widgets.get(548)) {
if (w.getActions() != null) {
for (String s : w.getActions()) {
if (getName().equals(s)) {
Widget par = w.getRoot();
return new Point(pa... |
b62de16b-2cfe-41f9-8b41-be118cfed50e | 7 | public void purgeEvent(int[] idx){
if(idx.length==0){
return;
}
System.out.println("PURGE: "+numF1+", "+idx.length);
this.numF1=this.numF1-idx.length;
double[][][] new_weight = new double[numCode][numF1][];
for(int i=0;i<idx.length;i++){
... |
fa5c7f9a-cfad-4a0d-be5c-88f3ca1cb687 | 4 | public void loadMapParts(String directory, String[] partNames) throws IOException{
for(int i = 0; i <= partNames.length-1; i++){
FileReader fr = new FileReader(directory+partNames[i]);
BufferedReader br = new BufferedReader(fr);
int mapPartID = Integer.parseInt(br.readLine());
int mapWidth = Integer.pars... |
2ba90d79-25ea-4834-8ad8-1c3d3b1095de | 0 | public void doNewGame()
{
Timer.getInstance().stop();
SettingsDialog.getInstance().showDialog();
} |
88cdc3fd-9e5b-4932-a121-119056058df6 | 9 | private void report (ArgFace argFace) {
if (argFace instanceof ArgProcedure) {
setArgumentVariables(argFace);
}
if (aOpt) {
System.out.println("-a");
if (aSize != null) {
System.out.println("size: " + aSize);
}
}
if ... |
916a0f8b-31eb-43d6-b4a4-872ecb1510a2 | 7 | @Override
public void update(Observable o, Object arg) {
if(o instanceof Timer && !(arg == null) && arg instanceof Integer && (Integer)arg <= 36000 && (Integer)arg >= 0){
int timestamp = (Integer) arg;
if (timestamp >= nextCar) {
if (timestamp != 1){
cs.a... |
46766a88-37d1-49ac-a73f-4a95bd45db55 | 0 | public InputStream getInputStream() {
return is;
} |
b442f537-6674-47c1-b4d8-aaa923306450 | 9 | @Override
public boolean equals(Object o)
{
if (o == null)
return false;
Booking b = (Booking)o;
if ((b.media== null) || (b.booker == null)
|| (b.bookingDate == null))
return false;
if ((this.media== null) || (this.booker == null)
|| (this.bookingDate == null))... |
73d76c7b-3850-4625-b0ce-7c6ef4f2e15b | 9 | public void readMessage(InputStream in) throws IOException{
// if(!intro){throw new RuntimeException("Haven't called readHandShake() till completion!?!");}
while(in.available()>0){
if(size==-1){
off+=in.read(sizeBuf, off, 4-off);
if(off == 4){
off = 0;
size = ByteUtils.readInt(sizeBuf,0);
b... |
1f2a80d1-0298-4abf-91aa-abddb023399b | 4 | public void makeStep() {
for (int i = 0; i < levelSize; i++) {
for (int j = 0; j < levelSize; j++) {
if (Level[i][j] != null && Level[i][j].is(Worm.class)) {
makeWormTurn(i, j);
}
}
}
spawnRandomBacteries();
rese... |
6217a999-e8d8-4991-9079-cc6ab16d601b | 8 | @Override
public void paint(Graphics g) {
if (state == GameState.Running) {
// background goes on bottom
g.drawImage(background, bg1.getBgX(), bg1.getBgY(), this);
g.drawImage(background, bg2.getBgX(), bg2.getBgY(), this);
// then Rachel's bullets
ArrayList<Bullet> rachelBullets = rachel.getBullets();... |
a975feb3-2ecd-4029-9155-fc9bacb90b1d | 8 | public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = Utils.getExtension(f);
if (extension != null) {
if (extension.equals(Utils.tiff) ||
extension.equals(Utils.tif) ||
extension.equals(Utils.gif)... |
7ef1f704-352a-4518-b32c-ae67723d8da7 | 1 | public StagShopBackgrounds(StageManager stageManager, Map<String, String> data) {
super(stageManager, null);
PlayerData.load();
backgrounds = new ArrayList<>();
buttons = new BufferedImage[2][2];
addBackground("/graphics/level/background/BlueBackgroundPixel.png");
addBackground("/graphics/level/background/C... |
f4bc8acf-5c56-481a-8900-587bb49e0834 | 1 | public void update(Level lvl, Avatar player){
Rectangle2D rectPlayer = new Rectangle2D.Float(player.getX(), player.getY(), 18, 18);
Rectangle2D rectDoor = new Rectangle2D.Float(this.x+10, this.y+10, 10, 10);
if(rectPlayer.intersects(rectDoor)){
lvl.setCompleted(true);
}
} |
52160261-6d43-452b-8323-ff1a47fd0149 | 5 | private static void setLength(FileSystem fileSystem, String file, long length) throws TestFailedException {
FileHandle handle;
try {
handle = fileSystem.openFile(file, true, true);
} catch (PathNotFoundException e) {
throw new TestFailedException(e);
} catch (AccessDeniedException e) {
throw new TestFa... |
4dc28146-36e4-4869-a7e7-0e71f0c28421 | 8 | public void writeData(String filename){
try {
File dir = new File("Data/");
if (!Files.exists(dir.toPath())) {
dir.mkdirs();
}
int num=1;
String name=filename+num;
File file = new File("Data/"+name+".txt");
while(Files.exists(file.toPath())){
num++;
name=filename+num;
file = new ... |
558009de-9561-4d7d-be2e-dd5dc0e355f7 | 7 | public void submitJob(JobInfo jobInfo) {
//1. Talk to the NameNode and get the Chunk Information
//1.1 As the appropriate Slave to move the JAR to all the NODES
try
{
if(this.nameNodeReference.checkFileExistence(jobInfo.getJobConf().getInputPath()))
{
InputFileInfo inputFileInfo = this.nameNodeRef... |
e6e3173b-3f63-4e0f-913b-8594b79e1d96 | 6 | public supplierMain() {
initComponents();
order newOrder=new order();
loadSupplier();
newChequeTable.checkAndUpdate();
this.loadCheques();
this.loadBank();
this.searchedPanel.setVisible(false);
this.orderTable.setVisible(false);
currentDate=newOrde... |
9f0fc53e-dca1-4f82-b509-5adfc61378a6 | 1 | @Override
public int wordCount() {
if(realInstruction == null)
return 0;
return realInstruction.wordCount();
} |
7446f5a7-1c8e-4acc-b56b-c566a15f7cbe | 2 | public void run()
{
while(true)
{
move(direction);
move();
repaint();
try{Thread.sleep(10);}catch(Exception ignored){}
}
} |
6729ac0b-4ef2-4a6a-9781-502a09458f87 | 8 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (cmd.getName().equalsIgnoreCase("soup"))
{
if (sender instanceof Player)
{
final Player p = (Player) sender;
if(p.hasPermission("EasyPvpKits.SoupCommand"))
{
if(plugin.SoupCo... |
e8bf203c-3bee-4a39-80ac-b43857a9e493 | 3 | public int reverseBits(int i){
int lowerHalf = 0x0000FFFF & i;
int upperHalf = 0xFFFF0000 & i;
for(int j=0; j<32; j++){
int isolator = 1 << j;
int bitToMove;
int amountToShift;
if(j<16){
bitToMove = isolator & lowerHalf;
amountToShift = Math.abs(15-j) * 2 + 1;
}
else{
bitToMove = ... |
d75d7fb2-9371-48c6-968b-8369790b637f | 6 | public AddAccountWindow(){
setSize(150, 235);
setVisible(false);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
setLayout(new BorderLayout());
JLabel background=new JLabel(ResourceLoader.Iconload("/addAccountBackground.jpg"));
background.setSiz... |
adf44266-f5b4-4fc3-ae56-b417fe789e78 | 0 | private AnswerSideManager()
{
} |
56ccd5de-359e-47b5-b636-fe29bdb02c07 | 8 | private static void find(LinkedList<LinkedList<Integer>> disjointSets, int placeFrom, int placeTo,
boolean foundFrom, boolean foundTo, int positionFrom, int positionTo) {
Iterator<LinkedList<Integer>> itr = disjointSets.iterator();
foundFrom = false;
foundTo = false;
positionFrom = 0;
positionTo = 0... |
484bd3c1-09cf-4ac1-82ba-90da86ef7807 | 4 | public static int edit3(String string1, String string2){
int length1, length2;
length1 = string1.length();
length2 = string2.length();
int F[][] = new int[length1+1][length2+1];
for(int i = 0; i <= length1; i++) {
F[i][0] = i;
}
for(int i = 0; i <= l... |
8a22fc94-0d5d-4564-84ae-bf2f29441ff1 | 7 | public RatatouilleView(SingleFrameApplication app) {
super(app);
initComponents();
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener()... |
df2120b6-2caf-449a-9cf8-ca3ad0f8bc3c | 2 | private void initializeRocks() {
for(int i = 0; i < 250; i++) {
Point point = getRandomLocationOnGrid(525);
if(getElements().contains(new Rectangle(point.x,
point.y, GameModel.getUnit(), GameModel.getUnit()))) {
i++;
continue;
} else {
addRock(point);
}
}
int UNIT4 = GameModel.getUnit... |
5b25eb4a-3e48-44b5-be86-14c606e9c4ca | 9 | private Object readArgument(char type) {
switch (type) {
case 'i' :
return readInteger();
case 'h' :
return readBigInteger();
case 'f' :
return readFloat();
case 'd' :
return readDouble();
case 's' :
return readString();
case 'c' :
return readChar();
case 'T' :
return ... |
e4a609c8-afcb-4560-af98-627cf4b79ad7 | 4 | private void jButtonCouleurValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCouleurValiderActionPerformed
if (this.jButtonCouleurValider.getText().equals("Modifier")){
try {
RequetesCouleur.updateCouleur(((Couleur)this.jComboBoxCouleurs.getSelectedItem(... |
ad89ca41-fb6c-4994-a6a6-4bcfe40fe212 | 7 | public static void startupSpecialize() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((M... |
d3b65528-2dd6-4cda-9333-2acd4f51cdbb | 2 | public Comprador(int idComprador, String tipoComprador, String zona, int cantDeEntradas, String espectaculo, String nombreLocal, Double tiempoIngreso) {
this.setIdComprador(idComprador);
this.setTipoComprador(tipoComprador);
this.setZona(zona);
this.setCantDeEntradas(cantDeEntradas);
... |
c313503f-9662-4330-a64d-fc9160849738 | 2 | private static IFile[] converterIFile(File[] files) {
IFile[] iFiles = new IFile[files.length];
int cntr = 0;
for (File f : files) {
try {
IFile iFile = new SystemFile(f.getAbsolutePath());
iFiles[cntr++] = iFile;
} catch (InvalidArgumentEx... |
b270cbb7-a25c-4f56-951a-6be590aa3b7c | 4 | public void findJavascriptFilesRecursively(File file, Collection<String> paths) {
if (file.isDirectory()) {
for (File f : file.listFiles()) {
findJavascriptFilesRecursively(f, paths);
}
} else {
if (!file.getName().startsWith(".") && file.getName().endsWith(".js")) {
paths.add(file.getAbsolutePath(... |
3ba8f617-6b0b-48d6-ad6a-53cb703deef8 | 5 | public EField getField(int x, int y) {
try {
if (!(x >= 0 && x < gameSize && y >= 0 && y < gameSize))
throw new ExceptionLog("Ошибка: обращение к полю, находящемуся за пределами игровой сетки.");
} catch (ExceptionLog e) { e.print(); }
return field[x][y];
} |
1144113a-ed69-441d-9f94-6060e8e2c62a | 3 | public boolean isStart(String codon) {
if (codon.length() == 3) return startCodons.contains(codon.toUpperCase());
for (int i = 0; i < codon.length(); i += 3) {
int max = Math.min(codon.length(), i + 3);
String codonSigle = codon.substring(i, max);
if (startCodons.contains(codonSigle.toUpperCase())) return... |
366dadae-7f32-4d0e-8b6b-2657cd805da7 | 3 | public int getTestExceptions(UUID batchId, Boolean persist){
int exceptions=0;
if(persist){
connectDb();
String env = System.getenv("ENV");
String tableName = env.substring(0, 1).toUpperCase() + env.substring(1).toLowerCase() + "TestResults";
try {
... |
93dda352-fbb7-4d1b-b8cf-57d589615754 | 6 | private Point selection(List<Point> points, int index, int type) {
List<Integer> list = new ArrayList<Integer>();
for (Point p : points) {
if (type == 0) {
list.add(p.x);
} else {
list.add(p.y);
}
}
int value = Selection... |
c1ae4f2a-13a2-4253-b358-b282950919bf | 6 | public Production[] replacements(Production production) {
String rhs = production.getRHS(), lhs = production.getLHS();
if (rhs.length() == 1) {
// Given that unit productions have been removed, this
// must be a terminal production.
throw new IllegalArgumentException(production
+ " is a terminal produ... |
9c490bd0-c590-4408-812f-9597f5d833c7 | 4 | public void hit(int damage) {
if(dead || flinching) return;
health -= damage;
if(health < 0) health = 0;
if(health == 0) dead = true;
flinching = true;
flinchTimer = System.nanoTime();
} |
2adef6c6-9320-4fb5-b2ed-8577a5ffdc08 | 2 | private DefaultMutableTreeNode getSelectedNode( )
{
TreePath
selectionPath = dataTr.getSelectionPath();
if ( selectionPath == null )
return(null);
DefaultMutableTreeNode
selectedNd = (DefaultMutableTreeNode)selectionPath.getLastPathComponent();
if ( !dataRootNd.isNodeDescendant(selectedNd) )
return(null);
... |
f17d31a9-47d7-427b-9fa6-301a5a0e90a9 | 4 | public int validateSimpleRequest(String method, String url) {
if (method.equals("GET") || method.equals("POST")) {
if (fileManager.findFile(url).exists()) {
return 200;
} else {
return 404;
}
}
if (method.equals("HEAD")) {
... |
6157a5bc-ac77-4beb-9649-792adffb14d9 | 4 | public static String bytesToHexString(byte[] src) {
StringBuilder stringBuilder = new StringBuilder("");
if ((src == null) || (src.length <= 0)) {
return null;
}
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder... |
e2ada237-1e17-4ddc-bde6-4e406276fc9a | 8 | public static void dirMonitor(String uri){
try {
//
// Creates a instance of WatchService.
//
WatchService watcher = FileSystems.getDefault().newWatchService();
//
// Registers the logDir below with a watch service.
//
... |
24fde32a-af1d-4fdd-b813-96f58a0021a6 | 9 | public void setCheckerBoard() {
for (int x = 0; x < checkersSpaces.length; x++) {
for (int y = 0; y < checkersSpaces.length; y++) {
checkersSpaces[x][y] = new JButton("");
if (x % 2 == 0) {
if (y % 2 == 0) {
checkersSpaces[x][y].setBackground(Color.white);
checkersSpaces[x][y].setEnabled(f... |
017e93d5-be64-482f-9b76-19e0c7849eaf | 3 | @SuppressWarnings("unchecked")
@Override
public final int compareTo(Pair<F, S> other) {
int result;
if (mFirst instanceof Comparable) {
result = ((Comparable<F>) mFirst).compareTo(other.mFirst);
} else {
result = Numbers.compare(mFirst.hashCode(), other.mFirst.hashCode());
}
if (result == 0) {
if (... |
5ce60ea6-8084-4831-a0cb-3ca170791316 | 0 | public K getSymbol() {
return symbol;
} |
920610d7-e964-465e-a5b5-9092ad3ed90b | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
c194179c-7891-4e9b-8573-edd9ac2399b4 | 8 | public void stop(int a) {
switch(a) {
case 0:
movingUp = false;
for(int i=0;i < Play.l.size();i++) {
Play.l.get(i).unCollide(0);
}
break;
case 1:
movingDown = false;
for(int i=0;i < Play.l.size();i++) {
Play.l.get(i).unCollide(1);
}
break;
case 2:
movingLeft = false;
for(in... |
03ad1daf-9580-4378-97e9-47c7256115c8 | 3 | private HashSet<Integer> calcTargets(int start, int steps, HashSet<Integer> list, HashSet<Integer> visited) {
steps = steps - 1;
Cell cell = new Cell(start);
visited.add(start);
if(steps == 0) {
list.add(start);
} else {
for (int adjCell : cell.getAdjList()) {
HashSet<Integer> visitedTemp = new Hash... |
97d5297a-477c-4852-8e50-014619a9e8d9 | 6 | protected static Ptg calcRoman( Ptg[] operands )
{
int[] numbers = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
String[] letters = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
String roman = "";
if( operands.length == 1 )
{
double dd = operands[0].getDoubleVal();... |
cf245511-8707-487f-974d-7dd0b8086b5c | 7 | public void acceptResult(ResultProducer rp, Object[] key, Object[] result)
throws Exception {
if (m_RP != rp) {
throw new Error("Unrecognized ResultProducer sending results!!");
}
Instance newInst = new DenseInstance(m_AttributeTypes.length);
for(int i = 0; i < m_AttributeTypes.length; ... |
5afcf5ce-27bf-4269-838e-1c75679159ec | 6 | private static void createPath(int from, int step, int to, int lMax, int lCurr, int places,
ArrayList<Integer> road,final List<List> roads,final List<SynchroState> template){
if(lMax == lCurr){
if(step == to){
road.add(step);
roads.add(road);
... |
938ffa30-1829-433d-b27f-7648d47dd39b | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with... |
712294d5-8373-46aa-b8a1-864900653d6c | 0 | public String getNom() {
return nom;
} |
73aa97fd-ab16-4c98-a019-7e0ebf7758e3 | 6 | private static String[] splitLine( String line ) {
List<String> matchList = new ArrayList<String>();
// This regex works but includes the quotes in the final result.
Pattern regex = Pattern.compile( "[^\\s\"']+|\"[^\"]*\"|'[^']*'" );
// This regex removes the quotes (does it really??)
// Pattern regex = Pattern... |
10b73f8a-ac4c-4bd0-8c48-4b571f31b100 | 1 | private boolean jj_2_72(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_72(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(71, xla); }
} |
c645601c-318e-4526-82a3-d528edb28c37 | 0 | public Sprite getSprite() {
return sprite;
} |
01419413-39c8-4728-aedb-3190827274eb | 4 | public void drawRoomObjects(JFrame frame, boolean addClickableFct) {
List<Item> roomObjectsInDrawFunction = getRoomObjects();
for (int cntItemPic = 0; cntItemPic < roomObjectsInDrawFunction.size(); cntItemPic++) {
if (Runtime.checkStep(roomObjectsInDrawFunction.get(cntItemPic)
.getId(), 'o', 'd')) {
St... |
71681869-faa4-4de0-9392-d861da8bec11 | 1 | public final int getFirstHeaderAsInt(String name) {
try {
return Integer.parseInt(getFirstHeader(name));
} catch (Exception exception) {
return -1;
}
} |
3be16ba7-f359-4cfa-8c97-2d9dbd604cb1 | 4 | public static long pop_andnot(long A[], long B[], int wordOffset, int numWords) {
// generated from pop_array via sed 's/A\[\([^]]*\)\]/\(A[\1] \& ~B[\1]\)/g'
int n = wordOffset + numWords;
long tot = 0, tot8 = 0;
long ones = 0, twos = 0, fours = 0;
int i;
for( i = wordOffset; i <= n - 8; i += 8 ) {
/**... |
6f4e038d-439d-4ee4-888d-6f813bcacf5c | 9 | private List<Posicao> posicoesPossiveisTorre(Posicao posicao) {
List<Posicao> posicoesPossiveis = new ArrayList<>();
int[] posicoesVariantes = new int[2];
int colunaAtual, linhaAtual;
/*
* a cada etapa de iteracao serao verificadas uma horizontal e uma
* vertical. o s... |
2f5c7982-c1f1-4dd5-a37a-db068ef3b354 | 1 | public Object clone() {
final Expr[] d = new Expr[dimensions.length];
for (int i = 0; i < dimensions.length; i++) {
d[i] = (Expr) dimensions[i].clone();
}
return copyInto(new NewMultiArrayExpr(d, elementType, type));
} |
f26222b6-fb39-40cc-be7e-3144b3996c8e | 4 | public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() && clazz != void.class ? primitiveTypeToWrapperMap
.get(clazz) : clazz);
} |
196c5ed2-400f-4fa9-9248-d8d01f2427fb | 6 | public static File getMinecraftFolder() {
JsonNode minecraftFolder = INSTANCE.versionData.getNode("install", "minecraftFolder");
String osType = System.getProperty("os.name").toLowerCase();
String userHomeDir = System.getProperty("user.home", ".");
String mcDir = ".minecraft";
if... |
7f3678c6-9209-4604-a35b-7342ecb95bde | 2 | public static String readFile(String name) {
StringBuilder b = new StringBuilder();
try {
BufferedReader r = new BufferedReader(new FileReader(name));
String line;
while ((line = r.readLine()) != null) {
b.append(line).append('\n');
}
... |
cfd8d5b3-dcdf-4c30-b262-36f5bb7495fb | 8 | public double[] getNormalWeights()
{
double ret[] = new double[weight.length];
double totalsum = 0.0;
double truesum = 0.0;
int totalindex = 0;
for (int i = 0; i < weight.length; i++)
{
totalsum += weight[i];
if (index[i])
{
truesum += weight[i];
t... |
223d8e69-db32-4494-8ba8-3c8560c63ee2 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DfsItem other = (DfsItem) obj;
if (d != other.d)
return false;
if (x != other.x)
return false;
if (y != other.y)
retur... |
aa10f925-acbe-4e69-a9b0-73865d8bd3fe | 1 | public Iterator iterator() {
return new Iterator() {
int pos = 0;
public boolean hasNext() {
return pos < count;
}
public Object next() {
return locals[pos++];
}
public void remove() {
if (pos < count)
System.arraycopy(locals, pos, locals, pos - 1, count - pos);
count--;
... |
17b96178-5523-4dd1-948d-9a4d26eef522 | 9 | public void update(CustomPath cp) {
EnumSet<PathContents> c = cp.getContents();
Path path = cp.getPath();
boolean containsResource = false;
boolean containsScripts = false;
if (!c.contains(PathContents.READONLY)) {
c.retainAll(EnumSet.of(PathContents.DEFAULT));
List<String> files = getCo... |
f240686f-113e-464c-aec3-e7cf50681e8e | 7 | private boolean checkBalance(Container[][][] level, int maxDiff){
int difference = 0;
int topWeight = 0;
int bottomWeight = 0;
for(int i = 0; i < 3; i++){
for(int j = 0; j < 5; j++){
for(int k = 0; k < 1; k++){
topWeight += level[i... |
417027c0-45d8-4cfe-a28d-28292bc7d43d | 2 | private int getMediumHistoricResult(){
Iterator<Roll> it = historical.iterator();
int total=0;
while(it.hasNext()){
Collection results = it.next().getRollResult();
Iterator<Integer> it2 = results.iterator();
int subtotal=0;
while(it2.hasNext()){
... |
ec5a7516-7290-42d1-8c9d-ae8251b513fb | 2 | public void persistGenerator(double minSupportLevel, double minConfidenceLevel) {
String sqlStatement;
dao.connect();
sqlStatement = generateInsertStmt(minSupportLevel, minConfidenceLevel);
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.executeUpdate(sqlStatement);
}
if(dao.getErrorLogs().getError... |
5c7aede7-145d-4763-95d8-fbe8450284ad | 3 | public long playGame(final Board start, List<Integer> nextPiece)
{
//System.out.println(start);
//System.out.println("avail moves: " + nextPiece.size());
Board curBoard = new Board(start);
Board.Direction nextDirection;
int moves = 0;
long startTime = System.nanoTime();
do
{
nextDirection = this.... |
0fb9f721-4abb-4521-9061-02120333aa8a | 0 | public boolean isEmpty() {
return map.isEmpty();
}//isEmpty |
bd3b39af-953d-4fe3-9ec1-9bbd7b7ff23f | 9 | public static void convertStringToInt(String inputString)
{
inputString = "-90";
if(inputString == null || inputString.length() == 0)
{
System.out.println("String is empty...");
}
int result = 0;
int value = 0;
int negative = 0;
... |
39aed699-a481-4d36-b307-fc21d28b80d8 | 4 | Vector<Integer> getSortedPentagonNeighbors(int cellId) {
Vector<Integer> neighbors = getNeighbors(cellId);
Vector<Integer> result = new Vector<>(6);
Util.initialize(result, -1);
Vector<Integer> northRow = new Vector<>(2);
Vector<Integer> sameRow = new Vector<>(2);
Vect... |
65b5c0e0-eb35-4660-bbc6-056df981af73 | 3 | private String getName(String url) {
if (url.indexOf("_") > 0) {
url = url.substring(url.indexOf("_") + 1);
}
//format topic name
url = url.replace('+', ' ').replace('_', ' ');
try {
Translator translate = Translator.getInstance();
url = tra... |
11b96675-1bc3-480e-b332-9c3036a251d8 | 9 | public SyntheticAnalyzer(MethodInfo method, boolean checkName) {
this.method = method;
if (method.getBytecode() == null)
return;
if (!checkName || method.getName().equals("class$"))
if (checkGetClass())
return;
if (!checkName || method.getName().startsWith("access$"))
if (checkAccess())
return;... |
82a5b95a-2f52-42ab-9e82-391d8ca7a290 | 5 | public void printBlock(Writer w) throws Exception {
if(!printed) {
printed = true;
w.write(getNodeName() + " [label=\"" + getNodeName() + "\\l");
for(Instruction i : instructions) {
i.printInstruction(w);
w.write("\\l");
}
... |
1eeaac8c-138e-4e2a-9f3a-5bc6e889f2d5 | 9 | private void BtIncluirServicoCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtIncluirServicoCompraActionPerformed
boolean inclui = true;
limpar.Limpar(TbCompra);
TfQuantidadeServKeyReleased(null);
TfValorTotalCompra.setValue(BigDecimal.ZERO);
if (!TfCodS... |
32ae933e-4c9d-4b0f-b5bd-de6d5d11ceae | 5 | public void scanPickup() {
if (absX == apickupx && absY == apickupy) {
if (ItemHandler.itemExists(apickupid, absX, absY)) {
int itemAmount = ItemHandler.itemAmount(apickupid, apickupx, apickupy);
if (addItem(apickupid, itemAmount)) {
ItemHandler.removeItem(apickupid, apickupx, apickupy, itemAmount);
}
}
else if (hasntL... |
acbc556d-2435-4729-a1bc-342085dd0e6c | 8 | public ClickableObject(int x, int y, int w, int h) {
if (x >= 0 && y >= 0) {
xy = new Location(x,y);
} else if (x < 0 || y < 0) {
throw new IllegalArgumentException("All values must be non-negative");
}
if (w < 1 || h < 1) {
throw new IllegalArgumentEx... |
ca622f8e-8298-460d-b9dd-32ada20e15d1 | 5 | public void convertToUndirectGraph(UndirectedGraph<Integer, DefaultEdge> undirectGraph, IGraph graph){
for (int v = 0; v < graph.V(); v++) {
if(!undirectGraph.containsVertex(v)) undirectGraph.addVertex(v);
Iterator<Integer> graphIterator = graph.adjIterator(v);
while (graphIterator.hasNext()) {
int nextV... |
427371ec-7886-4db3-a303-243ed6a0d6f5 | 7 | public int[] bellmanFord(int src, List<HashMap<Integer, Integer>> adjList) {
final int[] dists = new int[adjList.size()];
int[] prev = new int[adjList.size()];
Arrays.fill(dists, Integer.MAX_VALUE);
dists[src] = 0;
for (int i = 0; i < adjList.size(); i++) {
for (int j = 0; j < adjList.size(); j++)
f... |
7297dfb5-7fd6-4ae9-925b-fe0a75e83981 | 5 | public void hideWires() {
if (!this.hiddenwires) {
this.hiddenwires = true;
if (this.jBreadBoard.getMode() != null && this.jBreadBoard.getMode().equals("wire")) {
this.jBreadBoard.setMode("move", "OK");
}
Component[] components = this.getComponentsInLayer(Circuit.WireLayer);
for (Component compon... |
a0fd794a-fcc1-4d10-a91a-316b3d6c7c1a | 2 | @Override
public void Borrar(Object value) {
Session session = null;
try {
Ejecutivo ejecutivo = (Ejecutivo) value;
session = NewHibernateUtil.getSessionFactory().openSession();;
session.beginTransaction();
session.delete(ejecutivo);
... |
ac875160-a9dc-4285-9a20-0a6863ca6e24 | 0 | @Override
public String toString() {
return StringUtil.concatenateStrings("Employee: id - ", id.toString(), ", name - ", name);
} |
4679807e-ae76-426b-ba38-548c1c39e09c | 1 | public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
for (Ball b : balls)
{
g2.fill(b.getShape());
}
} |
86c431b5-ae1c-45d6-9b18-ee510ab6978e | 3 | protected static JSONObject index(JSONObject view) throws Exception {
JSONObject result = new JSONObject();
JSONArray rows = view.getJSONArray("rows");
for (int i=0; i<rows.length(); i++) {
JSONObject r = rows.getJSONObject(i);
JSONArray keys = r.getJSONArray("key");
JSONObject current = result;
f... |
c2777dde-6c3b-4436-a2a2-cd4d6ea1ade3 | 1 | public static void insertMultipleExtendedNetworks(ExtendedNetwork eNet){
//Recover the arraylist with all the NetworkData from the Rest Interface MultipleCreate
ArrayList<ExtendedNetworkData> multiExtData = eNet.getNetworks();
//call insertNetwork for every network NetworkData object
for (int i=0; multiEx... |
56e1ecdb-b39a-46f1-9bfd-853b32887a71 | 8 | public static double parseLocalizedNumber(String input) throws NumberFormatException{
try {
input = removeWhiteSpace(input);
int numCommas = 0;
int numPeriods = 0;
int lastComma = -1;
int lastPeriod = -1;
for(int i = 0; i < input.length(); i++){
char c = input.charAt(i);
if(c == ','){
... |
bda25232-af13-4104-a538-62ee107cc930 | 3 | public Player getPlayerCopy(String name){
if(name == null) return null;
for(Player p : allPlayers){
if(p.getName().equals(name)){
Player copy = new StandardPlayer(name);
copy.setPoints(p.getPoints());
copy.setLetterTiles(p.getLetterTiles());
copy.setSpecialTiles(p.getSpecialTiles());
return ... |
91750777-a059-4189-870a-b33edd093744 | 8 | public List<Email> loadEmail(){
List<Email> emailList=new ArrayList<Email>();
File filePath=new File(PERSISTENCE_PATH);
if(filePath.isDirectory()){
String[] fileList=filePath.list();
if(fileList.length==0){
//没有文件
return null;
}
for (int i = 0; i < fileList.length; i++) {
File file=new Fil... |
f5bded76-4dfb-44a4-bd1f-b340a5357384 | 1 | public List<Device> buildList(String filename) throws BuilderException{
List<Device> devices = null;
String content;
try {
content = FileInput.readContent(filename);
ByteArrayInputStream instraem = new ByteArrayInputStream(content.getBytes());
devices = build(instraem);
return devices;
} c... |
8ffb2e23-092b-4026-b96d-8d2ba12c1f30 | 6 | public static List<Integer> matchingAction(RS2Environment env, String action) {
List<Integer> matching = new ArrayList<Integer>();
for(int id=0; id<env.getWorld().getMaxObjectId(); id++) {
ObjectDefinition def = env.getWorld().getObjectDefinition(id);
if(def != null && def.getActions() != null) {
for(Stri... |
fb0e9fac-c07a-402d-87cf-d10eb6fd9c1b | 4 | private boolean cmdStopGame(CommandSender sender, String[] args) {
String worldName = null;
if(args.length >= 1)
worldName = args[0];
AbstractGame game = null;
if(worldName != null) {
game = games.get(worldName);
} else {
if(sender instanceof Player) {
World world = ((Player)sender).getWorld();
... |
63d2b866-1d2d-472c-a0c1-9c9e80c11b22 | 6 | public boolean solveProblem(char[][] board){
for (int i=0;i<9;i++)
for (int j=0;j<9;j++){
if (board[i][j]=='.'){
for (int t=1;t<=9;t++){
board[i][j] = (char)('0'+t);
if (isValid(board, i, j)&&solveProblem(board))
... |
16a628b3-4e3a-49f2-96f1-a0250fc66deb | 6 | @Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
SHService shService= null;
try {
shService = this.shServiceClientM.getSHService();
}
catch (RemoteException e1) {
throw new IllegalStateException("RemoteException occured. Could not get the service to move the play... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.