method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
350b658e-dbaa-41ef-8960-b564f8d04416 | 2 | public final static GameFrame getInstance(){
if (GameFrame.gameFrame==null){
synchronized(GameFrame.class){
if(GameFrame.gameFrame==null)
{
GameFrame.gameFrame= new GameFrame();
}
}
}
return GameFrame.gameFrame;
} |
1c91f203-f261-4075-9607-1ee5a23aab94 | 8 | public boolean isFour() {
boolean retBoo = false;
if (isTrip()) {
for (int i = 0; i < _cards.size()-3; i++) {
for (int x = (i+1); x < _cards.size()-2; x++) {
if (_cards.get(i).compareTo(_cards.get(x)) == 0) {
for (int p = (x+1); p < _cards.size()-1; p++) {
if (_cards.get(i).compareTo(_cards.get... |
2da562ed-e66c-4ae0-95e9-6fc82f75782b | 0 | @Test
public void runTestObfuscation1() throws IOException {
InfoflowResults res = analyzeAPKFile("AndroidSpecific_Obfuscation1.apk");
Assert.assertEquals(1, res.size());
} |
faa639a9-422b-4f46-ba62-a214ef97095a | 5 | private void layoutTabComponents() {
if (JTattooUtilities.getJavaVersion() >= 1.6) {
if (tabContainer == null) {
return;
}
Rectangle rect = new Rectangle();
Point delta = new Point(-tabContainer.getX(), -tabContainer.getY())... |
bfcc7341-d0c9-4a59-a418-79048a4e6d16 | 3 | @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
AGPlayer agp = pH.getAGPlayer(event.getPlayer().getName());
if(agp == null)
return;
if(agp.isPraying() && ConfigHandler.disableChatAndCommands) {
Messenger.sen... |
2fca1c32-2d31-4775-abc8-d7359c935ba0 | 5 | @Override
public ArrayList<String> getNames(char firstLetter, String session, boolean indexPeople) {
//create list to store the names
ArrayList<String> speakerList = new ArrayList<>();
//loop through each member of specified session
for (int i = firstLetter; i <= 'z'; i++) {
... |
90a8a6ca-eb43-4dad-ba44-2bc8f25a3dd1 | 8 | public static String SentenceTrim(String sentence){
String temp[];
if(sentence.indexOf("null")>-1){
temp=sentence.split("null");
sentence="";
for(int i=0;i<temp.length;i++){
sentence=sentence+temp[i];
}
}
if(sentence.indexOf("</p>")>-1){
temp=sentence.split("</p>");
sentence="";
f... |
3e411b2c-609c-4532-85c3-dc7b995b55fd | 4 | private GraphListener graphListener() {
return new GraphListener() {
private UmlDiagramListener[] listeners() {
return umlDiagramListeners.toArray( new UmlDiagramListener[umlDiagramListeners.size()] );
}
@Override
public void itemRemoved( Graph source, GraphItem graphItem ) {
if( graphItem instan... |
d2f7266a-5a81-4180-9a26-d1fc93fba469 | 2 | public static ServerSocket ramdomAvailableSocket() {
Random ran = new Random();
boolean accept = false;
ServerSocket socket = null;
while (!accept) {
int x = ran.nextInt(9999);
try {
socket = new ServerSocket(x);
accept = true;
} catch (IOException e) {
// TODO Auto-generated catch block
... |
eb3af69f-432d-4fd0-85d0-d7ff94642e4b | 0 | public void ResetPlayer() {
raceWin = false;
crashed = false;
//place the car on the canvas
x = random.nextInt(Framework.frameWidth - carImgWidth);
y = (int) (Framework.frameHeight * 0.70);
speedX = 0;
speedY = 0;
} |
11e25b9e-9aa7-404f-91c9-3767bca68bb8 | 0 | public static java.sql.Date utilDateToSqlDate(java.util.Date uneDate) {
return (new java.sql.Date(uneDate.getTime()));
} |
8115c04a-03c5-43d8-a422-f5695b72df0d | 8 | @Override
public void create(Object obj) throws OperacionInvalidaException
{
if (obj instanceof Vendedor)
{
Vendedor v = (Vendedor) obj;
v.setIdentificacion(vendedores.size() + 1);
vendedores.add(v);
}
else if (obj instanceof Mueble)
{
... |
ab951264-9618-4350-8b1b-d80509669c88 | 6 | public void init(){
generator = new Random();
playerList = new ArrayList<Entity>();
chargeTime = new double[10];
chargeCanceled = new boolean[10];
pushDelay = new double[10];
/*build trigonometry tables*/
double toRadian = Math.PI/(180*trigScale);
//sine
sin = new float[(90*trigScale) + 1];
... |
c78ab6ce-206c-45ba-a4ea-2598925d828c | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... |
cc672763-ee02-49c7-82f1-c7945cddafde | 1 | float[] getBandFactors()
{
float[] factors = new float[BANDS];
for (int i=0, maxCount=BANDS; i<maxCount; i++)
{
factors[i] = getBandFactor(settings[i]);
}
return factors;
} |
7193b6f1-84c4-42e9-bde1-81ecad5facc7 | 7 | public static void createTaxonomySpanningTree(TaxonomyGraph graph, TaxonomyNode node) {
if (node.label != Stella.NULL_INTEGER) {
return;
}
node.label = Stella.MARKER_LABEL;
{ TaxonomyNode maxparent = null;
int maxparentvalue = Stella.NULL_INTEGER;
{ TaxonomyNode parent = null;
... |
531d07aa-5760-4bd2-9047-438ecf289041 | 9 | public void paintComponent(Graphics g) {
super.paintComponent(g);
if (!gameRunning && !deathScreen) {
Main.background.paintComponent(g);
Main.menu.paintComponent(g);
}
if (gameRunning && deathScreen) {
g.setColor(Color.red);
g.setFont(new Font("TimesRoman", Font.PLAIN, 40));
g.drawImage(Main.back... |
2b43ee7b-4021-4231-965e-6a314c99f80d | 8 | final public void nestedSentence() throws ParseException {
/*@bgen(jjtree) nestedSentence */
SimpleNode jjtn000 = new SimpleNode(JJTNESTEDSENTENCE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(LPAREN);
... |
e7af9f7b-5da2-42f5-b3b1-0765f1758d58 | 0 | public MeasureKitString(DataStructures inData) {
this.inData = inData;
outData = new DataArrays<Integer[]>();
} |
4e2ae122-1728-4565-bb84-888e5996dd04 | 9 | @Override
public void handleInput() {
if(Keys.isDown(Keys.W)) rect.getPosition().thisAdd(0,-1);
if(Keys.isDown(Keys.S)) rect.getPosition().thisAdd(0,1);
if(Keys.isDown(Keys.A)) rect.getPosition().thisAdd(-1,0);
if(Keys.isDown(Keys.D)) rect.getPosition().thisAdd(1,0);
if(Keys.... |
bcb5ab58-e0a3-48bb-8735-a252979ce2f4 | 0 | @Override public boolean equals(Object obj){
return this.toString().equals(((Fraction)obj).toString());
} |
6154d9cb-cb5a-454e-9adf-65aa534c2028 | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]) {
if (args.length == 0)
args = new String[]{"help"};
outer:
for (BaseCommand command : plugin.commands.toArray(new BaseCommand[0])) {
String[] cmds = command.name.split(" ");
for (int i = 0; i < cmd... |
72faab41-9654-4980-a30f-694f7df9861d | 6 | public void playGame() throws Exception {
Position updatedCell;
while (!boardState.isGameOver()) {
if (boardState.getTurn() == TicTacToeBoard.PLAYER_X) {
updatedCell = playerX.getNextMove(boardState);
if (isLegalPosition(updatedCell)) {
boardState.setState(updatedCell.row, updatedCell.col,
Ti... |
19f2bb2e-e684-4668-ae41-5fe60d2589f3 | 0 | public int getPort() {
return _port;
} |
5849922a-8f61-4b20-804c-bc451f9ddcf2 | 4 | public static Direction getDirectionByLeeter(final char letter) throws NotValidDirectionException{
switch(letter){
case 'N' : return NORTH ;
case 'E' : return EAST ;
case 'W' : return WEST ;
case 'S' : return SOUTH ;
default : throw new NotValidDirectionException();//no valid direction
}
} |
7795fd07-7d1f-45e8-878b-d23e1898f083 | 2 | public void addParticleSprite(String spriteName, BufferedImage spriteImage) {
if (spriteName == null || spriteImage == null) {
throw new IllegalArgumentException("Cannot add a null sprite!");
}
particleSprites.put(spriteName, spriteImage);
} |
83958867-b9f0-4722-a7a9-d7e7f9d48640 | 5 | public int compareTo(Gleitpunktzahl r) {
if (this.vorzeichen == false && r.vorzeichen == true)
return 1;
if (this.vorzeichen == true && r.vorzeichen == false)
return -1;
int compabs = compareAbsTo(r);
if (!this.vorzeichen)
return compabs;
else
return -compabs;
} |
0cbce617-576e-4897-8c56-45efcfa8997b | 5 | private void insertion(String value, String[] oldNode, Node root){
if(oldNode.length > 2){
if(oldNode[2].equals(root.getValue())){
List<Node> children = root.getChildren();
if(oldNode[0].equals(children.get(1).getValue()) &&
oldNode[1].equals(children.get(0).getValue()) ){
root.setValu... |
a6aac3aa-13aa-4bae-b5f0-edfcb3d3d916 | 8 | public void rotate(RotationState state)
{
if (state != RotationState.TurningLeftDrifting && state != RotationState.TurningRightDrifting)
{
angularVelocity += angleIcrement * .1;
if (angularVelocity > maxAngularVel)
{
ang... |
f3402c14-657a-4a6e-931e-d357f227a40f | 7 | float clutching(SensorModel sensors, float clutch)
{
float maxClutch = clutchMax;
// Check if the current situation is the race start
if (sensors.getCurrentLapTime()<clutchDeltaTime && getStage()==Stage.RACE && sensors.getDistanceRaced()<clutchDeltaRaced)
clutch = maxClutch;
// Adjust the cur... |
6dfe29ff-79ea-4828-bbfb-65c228651c86 | 1 | static Map<String, Object> convert(Map<String, Object> m) {
LinkedHashMap<String, Object> hm = new LinkedHashMap<String, Object>();
Set<Entry<String, Object>> entrySet = m.entrySet();
for (Entry<String, Object> entry : entrySet) {
String key = entry.getKey();
key = key.re... |
6833971b-2f1f-41f6-a227-7694fbcb31f4 | 0 | public int getClaveles() {
return claveles;
} |
a565e332-8c9d-442d-bc10-9889d724fed8 | 9 | private static boolean createImageFile(BufferedImage image) {
String name = JOptionPane.showInputDialog("please enter file name.");
File f = new File(filesys.getHomeDirectory() + "/Desktop/" + name);
if (name == null)
return false;
if (!f.exists() && name != null)
try {
ImageIO.write(image, "jpg", f);
... |
9fb2fbbb-b889-4594-8a51-7fb2a3968cef | 6 | public void step()
{
boolean[][] newGrid = new boolean[height][width];
// Iterate through all cells
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
// Implement rules
boolean cell = grid[y][x];
int aliveNeighbours = getAliveNeighbours(x, y);
... |
c3b16cc2-5961-4d5f-91f3-578f619ab043 | 8 | private void getTextFromFields(){
for(int j = 0;j < repository.size();j++){
redQueryList.get(j).clear();
greenQueryList.get(j).clear();
blueQueryList.get(j).clear();
redQueryStrings.get(j).clear();
greenQueryStrings.get(j).clear();
blueQueryStrings.get(j).clear();
}
for(int i = 0;i < repository.... |
d2c28ef8-75c8-4a48-9a69-12c6da0b5df1 | 4 | public static void main(String[] args) throws Exception {
String inputPath = "./data/training.txt";
if(args.length > 0){
inputPath = args[0];
}
List<String> lines = FileUtils.readLines(new File(inputPath));
long start = System.currentTimeMillis();
for (int ... |
a5de8191-f133-400c-ac42-d6144037e7cd | 6 | public static void main(String[] args) {
System.out.print("Enter the number of lines: ");
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
int noOfGap = num - 1;
int index = 1;
for (int hrLine = 1; hrLine <= num - 1; hrLine++) {
for (int gap = 0; gap < noOfGap; gap++) {
System.out.pr... |
699c9248-af40-476c-bda9-37ca4b484fdc | 9 | public static String drawRequirementElement(RequirementElement target, RequirementElement reference, String direction)
throws ScriptException {
// customized parameters
String layer = target.getLayer();
double x = 0, y = 0;
String position = "";
if (direction.equals("up")) {
x = reference.origin_x;
... |
50e7a40a-04c2-457f-bca9-b82e7106db77 | 8 | public int func_27371_a(StatCrafting par1StatCrafting, StatCrafting par2StatCrafting)
{
int var3 = par1StatCrafting.getItemID();
int var4 = par2StatCrafting.getItemID();
StatBase var5 = null;
StatBase var6 = null;
if (this.slotStatsItemGUI.field_27271_e == 0)
{
... |
32fe860f-8f28-4566-8f82-67d8a67ef310 | 7 | private static void findC(int[][] points, int start, int end) {
int firstQ = 0, secondQ = 0, thirdQ = 0, fourthQ = 0;
for (int i = start; i <= end; i++) {
boolean posX, posY;
posX = numChangesX[i];
posY = numChangesY[i];
if (posX && posY)
firstQ++;
else if (!posX && posY)
secondQ++;
else ... |
e7cbabc6-20fc-4bf6-a3ec-42dfaa50ed69 | 0 | public SaveGraphPNGAction(Environment environment, JMenu menu) {
super("Save Graph as PNG", null);
this.environment = environment;
this.myMenu = menu;
} |
d81f861c-7a5e-4376-b8b6-794da48dae12 | 6 | public void actualizarListaProd() {
abrirBase();
tablaProd.setRowCount(0);
prodlista = Articulo.where("codigo like ? or descripcion like ?", "%" + textCodProd.getText() + "%", "%" + textCodProd.getText() + "%");
Iterator<Articulo> it = prodlista.iterator();
while (it.hasNext()) {... |
3aee2381-b840-484a-8e85-8da1b0341c8b | 4 | List<List<Integer>> traverse(Graph g)
{
int startVertex = 0;
List<List<Integer>> connectedComponents = new ArrayList<List<Integer>>();
while(startVertex != ALL_VISITED)
{
PriorityQueue<Integer> queue = new PriorityQueue<Integer>(g.vcount());
queue.add(startVertex);
List<Integer> connectedGraph ... |
db634377-cb38-4319-bf8b-8cf9583c0997 | 5 | public void process(ShipGame game) {
Ship enemy = new Ship();
enemy.name = "Enemy";
while(enemy.hp > 0 && ship.hp > 0){
int enemyAtt = game.random.nextInt(35);
int playerAtt = game.random.nextInt(30);
int enemyDef = game.random.nextInt(10);
int playerDef = game.random.nextInt(15);
int enemy... |
c1007212-4483-4a9d-b6f1-9cbb2296c889 | 8 | public void turn() {
if(x > goalX && dir != Direction.WEST) {
this.setDirection(Direction.WEST);
}else if(x < goalX && dir != Direction.EAST) {
this.setDirection(Direction.EAST);
}else if(y > goalY && dir != Direction.NORTH) {
this.setDirection(Direction.NORTH);
}else if(y < goalY && dir != Direction.S... |
e47e8229-d340-4517-994b-b56016c0268f | 1 | public void colorChanged(WorldMapObject o, Color c)
{
core.Point pos = p2o.get(o);
System.out.println("color changed: "+o+", "+c.name+", "+pos);
//if (ready) {
try {
mapWidget.objectAt(pos.y, pos.x).setLayer(0, new gui.WidgetImage(c.mfFile));
} catch (java.lang.NullPointerException e) {}
//}
} |
f5f3554a-bfc3-4f11-b72e-bee069a64ea4 | 0 | public void setjSeparator1(JSeparator jSeparator1) {
this.jSeparator1 = jSeparator1;
} |
5eb7e97d-fe9e-44a7-b460-7b080b6fd42f | 2 | public void randomCoords(){
Random rnd = new Random();
// Find a random starting y coordinate
int x = rnd.nextInt(660);
x += 20;
this.yCoord = x;
// Find a random speed
x = rnd.nextInt(5);
x += 1;
this.speed = x;
// random... |
3bd829b5-7774-4477-a430-fd54e469ac8f | 0 | private VariablePrecisionTime getVorbisReleaseDate() {
return vorbisDate(false);
} |
b7cdf388-072f-4798-b703-02e584c64de4 | 7 | private static boolean matchesAttribute(
final boolean html, final SelectorElementBuffer elementBuffer,
final String attrName, final MarkupSelectorItem.AttributeCondition.Operator attrOperator, final String attrValue) {
boolean found = false;
for (int i = 0; i < elementBuffer.at... |
eabf5d33-e199-4b22-bd3a-772421394f10 | 0 | public void setDocument(IDocument document) {
fDocument = document;
} |
a209ccfc-995e-4c29-a4ea-1265fba5b853 | 1 | public void testToStandardDays_overflow() {
Duration test = new Duration((((long) Integer.MAX_VALUE) + 1) * 24L * 60L * 60000L);
try {
test.toStandardDays();
fail();
} catch (ArithmeticException ex) {
// expected
}
} |
3f94281f-80cc-47a7-a31a-b248d544ad03 | 0 | public void setTemp(long t) {
sa.temps[sa.stable][indexI][indexJ] = t;
sa.temps[sa.updating][indexI][indexJ] = t;
} |
6b01f6e7-5400-4f17-80d1-4f55c430f923 | 0 | public static void main(String[] args) {
new Menu();
} |
1c5baff8-8017-4e34-a9a8-129dae7e472d | 3 | public void updateSeekMax(Track t) {
String lengthString = (String) t.get("length");
if(lengthString != null && lengthString instanceof String) {
try {
double length = Double.parseDouble(lengthString);
seek_slider.setMax(length);
seek_slider.s... |
d96d8953-01ef-4481-bb71-f30f61e56f3e | 7 | public static String getTableNameBySql(Cg cg){
String tableName = null;
String tableSql = formartSql(cg.getTableSql());
if(tableSql!=null && tableSql.trim().length()>0){
try{
// tableSql=tableSql.replaceAll("--.*\r\n","\r\n");
String[] strs = tableSql.split("\r\n");
if(strs!=null && strs.len... |
c6cea5a0-ff13-492d-8521-844789a93ded | 5 | private void recursiveScanDir(String relativePath, File dirOrFile, List<LessFileStatus> lstAddedLfs) {
if (dirOrFile.isDirectory()) {
File[] subf = dirOrFile.listFiles();
if (subf != null) {
for (File current : subf) {
String subRelPath = relativePath.isEmpty() ? current.getName() : relativePath + '/' ... |
69e9b562-a679-4d96-9b4f-56cd1a1f3da9 | 0 | @Override
public void annulerTransaction() throws SQLException {
getConnexion().rollback();
// getConnexion().setAutoCommit(true);
} |
87137b15-10ff-4b46-acdc-8bf80c46d599 | 6 | static public BigDecimal calculateMultiItemPrice(Class<? extends Item> genericItem) {
BigDecimal price = BigDecimal.ZERO;
Item item = getItem(genericItem);
if (item.isMultiItem()) {
Map<Class<? extends Item>, BigDecimal> prices = new HashMap<Class<? extends Item>, BigDecimal>();
... |
15493540-ab1f-4582-ab13-af04e6b7b7f8 | 5 | public void endMove(int column, int row) {
if (checkWin(playingField, column, row)) {
VierGewinntAi.mainGUI.showWinMessage();
gameEnd = true;
return;
}
if (checkFull()) {
VierGewinntAi.mainGUI.showFullMessage();
gameEnd = true;
... |
7e6c24d6-bb41-4692-b9e6-bb6e1f5fc612 | 5 | @Override
public boolean equals(Object object) {
if (!(object instanceof DescricaoPreco)) {
return false;
}
DescricaoPreco other = (DescricaoPreco) object;
if ((this.getCodigo() == null && other.getCodigo() != null) || (this.getCodigo() != null && !this.getCodigo().equals... |
d303a68b-19ab-47a0-9732-b5600db52c31 | 8 | public void SendFileCommand() {
if(running==false || paused==true || fileOpened==false || isConfirmed==false || linesProcessed>=linesTotal) return;
String line;
do {
// are there any more commands?
line=gcode.get((int)linesProcessed++).trim();
//previewPane.setLinesProcessed(linesProcessed);
//s... |
5cfdf882-32f1-4fc4-9fa3-5aca11cdd7c7 | 2 | public String toString() {
if (this.title != null && this.year != null) {
return String.format("%s (%s)", this.title, this.year);
} else {
return "";
}
} |
d450e637-4d9e-44ee-a6bb-cff233dab92b | 8 | public String getSql() {
StringBuffer sbSql = new StringBuffer();
if (tableName != null && tableName.length() > 0) {
sbSql.append(" " + tableName);
if (tableNode != null) {
switch (joinOperate) {
case LeftJoin:
sbSql.append(" left join ");
break;
case RightJoin:
sbSql.append(" right... |
e894babd-b2f8-4b3d-8ff5-ca318dd95c8f | 0 | public void setDollar(Dollar dollar) {
this.dollar = dollar;
} |
00b3bbad-6472-41d0-ae59-7cbabfd345ef | 6 | protected void splitNextLargeSublist() {
if (smallSublistCount < sublists.size()) {
if (sublists.isFull()) {
sublists = copyTo(sublists,
new FixedListInternal<CircularListInternal<T>>(
sublists.capacity() << 1));
}
int firstLargeSubli... |
a8b428f8-7482-4777-87ac-b4d6ba2bfb11 | 3 | void setCellFont () {
if (!instance.startup) {
textNode1.setFont (1, cellFont);
imageNode1.setFont (1, cellFont);
}
/* Set the font item's image to match the font of the item. */
Font ft = cellFont;
if (ft == null) ft = textNode1.getFont (1);
TableItem item = colorAndFontTable.getItem(CELL_FONT);
Im... |
5af9650f-662c-48db-bea1-23a1fa7ddb5b | 4 | private void close(Connection conn, Statement stmt, ResultSet rs) {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
System.out.println("Erro ao fechar conexao.");
e.printStackTrace();
}
} |
2f3cbcc2-ca9a-4755-9043-58bc11fae9a4 | 7 | public static void main(String[] args) {
//Define spaceing
int space = 21;
int leftSpace = 0;
//define starting numbers
int left = 1;
int right = 1;
//first loop for top of the x
while (space >= 0) {
//Printing out the correct amount of leftspace
for (int i = 1; i <= leftSpace; i++) {
System... |
dac65d04-978d-43e1-8672-8b0d3faf2f51 | 0 | public SetupApplication(String androidJar, String apkFileLocation) {
this.androidJar = androidJar;
this.apkFileLocation = apkFileLocation;
} |
f4c3b429-5518-491e-95de-b0021f0b3916 | 7 | public String salvarTicket() {
Ticket ticket = new Ticket();
ticket.setIdTicket(idTicket);
ticket.setTitulo(titulo);
ticket.setSistema(sistema);
ticket.setComponente(componente);
ticket.setDescricao(descricao);
ticket.setOperador(operador);
ticket.setStatu... |
2b909c90-cb08-46c1-a389-d080d0946e0c | 9 | public long getRandom()
{
final Random r=new Random();
final int roomCount=size();
if(roomCount<=0)
return -1;
final int which=r.nextInt(roomCount);
long count=0;
for(int i=0;i<intArray.length;i++)
{
if((intArray[i]&NEXT_FLAG)>0)
count=count+1+(intArray[i+1]-(intArray[i]&INT_BITS));
else
... |
5ffaf5e6-47c7-4aa6-8bca-e5163e38c3e9 | 5 | List<Score> matchCoupleChainFind(Map<Person, List<Score>> table, Person start, int limit){
if (!table.containsKey(start)) {
return Collections.EMPTY_LIST;
}
List<Score> path = new LinkedList<>();
HashSet<Person> set = new HashSet<>();
Person next = start;
whil... |
e454267f-0d3d-4ee8-8976-d07f0b7213b3 | 1 | private static synchronized DateFormat getDf() {
if (df == null) {
df = new SimpleDateFormat("HH:mm:ss.SSS");
}
return df;
} |
71da5dd9-0f42-43bc-bae2-363eb5f55745 | 2 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/alumno/list.jsp");
try {
AlumnoDao oAlumnoDao = new AlumnoDao(oContexto.getEnumTi... |
d6b9addf-64db-4510-a79f-b3cbdfcb4b0c | 5 | public static void main(String[] args) {
String t = "";
int ejercicio = 0;
BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
while (true) {
try {
System.out.println("Introduce el numero de ejercicio que quieras comprobar. [1 - 2]. 0 para salir");
t = s.readLine();
ejercici... |
86987c62-8b55-4e27-bec1-58c8b314ba34 | 9 | public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int q = scn.nextInt();
for (int i = 1; i <= q; i++) {
int a = scn.nextInt();
int b = scn.nextInt();
int c = scn.nextInt();
System.out.println("Case "
... |
7598d044-7834-46ce-88bb-66b5a5a7a022 | 9 | void parsePCData() throws java.lang.Exception
{
char c;
// Start with a little cheat -- in most
// cases, the entire sequence of
// character data will already be in
// the readBuffer; if not, fall through to
// the normal approach.
if (USE_CHEATS) {
... |
f466c411-b689-4c88-bdf1-afbe353f53ad | 3 | public void randAlgo(){
int cnt = 0;
Random rand = new Random();
while(cnt < 25){
int a = rand.nextInt(100);
if(cnt == 0){
randlist[cnt] = a;
cnt++;
}
else{
if(isExist(a, cnt)){
randlist[cnt] = a;
cnt++;
}
}
}
} |
f2ccfb75-5930-4161-86c9-57adb4fac454 | 2 | private void delete(User user){
for (int i = 0; i < userList.size(); i++){
if (userList.get(i).getName().equals(user.getName())){
userList.remove(i);
}
}
} |
052ea83f-f7ab-4019-8e1d-763631b61cf0 | 2 | protected void clearTile(Tile t){
for (Item i : t.getInventory()){
t.removeItem(i);
}
if (t.removeCharacter() instanceof Player){
playerTile = null;
}
} |
2cd57a7c-f15a-41c7-a2a6-d6f8d5f4d776 | 5 | @FXML
private void jacobiResultClick(MouseEvent me) {
int curMethod = 1;
if (me.getButton().equals(MouseButton.PRIMARY)) {
if (coef == null || free == null || results[curMethod] == null) {
return;
}
if (curMode[curMethod]) {
curMode[curMethod] = false;
jacobiResult.setText(VECTOR + results[cur... |
913931ff-a70a-42b2-93ed-177623fa3915 | 4 | public void renderEntities()
{
Entity entity;
for (int i = 0; i < this.theWorld.loadedEntityList.size(); i++)
{
entity = this.theWorld.loadedEntityList.get(i);
if (!entity.getEntityName().equals("Player"))
{
if (RenderHelper.isOnSc... |
5bb11c88-f68f-4812-8b53-64dde0981ea7 | 8 | public void modifyProfile(Line profile) {
DataLine rq = new DataLine();
rq.setAPI("user.modify_profile");
try {
if (profile.getString("name") != null)
rq.set("name", profile.getString("name"));
if (profile.getString("twitter") != null)
rq.set("twitter", profile.getString("twitter"));
if (profile.... |
d7138b1a-402f-43d0-8feb-c04d7957bef1 | 5 | public static void main(String[] args)
throws Exception
{
File uniDir = new File(args[args.length - 7]);
File triDir = new File(args[args.length - 6]);
File s1Uni = new File(args[args.length - 5]);
File s1Tri = new File(args[args.length - 4]);
File s2Uni... |
14fb837a-3492-46cc-a579-639c0b76b1cb | 3 | private int getFailPosition(Pattern pattern, String input) {
for (int i = 0; i <= input.length(); i++) {
Matcher matcher = pattern.matcher(input.substring(0, i));
if (!matcher.matches() && !matcher.hitEnd()) {
return i - 1;
}
}
return input.len... |
32292c45-0fb8-4cf9-96d6-c8fdf0bcd6a9 | 3 | @RequestMapping(value = "updateRoleAuth", method = RequestMethod.POST)
@ResponseBody
public Object updateRoleAuth(
@RequestParam int roleId,
@RequestParam int[] menuIds
) {
Map<String, Object> map = new HashMap<>();
Role role = roleService.getById(roleId);
Li... |
9fba1008-b691-437e-bb18-654423a4a8ed | 8 | public void merge(int A[], int m, int B[], int n) {
int a = m - 1;
int b = n - 1;
for(int i = m + n -1; i >= 0; i--){
if(a >= 0 && b < 0) break;
if(a < 0 && b >= 0){
A[i] = B[b--];
continue;
}
if(a >= 0 && b >= 0){
if(A[a] > B[b]) A[i] = A[a--];
else A... |
fef15cb5-fc83-4b87-9101-254169669ba7 | 9 | private void updateCurrentLogFile()
{
// get the log file name from the file system
File logFolder = new File(slateComponent.getLogDirectoryName());
File[] listOfLogFiles = logFolder.listFiles();
numLogFiles = listOfLogFiles.length;
if (numLogFiles == 0)
{
return;
}
if ((RotationParadigm.Boun... |
c3e5a755-8162-41e1-8479-d48f4fd4330f | 7 | private static void testInvalidNode(ListNode p) {
System.out.println("p.isValidNode() should be false: " + p.isValidNode());
try {
p.item();
System.out.println("p.item() should throw an exception, but didn't.");
} catch (InvalidNodeException lbe) {
System.out.println("p.item() should throw... |
2300d5e8-18cd-4bc2-9b70-329e9ffd42a2 | 7 | public void update() {
if(!active) {
if(Math.abs(player.getX() - x) < GamePanel.WIDTH) active = true;
return;
}
// check if done flinching
if(flinching) {
flinchTimer++;
if(flinchTimer == 6) flinching = false;
}
getNextPosition();
checkTileMapCollision();
calculateCorners(x, ydest +... |
75c252b2-63c3-4e75-b584-01054de439af | 2 | public boolean Benutzernameaendern(String betroffenerBenutzer,
String neuerBenutzername) {
Benutzer benutzer = dbZugriff.getBenutzervonBenutzername(betroffenerBenutzer);
if (benutzer != null){
try{
benutzer.setBenutzername(neuerBenutzername);
return true;
}
catch (SQLException e){
System.out.p... |
1494ad65-0556-4d0e-a96a-d04f1e1ebfef | 0 | public JPanel getjPanelTitre() {
return jPanelTitre;
} |
3bdfb79b-f51d-4d2c-9d2e-fc6fea010499 | 7 | public void tick() {
if ((this.runOnTick) && (isVisible()))
{
ImageComponent[] arrayOfImageComponent = getImageComponents();
int i = 0; int j = 0;
for (int k = 0; k < arrayOfImageComponent.length; k++)
{
if (!(arrayOfImageComponent[k] instanceof AnimationComponent))
con... |
b4364575-aba7-4227-9a04-0ff2fb92f946 | 2 | @Test
public void testLoadGame() {
//There MUST be a "testsave.xml" file in the saves/ folder for this to pass.
try {
int id = games.loadGame("testsave");
boolean condition = false;
if(id == games.listGames().size()-1){
condition = true;
}
else condition = false;
assertTrue("Loaded game corr... |
387781fd-c43b-48a7-b6ae-68033d723ace | 8 | @SuppressWarnings({ "rawtypes", "unchecked" })
public Newlevel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
setTitle("New Level");
setBounds(100, 100, 321, 309);
getContentPane().setLayout(new BorderLayout());
contentP... |
df587ed0-46ac-491f-8c73-a6f3bb6d60ae | 2 | private void drawHand()
{
// the x and z offset from the center-top point of the palm of the hand
float[][] fingers = new float[][]
{
{
-2*(this.hand[Y]/3), this.hand[Z]/1.5f
}, // pinky :D
{
-this.hand[Y]/4.5F,... |
9dfb27c2-67c8-4b48-bc12-406ff83b0392 | 2 | public boolean globtype(char ch, java.awt.event.KeyEvent ev) {
if (ch == '\n') {
wdgmsg("make", ui.modctrl ? 1 : 0);
return (true);
}
return (super.globtype(ch, ev));
} |
0f722b70-be48-4a32-9e70-4b9d49805df9 | 1 | public Muodostelma kloonaa(){
ArrayList<Palikka> kloonipalikat = new ArrayList<Palikka>();
for (int i = 0; i < this.palikat.size(); i++){
kloonipalikat.add(palikat.get(i).kloonaa());
}
return new Muodostelma(this.muoto, this.peli, kloonipalikat);
} |
b0680443-45b7-45ea-aa0a-5b77b4477835 | 4 | public static void initializeDB(Library myLibrary){
Statement statement;
PreparedStatement pStatement;
String query;
try {
Connection conn = getConnection();
conn.setAutoCommit(false);
query = "TRUNCATE TABLE item";
statement = conn.create... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.