method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
55cc1877-c4e7-48e9-ad4c-b5c60c78babb | 3 | public int checkReactionID(int IDCheck){
int index=-1;
for(int i=0; i<graphNodes.size(); i++){
if( (graphNodes.get(i).getID()==IDCheck) && (graphNodes.get(i).getType() == _REACTION_) ){
index=i;
}
}
return index;
} |
7dc72bf2-66ba-483a-b179-9012ba207028 | 5 | public String getSchedule()
{
ByteArrayOutputStream outputString = new ByteArrayOutputStream();
PrintWriter output = new PrintWriter(outputString, true);
if (timePoints.size() == 0) return "";
BusStop[] tp = new BusStop[timePoints.size()];
output.println("SCHEDULE FOR LINE " + name);
... |
04e38a1d-47fc-4c3a-a7a5-9acb26471331 | 7 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
Input input = gc.getInput();
Character.update(input, delta);
for (Iterator<Enemy> iterator = mobs.iterator(); iterator.hasNext(); ) {
Enemy e = iterator.next();
e.update(delta);
}
// check collisio... |
f9f5e9be-7f91-48c2-aa27-ef53f9d35c31 | 2 | public ContainmentProblem(Query query, Query view, String shouldMatch) {
this.query = query;
this.view = view;
if (shouldMatch.equals("true")) {
this.shouldMatch = 0;
} else if (shouldMatch.equals("false")) {
this.shouldMatch = 1;
}
//System.out.pr... |
1ddfd4d8-cfb2-411d-91e0-ab6650e1169a | 2 | public static List<Integer> parseNumericStringArrayObject(Object object) throws InvalidRpcDataException {
if (object == null) {
return null;
}
if (object instanceof String[]) {
return parseNumericStringArray((String[]) object);
} else {
throw new In... |
41e1d1e3-9d33-437a-877d-015dccdca92e | 9 | private void readToken() {
while (true) {
prompt();
String token = _input.findWithinHorizon(TOKEN_PATN, 0);
if (token == null) {
token = "*EOF*";
} else if (token.startsWith("'")) {
if (token.length() == 1 || !token.endsWith("'")) {... |
52c4a36a-32aa-42bc-b0de-613fc97cba9b | 8 | static final int method2064(int i, int i_0_, int i_1_, int i_2_) {
anInt3549++;
if (aa_Sub1.aSArray5191 == null)
return 0;
int i_3_ = i >> 937361225;
int i_4_ = i_2_ >> -1589419447;
if ((i_3_ ^ 0xffffffff) > -1 || (i_4_ ^ 0xffffffff) > -1
|| i_3_ > -1 + Class367_Sub4.mapSizeX
|| ((Class348_Sub40_Sub... |
027d1174-face-41d5-8a48-e60c1c2cff05 | 1 | @Override
public void destroy() {
super.destroy();
if (gameTimer != null) {
gameTimer.cancel();
}
} |
1f4736e9-9406-47a5-a49d-5a7b09bd02de | 6 | public static final String getName(final byte level) {
switch (level) {
case 0:
return "Rookie";
case 1:
return "Genin";
case 2:
return "Chunin";
case 3:
return "Jounin";
case 4:
... |
68639edc-fbf4-40d5-8d56-5eb402b20ddf | 3 | @Override
public void update(final int delta) {
if (Controls.getInstance().wasEnter())
isStarted = true;
if (!isStarted)
return;
if (currentLevel.isFinished()) {
System.out.println("Level comlete...");
System.out.println("New Level");
}
currentLevel.update(delta);
} |
3cedcdbc-78fa-4ff9-8241-4b7ab173d87c | 8 | private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
// TODO add your handling code here:
String str="";
int l;
str = this.jTextField23.getText().toUpperCase();
if(Biblio.containsKey(str)){
j = (Ju... |
d058a616-6c2f-47b8-bc9e-84f9f327caf5 | 3 | public List<String> logInUser() {
List<String> serviceList = null;
// Get user's service list
if (user.getUserType().equals(UserTypes.buyer)) {
serviceList = med
.logInBuyer(user.getUsername(), user.getPassword());
} else {
if (user.getUserType().equals(UserTypes.seller)) {
serviceList = med.log... |
09b4ee94-a008-4d0d-956a-4bcbe6f252c6 | 5 | private ArrayList<members> searchForMembers(ArrayList<members> memberList, String input){
ArrayList<members> updated_memberList = new ArrayList<members>();
for(members current: memberList){
try {
if (current.getId().toString().contains((input))){
updated_m... |
6361bf72-7156-4413-b9ac-1e7b361c76d6 | 2 | @Override
public void epoch(Player p) {
if (TRAIN_score && score_file != null)
score_net.export(score_file);
} |
aa33caa0-841f-42bb-8fc0-790fc58e47ff | 6 | private static float calculatePriceMain(int[] seriesCounts) {
Arrays.sort(seriesCounts);
int numBooks = 0;
int numUniqueBooks = 0;
for(int series = 0; series < seriesSize; series++) {
numBooks += seriesCounts[series];
if(seriesCounts[series] > 0) {
numUniqueBooks++;
}
}
if(numBooks... |
fa58bfca-dd2b-4ae9-a358-28526ed56e17 | 8 | public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (int id = 0; id < shapes.size(); id++)
{
GradientPaint p = null;
if (select + 1 == id)
p = new GradientPaint(300, 0, new Color(0xff, 0x5f, 0), 600, 0, new Color(0, 0x5f, 0xff));
else
p = new G... |
1ffde62e-f988-4280-9737-e6b7acee2845 | 0 | public String getManufacturer() {
return manufacturer;
} |
3bc77ca0-4f5e-49ee-ab9f-9cacbcaf3459 | 8 | public TypeBinding postConversionType(Scope scope) {
TypeBinding convertedType = this.resolvedType;
// if (this.valueCast != null)
// convertedType = this.valueCast;
int runtimeType = (this.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4;
switch (runtimeType) {
case T_boolean :
convertedType = TypeBinding.... |
c71f5b24-49d2-489a-a3eb-5cb5655bb48c | 4 | private static Image drawBorder(Frontier frontier, Image image) {
if (image.isRgb()) {
// for (Point p : frontier.getInnerBorder()) {
// image.setPixel(p.x, p.y, RED, 255);
// image.setPixel(p.x, p.y, GREEN, 0);
// image.setPixel(p.x, p.y, BLUE, 0);
// }
for (Point p : frontier.getOuterBorder()) {
... |
c74c02cd-43ca-432a-a155-71e96c659a44 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
4ad07077-bccf-44be-ab1b-19d28e8d8b9f | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
try {
if(args.length == 4) {
int checkradius;
int allowednumberofblocks;
Material matchmaterial = Material.matchMaterial(args[1]);
if(matchmaterial == null) {
throw new IllegalArgumentExcep... |
75472070-f828-4e25-8e82-4f7ccbb7e9e0 | 0 | public AutomatonDirectedGraph(Automaton automaton) {
super(automaton);
} |
3fd8b6a3-8aa7-4a81-bf01-548e5fecc68a | 9 | void closeNoMsgPlayer()
{
// Disabled this check... if this is called, the player needs to be closed.
// if (blnIsClosing)
// {
// /*
// ** Already closing elsewhere
// */
// return;
// }
blnIsClosing = true;
blnWorking = false;
removeFromGroup();
if (vctConditions.size() != 0)
{
engGame.vctCh... |
7ebec2d3-5f46-4eea-8bc3-2b0901657c56 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
Item I=null;
if(affected instanceof Item)
I=(Item)affected;
if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB)
&&(I.amWearingAt(Wearable.WORN_LEGS)||I.amWearingAt(Wearable.WORN_ARMS)))
{
final MOB mob=(MOB)I.owner();
if((!mob.a... |
9c20f449-213f-46b7-8043-c5731c1b276c | 4 | @SuppressWarnings("unchecked")
private T createExtension(String name) {
Class<?> clazz = getExtensionClasses().get(name);
if (clazz == null) {
throw new IllegalStateException("Error when load extension class(interface: " + iFaceType);
}
try {
T instance = (T) EXTENSION_INSTANCES.get(clazz);
if (instan... |
30057615-e243-4580-ac2c-37ae1dbdf87d | 9 | @Override
public void update(final int delta) {
super.update(delta);
if (controls.isRIGHT()) {
direction.add(SPEED * delta, 0);
left = false;
}
if (controls.isLEFT()) {
direction.add(-SPEED * delta, 0);
left = true;
}
// if (controls.isUP()) {
// direction.add(0, -SPEED * delta);
// }
// ... |
0728a11e-a82b-4319-b4d3-dad286d5c02d | 8 | private void drawTooltip() {
if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
return;
String s;
if(itemSelected == 1 && menuActionRow < 2)
s = "Use " + selectedItemName + " with...";
else if(spellSelected == 1 && menuActionRow < 2)
s = spellTooltip + "...";
else
s = menuActionName[... |
8e862994-455d-4005-b2a4-7951ecdeccb1 | 5 | public int find(int[] sequence) {
int n = sequence.length;
int a[] = new int[48];
int ans = 0;
int f = 0;
for(int i = 0;i < n - 1;i++){
for(int j = i + 1;j < n;j++){
if(sequence[i] != sequence[j]){
ans++;
}else{
if(a[sequence[i]] == 0&&f == 0){
ans++;
a[sequence[i]]++;
f... |
f9229a06-e804-47f3-b5aa-1b6cba657b9f | 3 | @Override
public SpecialTile getSpecialTile(Location loc) {
if(!isValidLocation(loc)) return null;
for(Location l : specialTiles){
if(l.sameCoord(loc)){
return (SpecialTile) l.getTile();
}
}
return null;
} |
a890ba42-21d1-4bc8-8dae-c1b0ada42978 | 8 | public ImagePlus applyWithMask()
{
final int width = input.getWidth();
final int height = input.getHeight();
final int depth = input.getStackSize();
//final ImagePlus imageOutput = input.duplicate();
//final ImageStack imageStackOutput = imageOutput.getStack();
final ImageStack inputStack = input.getStac... |
6c91760a-dc48-4b55-907b-cfdefbc8076e | 6 | private void processMouse() {
while (Mouse.next()) {
boolean handled = false;
for (MouseEventHandler handler: mouseEventHandlers) {
if (Mouse.getEventButton()!=-1) {
if (Mouse.getEventButtonState()) {
handled = handler.onMouseDo... |
8e4f30a4-7076-4fa2-80a8-00a71c75f9ee | 0 | @Test
public void test_addPawn() {
assertNotNull(board);
assertEquals(numberOfPawns, board.numberOfPawns());
Pawn pawn1 = new Pawn('l', 3, 4, board);
board.addPawn(pawn1);
assertEquals(numberOfPawns + 1, board.numberOfPawns());
} |
0bbf771d-7cc5-46d3-8719-6fc79a1cc42d | 8 | protected void drawItemLabel(Graphics2D g2, XYDataset dataset,
int series, int item, XYPlot plot, XYItemLabelGenerator generator,
Rectangle2D bar, boolean negative) {
String label = generator.generateLabel(dataset, series, item);
if (label =... |
97c64cb5-1780-4e32-8ff1-c9fd625382a6 | 8 | @SuppressWarnings("unchecked")
public void load(File modelDirectory, String modelPrefix) throws JChunkerException {
ObjectInputStream featDictClassInputStream = null;
try {
featDictClassInputStream = new ObjectInputStream(new FileInputStream(new File(modelDirectory, modelPrefix ... |
4a698d0f-cf2a-4037-91bf-8fc751962559 | 0 | public Counter() {} |
1605083e-358c-489c-9dda-c5e62b312356 | 1 | public void paint(Graphics g) {
g.setColor(mouseHovering ? HOVER_BACKGROUND_COLOR : BASE_BACKGROUND_COLOR);
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(BORDER_COLOR);
g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(TEXT_COLOR);
int textX = bounds.x + ((bou... |
9e2516a6-9202-4561-a753-18e79cc87db4 | 7 | public static boolean computeCell(long world,int col,int row) {
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(world, col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(world, col, row);
// ... |
cef63341-5d4c-4993-9313-da62da1dd68c | 3 | @Override
public List<Funcionario> listAll() {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Funcionario> funcionarios = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(L... |
eda4ebe4-645b-4e47-9872-200a49f6b063 | 2 | public void testGetValue() {
Partial test = createHourMinPartial(COPTIC_PARIS);
assertEquals(10, test.getValue(0));
assertEquals(20, test.getValue(1));
try {
test.getValue(-1);
} catch (IndexOutOfBoundsException ex) {}
try {
test.getValue(2);
... |
61ee8ad2-fdb9-4816-855a-1c7233b08f33 | 4 | public static int itemAmount(int itemID, int itemX, int itemY) {
for (int i = 0; i <= 5000; i++) { // Phate: Loop through all item spots
if(globalItemID[i] == itemID && globalItemX[i] == itemX && globalItemY[i] == itemY) // Phate: Found item
return globalItemAmount[i];
}
return 0; // Phate: Item does... |
7e37c510-578b-46fc-85db-91e8e268a2be | 0 | public JuliaMandelbrotFrame()
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new GridLayout(1,2));
setSize(700,300);
mand = new MandelbrotPanelDouble();
mand.addMouseMotionListener(new MouseMotionListener(){
@Override
public void mouseDragged(M... |
faea6165-dadb-46f7-a492-fda0842bc9e2 | 9 | public static String getTriadChordName(ArrayList<Key> chord){
String name = "";
//add the root note
name += chord.get(0).getStringNote();
//check if the third is major or minor
String third = (NotesUtils.getIntervalBetweenTwoKeys(chord.get(1).getMidiKey(), chord.get(0).getMidi... |
9bee30fa-51bc-444f-903d-116e787a80a4 | 0 | public static GameMaster fromGenerator(TargetGenerator targetGenerator) {
return new GameMaster(targetGenerator.generate());
} |
c95b29e8-f002-4c25-9add-ea7c780a4916 | 8 | public void addCalendars(List<EventCalendar> calendars) {
Connection connection = null;
PreparedStatement statement = null;
PreparedStatement selectStatement = null;
try {
// Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
// Ope... |
bc720513-eb48-4393-b1ac-51b12bca57cd | 9 | protected void notifyReceivedMsg(MqttWireMessage message) throws MqttException {
final String methodName = "notifyReceivedMsg";
this.lastInboundActivity = System.currentTimeMillis();
// @TRACE 651=received key={0} message={1}
log.fine(className, methodName, "651", new Object[] {
new Integer(message.getMess... |
f0f968b5-c60c-49bb-a5a3-086206f2fec8 | 4 | private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed
int result = openChooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File[] selected = openChooser.getSelectedFiles();
if (selected.length > ... |
ecbc68d9-a3f3-425d-b1d5-7da77eae46db | 8 | private void updateStateWaiting(List<Keyword> keywords, List<String> terms) {
if (keywords!= null && !keywords.isEmpty()) {
for (Keyword kw : keywords) {
if (kw.getWord().equals("ingredient") || kw.getWord().equals("ingredients")) {
newObjectClass = Ingredient.class;
}
if (kw.getWord().equals("tool") || kw.getWord().eq... |
fe7e1fe1-9be5-4f48-85c0-8ecc7ffc94dd | 7 | public static void main(String[] args){
// Socket which will connect to the engine.
Socket socket = null;
// Reader to read packets from engine
BufferedReader inStream = null;
// Convenience wrapper to write back to engine
PrintWriter outStream = null;
// port number... |
36cee418-252b-4a14-8cad-9cf678501216 | 1 | @Override
public <E extends IElement> E create(Class<E> ElementClass,
WebElement element) {
try{
return ElementClass.getConstructor(WebElement.class).newInstance(element);
}
catch(Exception e){
throw new RuntimeException(e);
}
} |
d362a197-8c4a-4d91-80af-d4818aa64ebb | 5 | public static int findWordEnd(String line, int pos, String noWordSep)
{
char ch = line.charAt(pos);
if(noWordSep == null)
noWordSep = "";
boolean selectNoLetter = (!Character.isLetterOrDigit(ch)
&& noWordSep.indexOf(ch) == -1);
int wordEnd = line.length();
for(int i = pos; i < line.length(); i++)
{... |
8c23aea2-02f1-4730-8166-f86d6beebce8 | 9 | @Override
public void run(){
try{
while(true){
move();
for(int i = 0; i < shots.length; i++){
if(shots[i] != null){
shots[i].moveShot(id);
shots[i] = GameFrame.checkShots(shot... |
2c689acf-9b86-4114-9466-d444b2d9cf25 | 4 | public void drawOptions(SpriteBatch sb) {
int x, y, px = font[0].getRegionWidth()-1, py = font[0].getRegionHeight() + 2;
for (int j = 0; j <= menuMaxY; j++)
for (int i = 0; i <= menuMaxX; i++) {
x = (Game.width/2 - menuOptions[i][j].length() * px - px/2)/2 ;
y = (Game.height/4 - j * py - 28);
i... |
cf1abc4d-82ed-440c-8bed-96f50ebccd8c | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = this.length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
... |
9f29cb1b-81f8-4517-9a7b-543129ab7794 | 1 | public Boolean close() {
try {
this.con.close();
return true;
} catch (SQLException e) {
log.severe("Couldn't close Connection: ");
LogHandler.writeStackTrace(log, e, Level.SEVERE);
return false;
}
} |
4f0107bf-47c5-4113-9d41-c1ce09c0c87f | 1 | @FXML
private void handleTxtPriceAction(ActionEvent event) {
if (txtPrice.getText().isEmpty()) {
return;
}
cobSuppliers.requestFocus();
} |
1c05d998-d626-426d-85e0-1de3acf9c05e | 6 | public List<AlumnoDTO> getAlumnosPorGrupo(int idGrupo){
List<AlumnoDTO> alumnos = new ArrayList<AlumnoDTO>();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = EscolarConnectionFactory
.getInstance().getConnection();
String sql = "select a.matricula, a.apellido... |
06b961f3-72c4-4a59-849a-4cc7422e5632 | 7 | private final boolean cvc(int i) {
if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
d58c698b-be58-4db6-b682-117269735861 | 9 | public CircleTile(int rank)
{
super(rank);
setToolTipText(toString());
switch(rank){
case 1:
circles[0] = new Pancake( 49, 29, Color.RED);
break;
case 2:
circles[0] = new Circle(45 + 3, 35 - 21, MYGREEN);
circles[1] = new Circle(45 + 3, 35 + 9, Color.RED);
break;
case 3:
circles[0] = new ... |
c5bdd3ce-aa8b-48a6-b45e-2180d6d4108f | 0 | @AfterClass
public static void tearDownClass() {
} |
2a3999bb-73ad-46ed-80d3-a6c489a98e4a | 8 | void designateTask(int i, int i0, TaskEnum type) {
if(this.getTile(i, i0).getDesignate()==type)
{
this.getTile(i, i0).setDesignate(null);
this.getTaskmanager().undesignateTask(this.getMap().getTile(i, i0).getActualTask(), this.getBeastcollection());
return;
... |
d99cc484-93cb-4c4c-98e2-7630f4989a60 | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
if (!Room.CheckRights(Main.Data, true))
{
return;
}
... |
14ab0803-3c37-4012-bf0c-8b69ddec738b | 4 | public static void main(String[] args)
{
LinearProbingHashST<String, Integer> st = new LinearProbingHashST<String, Integer>();
for (int i = 0; !StdIn.isEmpty(); i++)
{
String key = StdIn.readString();
st.put(key, i);
}
// print keys
for (String s : st.keys())
StdOut.println(s + " " + st.get(s));... |
fed54f02-1ae4-4cd9-b273-24c546e8c11c | 4 | public boolean equals(Wall wall){
if (wall.getX() == x && wall.getY() == y && wall.width == width && wall.height == height){
return true;
}
return false;
} |
c107379e-2b84-4032-834b-41fb17111634 | 1 | private void addDatabaseLoadPanel(JScrollPanelledPane stepScroll) {
JPanel dbLoad = JComponentFactory
.makePanel(JComponentFactory.HORIZONTAL);
CustomButton loadDB = JComponentFactory.makeLoadDatabaseButton(
"Load Database", confirmLoad);
if (programSettings.autoLoadDatabase) {
autoLoad.setSelected(tr... |
a64b8189-0440-4930-aef8-56af2be40b72 | 6 | public boolean growCrops(Player player, String[] args, int radius) {
Block playerCenter = player.getLocation().getBlock(); // Get Centrepoint (Player)
int crops = 0;
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++... |
5b27e106-b323-4a27-8826-eed5bbd9a150 | 2 | public static void caught(int index)
{
if(index>=151)
{
System.out.println("MISSINGNO caught; system crash");
System.exit(-1);
}
if(caught[index] == false)
{
caught[index] = true;
totalCaught++;
}
} |
0e8105d4-fbdd-49b6-af1e-9dc58fb77a21 | 6 | protected void padTabRun(int tabPlacement, int start, int end, int max) {
Rectangle lastRect = rects[end];
if (tabPlacement == TOP || tabPlacement == BOTTOM) {
int runWidth = (lastRect.x + lastRect.width) - rects[start].x;
int deltaWidth = max - (lastRect.x + last... |
eabb5c13-83b7-4c21-9f10-96a8303c596d | 7 | private JPanel buildTop() {
JPanel panel = new JPanel();
panel.setLayout(gl);
JLabel reportLabel = new JLabel("Duplicate Report Folder:");
gc.gridx = 0;
gc.gridy = 0;
gl.setConstraints(reportLabel, gc);
panel.add(reportLabel);
reportFolder = new JTextField("C:\\report\\",60);
gc.gri... |
7d4894c1-c84c-4b1d-a95a-a62878d90cb4 | 5 | public boolean equals(Object obj) {
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pessoa other = (Pessoa) obj;
if (matricula == null) {
if (other.matricula != null)
return false;
} else if (!matricula.equals(other.matricula))
return false;
return true... |
1bf09bd6-ad22-4f3a-ab3b-15275a21f193 | 7 | public Deck(Graphics g) {
String cardName = "";
for (int i = 0; i < suitArray.length; i++) {
for (int j = 0; j < valueArray.length; j++) {
Card card = new Card(valueArray[j],suitArray[i]);
if (valueArray[j] == 1) {
cardName = "A" + suitArray[i];
} else if (valueArray[j] == 11) {... |
9c823476-b2e9-43f2-b437-e63ff7e880eb | 4 | @Override
public boolean doMove() {
int curIndex = curGb.readMemory(curGb.pokemon.fightCurMoveNumAddress);
//System.out.println("current move index "+curIndex+", goal position is "+goalIndex);
int stepsDown = (goalIndex + numOwnMoves - curIndex) % numOwnMoves;
int stepsUp = (curIndex + numOwnMoves - goalIndex... |
2a2e66e8-025b-4d03-bf0b-77eff782f965 | 4 | protected static double convertDist( double value, DistType from, DistType to )
{
//first convert to nautical miles
if( from == DistType.KILO )
value *= 0.539957;
else if( from == DistType.MILES )
value *= 0.868976;
//now convert to the to type
if( to == DistType.KILO )
value *= 1.852;
else if... |
f9c619a9-6815-464c-b513-b514a3db375b | 0 | public static ScoreManagerSingleton getInstance()
{
return ourInstance;
} |
3f87b840-1957-4901-b921-9eddb5d02f15 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.order");
try {
Criteria criteria = new Criteria();
Order order = (Order) request.getSessionAttribute(JSP_CURRENT_ORDER);
... |
0267b759-266c-4056-8daa-7a75d73d36c0 | 8 | public Collection<AbstractClassPathLocation> findBelow(URI toplevel) {
final Collection<AbstractClassPathLocation> rval = new ArrayList<AbstractClassPathLocation>();
final File startPoint = new File(toplevel);
// First, check if the entry represents a multi-plugin (in that case we don't add
... |
a1a70fa0-c329-448e-ac71-ca8b054dc5a7 | 2 | public void newInput() {
if (!running) {
running = true;
if (moveInput()) {
YSPL.world.getWorldFrame().getGUI().step();
}
running = false;
}
} |
76cae6d5-31d9-4e6d-aaec-cb58a04d545f | 0 | public EnvParams(){
//nothing
} |
2a1c5c85-e9f3-4075-990f-1bd19976b7be | 7 | private int pushDownMax(int i) {
int iBound = queue.size();
E v = queue.get(i);
while (true) {
int iDown = (i << 1) + 1;
E vDown;
if (iBound < iDown) {
break;
}
if (iDown == iBound) {
iDown = iBound - 1;
... |
8b966f1a-deae-4ce0-a258-0e6388b35e94 | 9 | private boolean IsPermutation(int n1, int n2) {
char[] n1Chars = Integer.toString(n1).toCharArray();
char[] n2Chars = Integer.toString(n2).toCharArray();
if (n1Chars.length != n2Chars.length) {
return false;
}
for (int i = 0; i < n1Chars.length; i++) {
b... |
cfc080aa-f5bb-4320-acb7-45d0365d99be | 1 | private static int[] generate(int size) {
int[] ints = new int[size];
for (int i = 0; i < size; i++) {
ints[i] = RANDOM.nextInt();
}
return ints;
} |
c85b4fe7-0ab0-4c15-b16d-e533bc90bcd2 | 9 | public void auxEliminar( T pElemento, Retorno retorno ) throws ElementoNoExisteException
{
// Compara el elemento con el valor almacenado en el nodo
int resultado = elem.compareTo( pElemento );
if( resultado == 0 )
{
// Caso 1: El elemento est� en el nodo actual
... |
886d3696-14cf-41e5-b5de-9467f5cc0277 | 3 | @Override
public void report() {
final List<String> busiestActors = new ArrayList<>();
int highestCount = 0;
for (final Map.Entry<String, Integer> actorYearToMovieCountEntry : actorYearToMovieCount.entrySet())
if (actorYearToMovieCountEntry.getValue() > highestCount) {
... |
87da3768-c023-4b41-a5c8-2f12df26041e | 2 | public boolean hasItem(Point p)
{ if(inventory.size()==0) return false;
System.out.println("Clicked on (" + p.getX() + ", " + p.getY()+ ")");
Point topLeft = new Point(IMG_XOFFSET, IMG_YOFFSET);
int totalHeight = IMG_YOFFSET + ITEM_HEIGHT * inventory.size();
if(withinBounds(p, topLeft, ITEM_WIDTH, ... |
1539b419-a523-4f55-8728-64f79ae9f4e7 | 9 | @Override
public double evaluate(int[][] board) {
int max = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
max = Math.max(max, board[i][j]);
cnt[board[i][j]]++;
}
}
int target = -1;
... |
8162d6d0-a9b7-4dd7-a7da-322e3a81b6e2 | 9 | int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
bb6747bf-0505-4be4-bb6d-10119a40201a | 7 | @Override
public String execute(HttpServletRequest request) throws SQLException, ClassNotFoundException {
String tableName = request.getParameter("TableName");
System.out.println(tableName);
if (tableName != null && tableName != "") {
try {
Class.forName("org.h... |
153de60f-c2bd-4dde-83bf-917f1224970a | 3 | public static void removeCols(JTable paymentTable) {
TableColumnModel tcm = paymentTable.getColumnModel();
System.out.println("getColumnCount:" + tcm.getColumnCount());
if (tcm.getColumnCount() == 7) {
paymentTable.removeColumn(tcm.getColumn(6));
}
if (tcm.getColumn... |
fa8da385-412b-4d46-a8bb-1b11180ba748 | 6 | private boolean updateAfterPlace(TPoint [] coordPts) {
boolean rowFilled = false;
for (int j = 0; j < coordPts.length; j++) {
int checkX = coordPts[j].x;
int checkY = coordPts[j].y;
widths[checkY] += 1;
if (widths[checkY] == width) rowFilled = true;
if (heights[checkX] < checkY + ... |
62da5b6c-0b4f-4158-b915-a9444c181d2c | 2 | public void setAbsoluteVolume(float volume) {
for(int i = 0; i < playList.size(); i++) {
GameSong gs = playList.get(i);
if(gs != null) {
gs.setVolume(volume);
}
}
} |
017d7a8c-4319-4539-a267-3f00473d95d1 | 5 | @Override
public void retirada(BigDecimal valor) {
switch(status) {
case Platinum:
saldo = saldo.subtract(valor);
if(saldo.compareTo(new BigDecimal("100000.0")) == -1) {
status = Categorias.Gold;
}
break;
case Gold:
saldo = saldo.subtract(valor);
if(saldo.compareTo(new BigDecimal("25000.0")... |
ca2f532f-757c-4038-acce-1e962d245946 | 4 | private void bubbleDown(int pos) {
int c1Pos = 2*pos + 1;
int c2Pos = 2*pos + 2;
int maxPos = c1Pos;
if(c1Pos <= len - 1) {
if(c2Pos <= len - 1) {
if(heap[c1Pos] < heap[c2Pos]) maxPos = c2Pos;
}
if(heap[maxPos] > heap[pos]) {
... |
bc28acab-48a8-4f23-a611-e50f7cf0c2c2 | 7 | protected void drawDays() {
Calendar tmpCalendar = (Calendar) calendar.clone();
int firstDayOfWeek = tmpCalendar.getFirstDayOfWeek();
tmpCalendar.set(Calendar.DAY_OF_MONTH, 1);
int firstDay =
tmpCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek;
if (firstDay < 0) {
firstDay += 7;
}
int i;
fo... |
ed313f60-a79f-4604-90e2-395148ac59f9 | 2 | private String getMD5Hash(String password){
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(password.getBytes());
BigInteger number = new BigInteger(1, messageDigest);
String hashtext = number.toString(16);
whil... |
52bcb07e-283c-4b9d-8926-fc80bed867ed | 8 | public Controller(Grid lagrille,List<Integer[]> lesPersonnes, ChartLine chartline)
{
/*
* STEP 1 : Definition de la grille
*/
drawArea = new DrawAreaUI();
this.grid = lagrille;
drawArea.setGridUi(new GridUI(grid));
drawArea.paintGrid();
/*
* STEP 2 : Definition des personnes
*/
this.person... |
ddce45e6-e466-435e-a30a-6162824966b6 | 8 | public static void getPathHeuristics(int[] start,int[] goal,int obj[]){
//System.out.println("Score goal :"+score[goal[0]][goal[1]][0]+" "+score[goal[0]][goal[1]][1]);
if(finiteStateMachine.value==null){
finiteStateMachine.value = new int[10][10];
for (int i = 0; i < size; i++) ... |
9919ebd4-87b0-4e3c-b64f-0ee32e219e4c | 3 | private int findNoneZero(int n, int k) {
int[] arr = new int[10];
int index = 0;
for (int i = 0; i < 10; i++) {
if (i == k)
continue;
arr[index] = i;
index++;
}
ArrayList<Integer> nineBase = getNineInvertedDigits(n);
in... |
e1ae430a-b00b-4ae5-844c-70b5021773ac | 9 | @Override
public void endElement(String uri, String localName,
String qName) throws SAXException{
switch (qName){
case "plane":
planes.add(plane);
break;
case "model":
... |
75da85dc-6b21-4c5a-8369-688ecea73f5f | 1 | public Bear(boolean randomAge, Field field, Location location)
{
super(field, location);
if(randomAge) {
setAge(getRandom().nextInt(MAX_AGE));
setFoodLevel(getRandom().nextInt(RABBIT_FOOD_VALUE + FOX_FOOD_VALUE));
}
else{
setAge(0);
s... |
f73fd06b-90a2-4e46-b909-5f03be0e7373 | 3 | public boolean isEmpty() {
for (ItemStack item : this.items) {
if (item != null && item.getType() != Material.AIR) {
return false;
}
}
return true;
} |
af6ea480-bfda-4ef1-802b-8f19f777446e | 2 | public static int gMin(ArrayList<node> list){
int min = (list.get(0)).frequency;
int index = 0;
for(int i=1; i<list.size(); i++){
if((list.get(i)).frequency < min){
min = (list.get(i)).frequency;
index=i;
}
}
return index;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.