method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
828ee8ff-3223-4ca8-a2f3-59b9b7e72431 | 9 | public void startBoard(Scanner inputReader) {
// Asks user for the number of players
System.out.println("Welcome to Cludo");
System.out.println("Please enter the number of players (3-6)");
while (inputReader.hasNext()) {
int num = inputReader.nextInt();
inputReader.nextLine();
// Checks for a valid nu... |
12905a1d-759d-44f6-b040-860cd4b70757 | 6 | public double testMove(Board testBoard, Piece move) {
PieceColor myColor = this.player.getColor();
PieceColor theirColor = myColor.getOpposite();
testBoard = testBoard.getDeepCopy();
ArrayList<Piece> validMoves = new ArrayList<Piece>();
ArrayList<Piece> nextValidMoves = new ArrayList<Piece>();
i... |
c88a2cce-77a5-4c5e-830b-2b3a06b15221 | 3 | public int search(String value) {
if (!reversed) {
reverse();
}
int i = 1;
Element tmp = firstElement;
while (tmp != null) {
if (tmp.getValue().equals(value)) {
return i;
}
tmp = tmp.getNextElement();
i++... |
57be717a-fbda-4c33-bd9c-75b23404928c | 4 | public boolean isNearlyLowerHessenberg(double tolerance){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(i>(j+1) && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false;
}
}
... |
a7c812af-6cf7-4a63-8444-16a2a83dcfff | 6 | private void jbHuntGatherKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbHuntGatherKeyPressed
if (evt.getKeyCode() == KeyEvent.VK_H) {
jbHowToPlayActionPerformed(null);
} else if (evt.getKeyCode() == KeyEvent.VK_E) {
jbExitActionPerformed(null);
} else if (e... |
d7e6ed1d-1590-4a06-9f07-ce8dd5b6aac5 | 2 | SQLExecutor() {
readData();
setPassword();
List<String> list = getFileList();
int i;
for (i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
executeScript(directory + File.separator + list.get(i));
}
if (i > 0) {
... |
1e64f3e0-6043-4f64-b6ab-7bfe86d9fc14 | 7 | protected static ShapePoint makePointForCell(TextGrid.Cell cell, TextGrid grid, int cellWidth, int cellHeight, boolean allRound){
if (DEBUG)
System.out.println("Found point at cell "+cell);
if(grid.isCorner(cell) && allRound){
return new ShapePoint(
cell.x * cellWidth + cellWidth/2,
cell.y * cel... |
9e32e5b5-912f-4ba4-8be8-c0dcad170cbd | 3 | public boolean compare (Coord c, float e){
return this.x > (c.x - e) && this.x < (c.x + e) &&
this.y > (c.y - e) && this.y < (c.y + e);
} |
57865520-bcf1-4b18-b835-b57978d8add0 | 2 | private void initBlocks(String dir, int initNumberOfBlocks) throws IOException {
for (int i = 0; i < initNumberOfBlocks; i++) {
freeBlocks.offer(createBlock(i));
blockCount.incrementAndGet();
}
activeBlock = freeBlocks.poll();
if (activeBlock == null) {
... |
50823c0e-9dd0-4936-8885-06fb5ddab57f | 4 | private synchronized void fillProductList(Category[] categories) {
logger.fine("running fillProductList()");
productList = mdi.getProductsByCategoryPath(categories);
String[] header = new String[]{"Produktgruppe", "Artikelnummer",
"Artikelbezeichnung"};
List<String[]> rows = new ArrayList<String[]>();
... |
116de4a0-eda0-4ebd-856d-352f49070e32 | 9 | private void collision(Rectangle rectSpieler, Rectangle rectangleTmp) {
if (rectSpieler.intersects(rectangleTmp)) {
Level.run = false;
if ((rectangleTmp.x + rectangleTmp.width >= rectSpieler.x)
&& rectangleTmp.x + rectangleTmp.width <= rectSpieler.x
+ rectSpieler.width) {
this.playerx += 1;
}... |
3c599640-ba5a-454d-9132-562b192d182c | 8 | public void signalSel(int fn) {
for (int i = 0; i < 256; i++) {
totFreqs[i] = totFreqs[i] + freqs[fn][i];
}
fCost = new int[freqs.length];
for (int i2 = 0; i2 < freqs.length; i2 ++) {
freqs[i2] = new int[256];
}
if (! enCalc) {
fCost = new int[freqs.length];
}
p... |
fc0ed056-f7ad-4e50-a941-da51b3e622ad | 9 | public void go(){
distance = distance + (double)speed/90;
speed = speed + acceleration;
speedL = speed/10;
km_hSpeed = speed * 2;
y -= dy;
if (speed <= 0) speed = 0;
if (speed >= maxSpeed) speed = maxSpeed;
if (layerX2 - speed <= 0){
layerX1 = 0;
layerX2 = 1100;
} else {
layerX1 = layer... |
ffe7acc1-a948-4f04-b9fa-f3f20bc256e7 | 8 | public static void main(String[] args) throws IOException {
long inicio = System.currentTimeMillis();
StringBuilder out = new StringBuilder();
BufferedReader in;
File archivo = new File("entrada");
if (archivo.exists())
in = new BufferedReader(new FileReader(archivo));
else
in = new BufferedReader(new... |
68737e8c-1bf5-4bf7-9d51-4d943f99ee33 | 8 | public static int getAuctionPrice( int auctionID ) throws DatabaseException {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
int uid, bids;
String qGetAuctionPrice = "SELECT currentprice FROM auctionprice WHERE auctionID = ?";
try {
conn = DBPool.getInstance().getConnection()... |
5858e8e3-8502-4132-933d-ff2b2b580e36 | 0 | public static OthelloBoardBinary getBoard(long binHasDisk,long binIsBlack, boolean isBattingFirstTurn){
OthelloBoardBinary board = new OthelloBoardBinary();
board.binHasDisk = binHasDisk;
board.binIsBlack = binIsBlack;
board.isBattingFirstTurn = isBattingFirstTurn;
return board;
... |
e05dfbf4-fec1-41ef-9257-211b3e21f60b | 4 | public void handleInput() {
if (allowClick) {
if (game.keybord.singlePress(game.keybord.escape)) {
game.log.gsm("[PLAY] Paused");
gsm.setPaused(true);
game.jukeBox.play(game.jukeBox.tracks.buttonClick);
}
if (game.debug) {
if (game.keybord.singlePress(game.keybord.f12)) {
game.player.se... |
b28f1856-ce4b-4813-b241-b70302483ad4 | 8 | public void processGuess(EventArgs e) {
JQuery stats = $$(JQuery.class, "stats");
TextBox guessEntryField = $$(TextBox.class, "guessEntryField");
int guess;
try {
guess = Integer.parseInt(guessEntryField.getValue());
} catch (NumberFormatException ex) {
J... |
b1686368-41ee-4601-9684-40c1485d2b20 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof ILerngruppe))
return false;
ILerngruppe other = (ILerngruppe) obj;
if (name == null) {
if (other.getName() != null)
return false;
} else if (!name.equals(other.get... |
a8a88d09-c3af-4778-b49a-02f279089c91 | 3 | protected synchronized void handleRecieveBlock(Block block) {
System.out.println("block recieved!");
// here goes the code to handle the block broadcast
// get the block , add it to the tree
SignedBlock sb = (SignedBlock)block;
try {
this.blockTree.addBlock(sb);
// generate a diag... |
938ee9dd-0d4e-423a-bc52-b265e0e9a801 | 2 | public String toXML() {
Error error = getError();
if(error != null) {
return error.toXML();
}
StringWriter sw = new StringWriter();
String xml = "";
try {
JAXBContext context = JAXBContext.newInstance(this.getClass());
Marshaller marshaller = context.createMarshaller();
marshaller.m... |
a063bdb4-5903-47eb-a96c-f9d6fd7d0ab3 | 4 | private void turn(char turnDirection) {
if (turnDirection == 'L') {
setFacing(getFacing() - 1);
}
else if (turnDirection == 'R') {
setFacing(getFacing() + 1);
}
//keeps the directional constants within the bounds
if (getFacing() < NORTH) {
... |
a8598d37-1db4-4015-8c3d-58805dca2e16 | 3 | private ByteBuffer Read(int i) {
ByteBuffer out_buf = ByteBuffer.allocate(i);
byte buf[] = new byte[i];
int len = 0;
while (len < i) {
try {
len += in_s.read(buf,0,i);
} catch (Exception e) {
System.out.println("Read error: " +... |
5c55c80c-c1b8-4c6c-9438-b1fa7ca134d5 | 1 | @Override
//public int getDistribution(double standardDeviation)
public int getDistribution()
{
//keeps track of packets created
int PacketCounter = 0;
while (PacketCounter < NumberOfPackets)
{
int val = (int) (mean + standardDeviation * rand.... |
fbd06420-ee10-4ea5-97e6-32b412f90564 | 3 | public static void main(String[] args) {
for (int gCount = 0; gCount <= 2000000; gCount++) {
ArrayList<Hand> Hands = new ArrayList<Hand>();
Deck d = new Deck();
for (int hCnt = 0; hCnt <= Hands.size(); hCnt++) {
Hand h = new Hand(d);
h.EvalHand();
Hands.add(h);
}
Collections.sort(Hands,... |
ab2f72df-d9f2-4724-8b2d-64b80ec19ae0 | 0 | public int getColonnes() {
return Integer.parseInt(vTxtColonnes.getText());
} |
0aa36038-d2a8-4b29-a00e-3d59edce49b9 | 0 | public static void main(String[] args){
System.out.println("Enter an int > 3: size of the track");
Scanner s = new Scanner(System.in);
int trackSize = s.nextInt();
System.out.println("track Size: " + trackSize);
DogTrack d = new DogTrack(trackSize);
d.playGame(); ... |
1fe85a3e-2fdc-4185-8f36-86fa8c0fe5af | 0 | public Peer(String ip, int port, ByteBuffer peerId) {
this.ip = ip;
this.port = port;
this.hostId = String.format("%s:%d", ip, port);
this.setPeerId(peerId);
} |
4c524b9d-aab0-4052-b281-bb17b227edd7 | 1 | public static Settings getInstance() {
if (instance == null)
instance = new Settings();
return instance;
} |
2924d49e-f95a-427b-abba-10cac0a223b9 | 9 | public void assignAmusementParkTickets(int day) {
// LIst to store interested clients and their respective values
List<ClientValuePair> amusementParkInterest = new ArrayList<ClientValuePair>();
// Find each customer that could use an alligator ticket that day
for (int ii = 0; ii < 9; ii++) {
if (ii < 8) {
... |
3d796ece-6a8d-4495-9d92-4ad24829a9e8 | 8 | private void GameLoop()
{
long visualizingTime = 0, lastVisualizingTime = System.nanoTime();
long beginTime, timeTaken, timeLeft;
while(true)
{
beginTime = System.nanoTime();
switch (gameState)
{
case R... |
70e77d00-4908-4f7a-8209-9d2b85497e4a | 0 | public String getFossil() {
return this.fossil;
} |
f86d707b-78de-40fa-a16a-c0d179c4e205 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
903c4276-6310-41d5-9256-b06eb464a939 | 3 | private boolean clickedOnKingPile(MouseEvent e) {
//Beautiful
return e.getX() >= X_BOARD_OFFSET + CARD_WIDTH + CARD_X_GAP && e.getX() <= X_BOARD_OFFSET + CARD_WIDTH * 2 + CARD_X_GAP && e.getY() >= Y_BOARD_OFFSET && e.getY() < Y_BOARD_OFFSET + CARD_HEIGHT * 4 + CARD_Y_GAP * 3;
} |
d364b01c-3efb-47f0-80aa-6abc44b72683 | 6 | * @param high: last index of the object list.
* @return: index of the pivot element.
*/
int partition(int low, int high){
int i = low, j = high + 1, mid = (high - low) / 2;
// Find the pivot object's index
int pivotIndex = findPivot(low, mid, high);
// Swap element at 'low' with pivot
T pivot = this.... |
a418c56e-3052-4497-a846-beefcbc1a365 | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
char letraActual = 0;
char letraObjetivo = (campoLetra.getText().charAt(0));
textArea.setText("");
if(letraObjetivo >= 'a' && letraObjetivo <= 'z') {
letraActual = ... |
a92675c5-f7e0-40c1-90d5-562b11c6449e | 9 | public static String cleanString(String str) {
Transliterator accentsconverter = Transliterator.getInstance("Latin; NFD; [:Nonspacing Mark:] Remove; NFC;");
str = accentsconverter.transliterate(str);
//the character ? seems to not be changed to d by the transliterate function
StringBuffer cleanedStr = new... |
f7dcc8d7-3d77-4dad-9eaf-e940044b7b8a | 5 | @Override
public final void repair() {
final String baseValue = this.main.getConfigValue(Main.GLOBAL_SECTION,
Main.PATH_KEY, null);
if (baseValue == null) {
System.out
.println("Unable to determine base - The local repository could not been deleted");
return;
}
final Path base_ = Path.getPath(ba... |
281a693d-6490-4c60-a765-5bdea8d1c471 | 1 | private void sendLogs_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendLogs_settingsButtonActionPerformed
if (debug)
logger.log(Level.DEBUG, "Setting preference \"sendLogs\" from " + settings.sendLogs() + " to " + sendLogs_settingsButton.isSelected());
... |
8d99e5d6-51d4-414e-b5c2-d8a7468e1f09 | 7 | public boolean insert(DataRow row)
{
if(!checkUser())
{
return false;
}
DataRow parameter = new DataRow(row.getAttribute("name").getValue());
parameter.setTableName(row.getTableName());
parameter.addAttribute("userName", getUserName());
if(!select(... |
1c6d5bba-f59f-4c8f-a613-46d938b4dab6 | 8 | private ListNode merge2(ListNode l1, ListNode l2) {
ListNode header = null;
ListNode last = null;
ListNode cur = null;
ListNode n1 = l1;
ListNode n2 = l2;
if (n1 == null) {
return n2;
}
if (n2 == null) {
return n1;
}
while (n1 != null && n2 != null) {
if (n1.val>n2.val) {
cur = new List... |
4068d2b9-1875-4a4c-a354-442f156e0c5b | 4 | public static boolean hasSurf(Pokemon[] pokemon)
{
for (Pokemon aPokemon : pokemon) {
if (aPokemon != null) {
for (int j = 0; j < 4; j++) {
if (aPokemon.move[j] == Pokemon.Move.SURF)
return true;
}
}
}
... |
c6e4a6e8-115c-44f1-a394-5115cc77146e | 3 | public boolean copy(File src, File dst){
try {
// Copies src file to dst file.
// If the dst file does not exist, it is created
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to o... |
526e0c88-1e16-4846-a6ed-1bd368cfed41 | 1 | public boolean isDelete() {
return !(myAdd || myChange);
} |
d62c6045-9f73-4078-8932-75ba90f0b6a6 | 9 | public Class<?> getColumnClass(int column) {
switch (column) {
case 0:
return ImageIcon.class;
case 3:
return Long.class;
case 4:
return Date.class;
case 5:
case 6:
case 7:
case 8:... |
c47bbed3-6e5f-4c17-b83f-f715e12cd3dc | 7 | Point3f getMax() {
if (max == null)
max = new Point3f();
if (list.isEmpty()) {
max.set(0, 0, 0);
return max;
}
Object3D c = list.get(0);
max.x = c.getMaxX();
max.y = c.getMaxY();
max.z = c.getMaxZ();
synchronized (list) {
int n = count();
if (n > 1) {
for (int i = 1; i < n; i++) {
... |
10a7d084-8400-4452-8f23-54a28f875f62 | 7 | void chooseMaxSufferage() {
/* Find the min makespan in one class, and then find the max one */
double tmpMinMakespan = Double.MAX_VALUE;
double tmpSecondMinMakespan = Double.MAX_VALUE;
double tmpMaxSufferage = -1;
int iTmpMinClass = 0;
int iTmpMinSite = 0;
int iTmpMinCPU = 0;
iMinClass = -1;
iMinSi... |
aea5e54a-fc1c-435c-8692-b942be63c91d | 9 | public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = false;
}if (e.getKeyCode() == KeyEvent.VK_A) {
leftPressed = false;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = false;
}if (e.getKeyCode() == KeyEvent.VK_D) {
rightPressed = false;
}
... |
6b8ce6cc-8a20-49d6-8959-ada301cad650 | 6 | public void setHidden( boolean b )
{
int h = 0;
if( b )
{
h = Boundsheet.HIDDEN;
}
mysheet.setHidden( h );
if( mysheet.getSheetNum() == 0 )
{
try
{
Boundsheet s2 = mybook.getWorkSheetByNumber( mysheet.getSheetNum() + 1 );
mybook.setFirstVisibleSheet( s2 );
}
catch( WorkSheetNotFoun... |
5100f0a6-3a7f-4249-9fd9-c919c2c7c544 | 6 | @Override public int compareTo(VersionWebsiteCompare that) {
if(that == null)
return 1;
String[] thisParts = this.get().split("\\.");
String[] thatParts = that.get().split("\\.");
int length = Math.max(thisParts.length, thatParts.length);
for(int i = 0; i < length; i+... |
d9be23d3-133e-40c6-889e-25e740591cd7 | 4 | private static void assertFullConsumption(Object obj, JsonReader reader) {
try {
if (obj != null && reader.peek() != JsonToken.END_DOCUMENT) {
throw new JsonIOException("JSON document was not fully consumed.");
}
} catch (MalformedJsonException e) {
throw new JsonSyntaxException(e);
... |
4affc25c-f544-4d43-a62f-bf9a055c4915 | 7 | public MacroStatement(SourceFile sourceFile, int lineNo,
Token[] definition, Token[][] body) throws SyntaxError {
super(sourceFile, lineNo, definition);
if(!definition[0].is(TokenType.MACRO_START)){
throwSyntaxError(0, "Not a macro");
}
if(!body[body.le... |
e2ad880d-648a-4300-85d8-25dedb5477bf | 3 | @Override
public void deserialize(Buffer buf) {
requestId = buf.readUByte();
if (requestId < 0 || requestId > 255)
throw new RuntimeException("Forbidden value on requestId = " + requestId + ", it doesn't respect the following condition : requestId < 0 || requestId > 255");
contac... |
3a8f6b70-0b4f-43e6-bb34-763aee05ed33 | 1 | private void initializeEmptyBoard() {
for (int i = 0; i < board.length; i++) {
board[i] = new ChessPiece[SIDE];
}
} |
3721dd4a-60e0-4390-ac94-5a20075bbd1a | 7 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new FileReader("in.in"));
perdedores = new ArrayList<String>();
od1enses = new ArrayList<String>();
for (String line; (line=in.readLine())!=null;) {
od1enses.add(line);
}
vo = new boolean[od1enses.size()];
... |
197c6781-4ecb-4e8b-b252-6e4ab7c8b70c | 2 | public static Polynomial rootsToPoly(double[] roots){
if(roots==null)return null;
int pdeg = roots.length;
double[] rootCoeff = new double[2];
rootCoeff[0] = -roots[0];
rootCoeff[1] = 1.0;
Polynomial rPoly = new Polynomial(rootCoeff);
... |
14ece755-52b2-44a1-94ea-55bbaedf3ba3 | 8 | static private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
return 5;
}
switch(curChar)
{
cas... |
5a686871-ca85-4130-b5d6-4315c0ecc638 | 7 | private void populateDataSecondPass(String assemblyLine) throws AssemblerException {
insNumber++;
boolean legitIntDataLine = Pattern.matches(
"[A-Za-z0-9]+\\s+[0-9]+MAU\\s+[^\\s]+", assemblyLine);
boolean legitAsciiDataLine = Pattern.matches(
"[A-Za-z0-9]+\\s+.ascii\\s+\".+\"", assemblyLine);
boolea... |
279b848f-7995-488a-9748-01966407ea04 | 8 | public boolean permittedTypeDamage(LifeType... entTypes) {
/**
* @if Confere se foi passado duas entidades ou uma entidade para o
* método.
*
* Caso for passado dois então o método vai ser utilizado para
* comparar a possibilidade de tirar vida em uma colisão de duas
* entidades.
... |
fd894137-5be0-417f-906c-57d77103caa1 | 6 | private void resizeImage()
{
int h = image.getH();
int w = image.getW();
if(h % 8 == 0 && w % 8 == 0)
{
System.out.println("Image does not need resizing.");
wasResized = false;
return;
}
wasResized = true;
if(h % 8 != 0)
{
h += 8 - (h % 8);
}
if(w % 8 != 0)
{
w += 8 - ... |
e8e9c5be-b16c-4e64-9300-bc1bf0f7ec46 | 0 | @Override
public final void testIgnored(Description description) throws Exception {
super.testIgnored(description);
selectListener(description).testIgnored(description);
} |
6868e07f-f189-4ee7-ab7b-398c4bf93f3e | 9 | public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption("min", options);
if (tmpStr.length() != 0)
setMinThreshold(Double.parseDouble(tmpStr));
else
setMinThreshold(-Double.MAX_VALUE);
tmpStr = Utils.getOption("min-default", options);
... |
61a2ddda-30a4-412f-90e9-268657c904af | 2 | public String moveCardOntoCardFromDeck(int boardIndexTo) {
if (boardIndexTo == 0) {
//Moving onto dragon's tail, anything goes.
board.get(0).add(deck.poll());
return "";
} else {
String result = moveCardOntoCard(Arrays.asList(deck.peek()), boardIndexTo, 0)... |
cded0a3f-e3a7-44fb-a6de-81c6f2c4aa3c | 9 | public boolean isStalemated(boolean isWhite) {
Piece piece = null;
int row = 0;
int col = 0;
int numMoves = 0;
boolean result = false;
Piece king = null;
ArrayList<Move>legalMoves = new ArrayList<Move>();
while (row < 8 && numMoves == 0) {
col = 0;
while (col < 8 && numMoves == 0) {
piece = bo... |
1568a40c-0247-4e59-b489-57a5426bab81 | 3 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int curr = 0;
int untreated = 0;
while(n-->0){
int t = in.nextInt();
if(t<0){
if(curr <= 0) untreated++;
else curr-=1;
} else {
curr+=t;
}
}
System.out.println(untreated);... |
04dc4144-a07c-4d09-a500-9da7ce71907e | 2 | private static boolean equals(byte[] a1, int offs1, byte[] a2, int offs2, int num) {
while (num-- > 0) {
if (a1[offs1++] != a2[offs2++]) {
return false;
}
}
return true;
} |
9c57e4fa-9b17-439e-966d-9c7bb90cbc85 | 7 | public static void main(String[] args)
{
final double STARTRATE = 10;
final int NRATES = 6;
final int NYEARS = 10;
// set interest rates to 10 . . . 15%
double[] interestRate = new double[NRATES];
for (int j = 0; j < interestRate.length; j++)
interestRate[j] = (STARTRATE... |
a5398758-ef21-4669-bcd9-673836a1d2be | 5 | public static void isNested(String arg[]){
char [] p = { '(','(','(', ')', '(', ')', ')', '(', ')'};
Stack<Character> openP = new Stack<>();
boolean malformed;
int count = 0;
for(char c : p){
if(c=='('){
count++;
openP.push(c);
... |
ae821ad1-b3c8-4919-be7a-92014b28c6de | 9 | private static void matchRoles() {
final ArrayList<Player> matched = new ArrayList<Player>();
final int maxtraitors = TIMV.config.getInt("MaxTraitors");
final int maxdetectives = TIMV.config.getInt("MaxDetective");
final Random r = new Random();
for (final Player player : Bukkit.getOnlinePlayers()) {
if (!... |
2a148d4f-d698-4617-802d-cf9cc8fba627 | 3 | public ReleaseType getLatestType() {
this.waitForThread();
if (this.versionType != null) {
for (ReleaseType type : ReleaseType.values()) {
if (this.versionType.equals(type.name().toLowerCase())) {
return type;
}
}
}
... |
fd3d0ff3-2baa-460a-80e8-ac43ba460501 | 2 | public void testToStandardWeeks_months() {
Period test = Period.months(1);
try {
test.toStandardWeeks();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.months(-1);
try {
test.toStandardWeeks();
fail();
... |
78ae5ebe-352f-4e3e-ab43-f81fbc33adbe | 0 | public static int weightingMerge(int value) {
/* if (value >= 2048) return value * 20;
if (value >= 512) return value * 12;
if (value >= 128) return value * 8;
if (value >= 32) return value * 4; */
return value;
} |
0ea7fae1-2c10-47ff-af66-9c62d771199f | 9 | public void restoreIpAddressesHelper(String s, int index, StringBuilder sb,
ArrayList<String> result, int counter) {
// StringBuilder sbLocal = new StringBuilder();
if (counter > 4) {// to speed up
return;
}
if (index >= s.length()) {
if (counter == 4) {
sb.deleteCharAt(sb.length() - 1);// delete '... |
d1a8c54c-4fcf-42bc-9e97-6f0c6b6f0a96 | 9 | public static boolean isValidVector(Vector4f vector) {
if (vector == null) return false;
if (Float.isNaN(vector.x) ||
Float.isNaN(vector.y) ||
Float.isNaN(vector.z)||
Float.isNaN(vector.w)) return false;
if (Float.isInfinite(vector.x) ||
Float.isInfinite(vector.... |
360af2aa-d740-47ed-aedb-3d6251c1dc1f | 9 | public void countDiffPixels() {
if (image1 == null || image2 == null) {
return;
}
int w1 = image1.getWidth();
int h1 = image1.getHeight();
int w2 = image2.getWidth();
int h2 = image2.getHeight();
int wmax = ... |
1e0d74df-db7d-47b1-b53b-37407632fdf2 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaxonObservationFilter)) {
return false;
}
TaxonObservationFilter other = (TaxonObservationFilter) object;
if (... |
a463eb24-e8db-4420-bfc7-6d7ae5d09714 | 5 | private void ButtonRapportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonRapportActionPerformed
int idd = (int) jTable3.getModel().getValueAt(jTable3.getSelectedRow(), 0);
String pattern = null;
String path;
FileNameExtensionFilter filter = new FileNameExtension... |
2ae02ac8-be04-4937-ac72-c3f999358bea | 4 | public void run() {
if (!this.player.isOnline())
return;
if (!this.player.hasPermission("vijoslogin.login") && player.isOnline()) {
player.kickPlayer("\u00A7a[GeoPalz]\u00A7f \u00A7cIncorrect permissions!\u00A7f");
}
if (this.getLogin()) {
VijosLogin.i().sendLoginMessage(this.player);
}
} |
57efcf1c-b940-4790-a42a-5f51eaa0525d | 0 | public void matchesAbstract()
{
Filter isAbstract = isAbstract();
assert isAbstract.matches( AbstractFilter.class );
assert !isAbstract.matches( Filter.class );
} |
affcf502-793a-4004-89fc-dc68adb63963 | 7 | public static void startupSystems() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (S... |
ef11557c-f133-4e04-b2f7-f74ed9826499 | 1 | private boolean jj_3R_94() {
if (jj_3R_72()) return true;
return false;
} |
076c6cdf-cd51-428a-8e55-3c781e050791 | 5 | private static void method499(char ac[]) {
boolean flag = true;
for (int j = 0; j < ac.length; j++) {
char c = ac[j];
if (isLetter(c)) {
if (flag) {
if (isLowerCaseLetter(c))
flag = false;
} else if (isUpperCaseLetter(c))
ac[j] = (char) ((c + 97) - 65);
} else {
flag = true;
... |
ab4650d3-de21-4bde-9ec1-902f49203130 | 2 | @Override
public <T> void update(Class<T> clazz, Long id, Map<String, String[]> valuesOfFields) {
if (dao.getObject(clazz, id) == null){
throw new RuntimeException("Object not found");
}
if (clazz == Faculty.class){
addFaculty(valuesOfFields, id);
... |
c8b64361-239c-494a-a094-b2c7197fc485 | 9 | public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.magenta);
int tileSize = parent.tilePanel.getTileSize();
//fill rect by tilemap width (tileID[0]) and tilemap height (tileID[0][0])
g.fillRect(0, 0, tileID[0].length * tileSize... |
347ec260-e9ee-41b2-8fc3-c647159566fe | 5 | private void show(String[] data){
String option = null;
try {
option = data[1].toLowerCase();
} catch(Exception e){
System.out.println("Invalid command! Try to input command once more!");
return;
}
switch(option){
case "all":
if(container.isEmpty())
System.out.println("List of employees is em... |
6a644959-33f1-4a84-8316-6a38024f8674 | 2 | public void render(){
if(Game.UI.getSelectedEntity() != null && Game.UI.getSelectedEntity() == this){
GL11.glColor3d(1,0,0);
}else{
GL11.glColor3d(1,1,1);
}
} |
2e1ea9de-7814-4e63-855f-245f9ed12fa6 | 9 | public static Line2D.Double longestVectorWithSignalStrength(List<Measurement> measurements, int threshold) {
int strongestPos = -1;
HashSet<Integer> items = Generate.randomInts(threshold, measurements.size(), null);
for(int i : items) {
if(strongestPos < 0) {
strongestPos = i;
continue;
}
if(mea... |
7718a5b6-39ca-4819-a2aa-3c0e8fc6e6da | 1 | public void creaXLS(HttpServletResponse response) throws ServletException, IOException {
ConexionBD bd = new ConexionBD();
ArrayList<Equipo> equipos = bd.reportes(marca, numero, familia, tipoEquipo, fechai, fechaf, departamento, ubicacion, responsable, estado);
response.setContentType("applicati... |
b9e4f66f-33c3-469c-af55-35cfd942c8a4 | 8 | public static void writeHaploStructFiles(String fName, PopulationData popdata)
throws IOException {
PrintWriter hsa = new PrintWriter(
new BufferedWriter(new FileWriter(fName+".hsa")));
PrintWriter hsb = new PrintWriter(
new BufferedWriter(new FileWriter(fName... |
5c10c20d-7211-4b47-bb01-83feeb7c37ed | 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... |
15c2ef21-e897-479e-aa6b-bba281b2ecc4 | 6 | public void removeBomb(Bomb b) {
soundBomb.play(1, 0.3f);
boolean hitWallNorth=false, hitWallEast=false, hitWallWest=false, hitWallSouth=false;
bombs.remove(b);
b.getTile().setBurning();
int tilex = b.getTile().getGridx();
int tiley = b.getTile().getGridy();
int bombSize = b.getBombSize();
/* Handles t... |
bc134f0a-ebdf-4b27-b2e7-320b82271d1f | 7 | private void closeRequest(OnDemandData onDemandData) {
try {
if (socket == null) {
long l = System.currentTimeMillis();
if (l - openSocketTime < 4000L)
return;
openSocketTime = l;
socket = clientInstance.openSocket(43594 + Client.portOffset);
inputStream = socket.getInputStream();
outp... |
f8cc4eb3-b668-42f9-8a6d-f59c50bd74be | 3 | @Override
public void run() {
CImedWrapper wrapper = new CImedWrapper(this.getProxy(), this.getUsername(), this.getPwd());
boolean bServiceAvailable = false;
boolean bReportingAvailable = false;
try{
bServiceAvailable = wrapper.CheckServiceAvailable();
LOGGER.debug("Service Available"+b... |
9000ff08-cf3a-4f81-9276-d22c41302354 | 8 | public boolean shiftOmino(int ominoIndex, Direction direction)
{
Omino omino;
Set<Tile> borderCheck;
Tile translation;
if(ominoIndex < 0 || ominoIndex >= pieceOrder.size())
return false;
omino = pieceOrder.get(ominoIndex);
switch (direction) {
case UP:
borderCheck = omino.getBorderUp();
translat... |
d5103f1e-ac7b-4cd5-9266-9926b383ced5 | 1 | public void testFactory_FromDateFields_null() throws Exception {
try {
LocalTime.fromDateFields((Date) null);
fail();
} catch (IllegalArgumentException ex) {}
} |
bbc7247d-852d-4d12-9a0c-c24bc8b13d54 | 3 | @Override
public void run(){
while (true) {
this.ms.execForAbonent(this);
this.ticksAfterLastLotClosing++;
if(this.ticksAfterLastLotClosing == CLOSE_TICKETS_EVERY_X_TICKS){
this.closeLotsByTimeService();
this.ticksAfterLastLotClosing = 0;
... |
47417619-c6e8-43ba-aaa3-76eab220bf1f | 1 | public void setCreature(ICreature creature) {
if (creature != null) {
textArea.setText(creature.toString());
} else {
textArea.setText(null);
}
} |
0a3d0d40-19bc-413e-bd56-95d30d5ea911 | 8 | @Override
public void onClick(ClickEvent event) {
if (!imgSelected) {
final String url = Window.prompt("URL", "");
if (url != null && !url.trim().isEmpty()) {
execute(new Command() {
@Override
public void execute() {
inserter.insert(currentSurface.getSelection()... |
237785d4-e105-4a52-ae4f-5e3641b00609 | 3 | private static int getPoint(int point, int eps, int max) {
if (point + eps >= 0 && point + eps < max) {
return point + eps;
}
if (eps > 0)
return getPoint(point, eps - 1, max);
return getPoint(point, eps + 1, max);
} |
10f7622d-42e6-4259-b400-71775bce1b69 | 4 | public static String substringAfter(String sourceStr, String expr) {
if (isEmpty(sourceStr) || expr == null) {
return sourceStr;
}
if (expr.length() == 0) {
return sourceStr;
}
int pos = sourceStr.indexOf(expr);
if (pos == -1) {
return sourceStr;
}
return sourceStr.substring(pos + expr.length(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.