method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
300697c0-544f-42e4-b4e5-0be6155692c7 | 6 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (win && easter)
{
ImageIcon qq = new ImageIcon("resources/dogewin-screen.png");
winscreen = qq.getImage();
g.drawImage(winscreen, 1, 1, null);
}
else if (wi... |
aabce4a5-fe93-47fd-863c-87bee19b9700 | 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://... |
c0ad96f0-79c7-4fd0-bee3-dab497b83e43 | 3 | public Matrix multiply(Matrix B){
if (B.getN() != this.getM())
return null;
Matrix C = new Matrix(this.getN(), B.getM());
int i=0,j=0;
for(i=0; i<this.getN();i++)
for(j=0; j<this.getM(); j++)
C.setij(i,j, this.getH(i).multiple(B.getV(j)));
... |
93aa0242-05a4-4428-85f2-432e48569cfd | 8 | private void totallyFilled() {
repeats++;
//if we're not at the maximum amount of repeats...
if (repeats < DMAXREPEATS) {
//Remove half of the circles!
for (int i = 0; i < DMAXCIRCLES / 2; i++) {
int j = (int) (r.nextDouble() * others.size());
... |
79c16619-c544-4395-b3cb-bcc206b7f629 | 7 | private void initialize() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException e2) {
log.error(e2.getMessage(), e2);
} catch (InstantiationException e2) {
log.error(e2.getMessage(), e2);
} catch (IllegalAccessException e2) {
log.error(... |
d4ab1545-ffad-4cc9-8766-d4354921e2a5 | 8 | private void explode(Bomb b) {
b.setActive(false);
int power = b.getPower();
int posX = b.getPosX();
int posY = b.getPosY();
field.removeItem(b);
Player p = player[b.getPlayer()];
p.setBombsPlaced(p.getBombsPlaced() - 1);
int nx;
int ny;
placeFire(posX, posY, position.CENTER);
for (int i = 0; i < ... |
e4268ffe-6582-4718-af2b-3c33e8bdbb01 | 1 | public static CycWorker evalSubLInBackground(final CycAccess conn,
final String subl,
final CycWorkerListener cwl) {
CycWorker worker = new CycWorker() {
public Object construct() throws Exception {
return evalSubL(conn, subl);
}
};
if(cwl != null) { worker.addLi... |
704676a1-f795-4fe0-849b-b8e648d4db26 | 9 | private int maxWord(String text, boolean hasSuffix, String prvText) throws MorphException {
int maxlen = 0;
boolean existPrv = false;
// if previous text exist in the dictionary.
if(prvText.length()>=2)
existPrv = (DictionaryUtil.getNoun(prvText.substring(prvText.length()-2))!=null);
... |
61093151-23b5-4ea6-8018-a458a71faa94 | 6 | Node getNode(Node n, Direction d) {
Node node = null;
for (int i=1; i<2; i++) {
int x = d==Direction.right?n.x+i:d==Direction.left?n.x-i:n.x;
int y = d==Direction.down?n.y+i:d==Direction.up?n.y-i:n.y;
// testing new op here
if (bwapi.getMap().isWalkable(x, y)) {
// System.out.println(Strin... |
31630a67-b5d1-4c9d-9dd8-e5ce1a6f3532 | 6 | public float distance(final float xp, final float yp, final float zp) {
final float
xd = (xp < xpos) ? (xpos - xp) : ((xp > xmax) ? (xp - xmax) : 0),
yd = (yp < ypos) ? (ypos - yp) : ((yp > ymax) ? (yp - ymax) : 0),
zd = (zp < zpos) ? (zpos - zp) : ((zp > zmax) ? (zp - zmax) : 0) ;
return (flo... |
a3c722c8-8654-454f-9f52-a03aa4ec138a | 3 | protected Type getSuperClass(final Type t) {
if (currentClass != null && t.equals(currentClass)) {
return currentSuperClass;
}
Class c = getClass(t).getSuperclass();
return c == null ? null : Type.getType(c);
} |
e2e1cd36-8f1f-403a-9671-662c4ae26208 | 9 | public static Map buildMissionSingleRowStr(String[] singleRowInfoContent, Map modelInfo, String lang, int idIndex, String idField, Map<String, String> specialField, String keys, String contentSplitFragment, Map combineFields) {
Map<String, List<Integer>> fieldIndex = (Map<String, List<Integer>>) modelInfo.get("... |
49cb6505-d970-4f38-8870-4765e1eb641c | 2 | protected Object getDefault(String path) {
Configuration root = getRoot();
Configuration defaults = root == null ? null : root.getDefaults();
return (defaults == null) ? null : defaults.get(createPath(this, path));
} |
b63218e6-e387-46ce-8a73-ae3e0c624859 | 5 | public boolean downloadUrl (String filename, String urlString) {
BufferedInputStream in = null;
FileOutputStream fout = null;
try {
URL url_ = new URL(urlString);
in = new BufferedInputStream(url_.openStream());
fout = new FileOutputStr... |
0468916e-70cf-4bc8-b277-4449bfdd05a2 | 2 | public long getMaximumDifference_as_long(){
long diff = 0L;
if(this.type==4 || this.type==5){
long max = this.getMaximum_as_long();
long min = this.getMinimum_as_long();
diff = max - min;
}
else{
throw new IllegalArgumentException("Maximum ... |
7789eb68-93f0-495f-aefd-f666cbddc89a | 6 | public static boolean isPalindrome(String s) {
if(s == null) {
return false;
}
if(s == "") {
return true;
}
char[] letters = s.toCharArray();
int i = 0;
int j = letters.length-1;
while(j>i) {
if(isValid(letters[i])) {
i... |
c583dc54-a9df-4822-86c1-76f972c7386c | 0 | public static Forme S() {
ArrayList<Vecteur> liste = new ArrayList<>();
liste.add(new Vecteur(1, 0));
liste.add(new Vecteur(1, 1));
liste.add(new Vecteur(0, 1));
liste.add(new Vecteur(0, 2));
Vecteur<Integer> _centre = new Vecteur(1, 1);
return new Forme("S", lis... |
63d09b4c-8d81-48ea-b955-3302a55b05a8 | 5 | private void paintPreviewArea(boolean repaint) {
if (m_prevArea != null) {
Object sizeSelection = m_sizeBox.getSelectedItem();
Object familySelection = m_fontList.getSelectedValue();
int size = Integer.parseInt(sizeSelection.toString());
String family = familySelection.toString();
... |
2c60d235-101a-4ec2-96ba-bfb93f759748 | 0 | public double getVitality() {
return vitality;
} |
d329ffb9-6909-46ca-862e-788ca864cd29 | 8 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MarkerAxisBand)) {
return false;
}
MarkerAxisBand that = (MarkerAxisBand) obj;
if (this.topOuterGap != that.topOuterGap) {
return false;
... |
12f97d6a-a5a7-4c4e-a04a-316bce9522ee | 6 | private int [] mergeAndCountSplitInv(int[] A, int[] B, int size) {
int [] merged = new int[size];
int i = 0, j = 0;
for (int k = 0; k < size; k++) {
if (i < A.length & j < B.length) {
if (A[i] < B[j]) {
merged[k] = A[i];
i++;
... |
7a2f0dd3-9219-4030-b242-3d6c13d20245 | 8 | public void deal() {
// solution is now picked
selectAnswer();
// create and fill a deck with all cards to be dealt. This is necessary since cards is a set and wont allow get() function
List<Card> dealDeck = new ArrayList<Card>();
for (Card c : cards) {
if (!(c.getName() == solution.getPerson() || c.getNa... |
bbbc3122-083c-4f99-b51a-3ab3823925b2 | 7 | 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 s... |
19286799-b970-4898-b68b-04043c248262 | 5 | public void addBox( int lw, int lclr, int bgcolor )
{
LineFormat lf = (LineFormat) Chart.findRec( chartArr, LineFormat.class );
if( lf == null )
{
lf = (LineFormat) LineFormat.getPrototype( 0, 0 );
addChartRecord( lf );
}
if( lw != -1 )
{
lf.setLineWeight( lw );
lf.setLineStyle( 0 ); // soli... |
fbf7a8e0-8e7f-4185-9ec0-70831c355df8 | 0 | public boolean getFileFilterExcludeIgnoreCase() {
return this.fileFilterExcludeIgnoreCase;
} |
7de3cda2-81fc-46de-8f45-bf3333df8d44 | 5 | public static Pair<Integer, Integer> getMinimumAndMaximum(int[] array)
{
if (array == null || array.length == 0)
{
return new Pair<Integer, Integer>(null, null);
}
int minimum = array[0];
int maximum = array[0];
for (int i = 0; i < array.length; i++) {
... |
2255fbbc-3dcd-4869-b20b-cc0f059a73c9 | 5 | public void load()
{
if(this.chunkFile == null)
{
log.warning("Chunk file not found. You might want to check that if you want to save anything.");
return;
}
this.ownedChunks.clear();
this.chunkSet.clear();
this.owners.clear();
this.chun... |
3f7dc24b-d13c-4711-9d77-ad3a2cb5959c | 1 | public List<SongType> getSong() {
if (song == null) {
song = new ArrayList<SongType>();
}
return this.song;
} |
ff03315a-fe69-4632-bcce-a53a2aad1965 | 0 | MyThread(String name) {
super(name);
} |
410c138d-61f6-4473-83df-5daa2601659d | 6 | @Override
public void keyPressed(int key, char c) {
if (key == Input.KEY_F1) {
AppGameContainer gc = (AppGameContainer) container;
try {
gc.setDisplayMode(modesfs[i].getWidth(),
modesfs[i].getHeight(), fullScreen);
mainClass.xMax = modesfs[i].getWidth();
mainClass.yMax = modesfs[i].getHeight(... |
a8b29769-04eb-458c-aa7a-de3859d4f2bb | 6 | public void populateLevel(CreatureFactory factory, ItemFactory itm) {
Game.game.player = factory.newPlayer(messages);
Random rand = new Random();
for (int i = 0; i < CreatureList.genAmount.size(); i++) {
if (CreatureList.startGen.get(i) <= Game.game.world.level) {
int r = rand.nextInt(CreatureList.genAmoun... |
9073fc21-f8ea-4df1-9476-f6ce2d7ecfe2 | 7 | private static MarkupSelectorItem.AttributeCondition parseSimpleAttributeCondition(
final boolean html, final String selectorSpec, final String attributeSpec) {
// 0 = attribute name, 1 = operator, 2 = value
final String[] fragments = tokenizeAttributeSpec(attributeSpec);
String at... |
a2c961fd-eec3-4905-89c3-b9efd6abfd78 | 7 | public void func_72788_a()
{
ArrayList arraylist = new ArrayList();
Iterator iterator = field_72793_b.iterator();
do
{
if (!iterator.hasNext())
{
break;
}
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)ite... |
5bea1997-e6b8-40d2-a4eb-01584c4d845b | 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 = menuActionNa... |
152599e2-678c-44d3-87b6-5a2879a5925f | 4 | protected synchronized void parserNode(Node node, WebPage wp) throws Exception {
if(wp.getHtmlCode()== null || wp.getHtmlCode() == ""){
wp.setHtmlCode(node.getPage().getText());
}
// srb.addText(node.getPage().getText()+"\r\n");
if (node instanceof Tag) {
Tag atag = (Tag) node;
if (atag instanceof L... |
0cf835d0-9678-4cef-abb2-91d5c9759c6c | 2 | private void printPage(PrintWriter out){
out.println(
ServletUtilities.headWithTitle(name) +
"<body>\n" +
"<br><br><body>\n" +
"<h2> <center> Úkol: "+ name +" </center> </h2>\n"
);
if (end == null){
out.println(
"<fo... |
f740aba7-f9b9-4be9-a5f5-f57ef1cb0a41 | 5 | public void parseText(String text) {
if(text.contains(">")) {
String[] params = text.substring(0, text.indexOf('>')).split(",");
for(int x = 0; x<params.length; x++) {
if(params[x].startsWith("c")) {
color = parseColor(params[x].substring(1));
} else if(params[x].startsWith("s")) {
parseSize(p... |
0ad202b2-0107-4bd5-affa-2dc9d967c7fa | 4 | @Override
public void update(GameObject object) {
if(keyboard.keyDown(KeyEvent.VK_UP)) {
object.y -= 2;
}
if(keyboard.keyDown(KeyEvent.VK_DOWN)) {
object.y += 2;
}
if(keyboard.keyDown(KeyEvent.VK_LEFT)) {
object.x -= 2;
}
i... |
0b645875-4d2b-4cac-988a-8822c07fcfd9 | 5 | final int method1859(int i, long l) {
if (i != 71)
return 22;
if (aLong6167 <= aLong6166) {
int i_3_ = 0;
do {
i_3_++;
aLong6167 += l;
} while (i_3_ < 10 && ((aLong6166 ^ 0xffffffffffffffffL)
< (aLong6167 ^ 0xffffffffffffffffL)));
if (aLong6167 < aLong6166)
aLong6167 = aLong6166;... |
f79cc345-bc87-46f8-af8b-a32046897a38 | 1 | public void setAttribute(int index, Double value){
if( index < attributes.length ){
attributes[index] = value;
}//else?
} |
6c9205f5-e6f5-4ac5-8eaf-aea2d8f6524a | 8 | public void update(Graphics g) {
int width = getWidth();
int height = getHeight();
g.setColor(getBackground());
g.fillRect(0, 0, width, height);
g.setColor(Color.gray);
g.drawRect(3, 3, width - 6, height - 6);
if (colorID < COLORS.length) {
g.setColor(COLORS[colorID]);
g.fillRect(4, 4, width - 7,... |
9143a268-6a94-49a5-a611-a6c87fcbe46c | 6 | public boolean mergeStack(Frame frame) {
boolean changed = false;
if (top != frame.top)
throw new RuntimeException("Operand stacks could not be merged, they are different sizes!");
for (int i = 0; i < top; i++) {
if (stack[i] != null) {
Type prev = stack[... |
9435279b-da34-460d-876c-8598085e28f9 | 2 | public float[] getRandomWeights(boolean excitatory, int size) {
float[] weights = new float[size];
for (int i = 0; i < size; i++) {
if (excitatory) {
weights[i] = random(0.5f);
} else {
weights[i] = -random(1f);
}
}
retu... |
5c89653e-43b9-4274-ba31-5656bb1503d0 | 0 | @Test
public void singleEnqueueDequeueReturnsCorrectValue() {
q.enqueue(0);
assertTrue(0 == q.dequeue());
} |
b8068d33-b106-4561-b319-e467e356ae5d | 8 | public int location(T chromosome) {
int[] position = new int[numberOfObjectives];
for (int obj = 0; obj < numberOfObjectives; obj++) {
if (chromosome.getObjective(obj) > upperLimits[obj] || chromosome.getObjective(obj) < lowerLimits[obj]) {
return -1;
} else if (... |
7534900e-370e-4086-8c1e-3d6b205759d4 | 8 | @Override
public boolean pieceMovement(Point startPosition, Point endPosition) {
Point difference = new Point();
difference.setLocation(endPosition.getX() - startPosition.getX(), endPosition.getY() - startPosition.getY());
if( (Math.abs(difference.getX()) == 1 && Math.abs(difference.getY()) == 0) ||
(Math... |
de13fd5b-7afd-40d0-aeec-e03bd6a027f6 | 0 | public AutomataStateEvent(Automaton auto, State state, boolean add,
boolean move, boolean label) {
super(auto);
myState = state;
myAdd = add;
myMove = move;
myLabel = label;
} |
c1cd9450-04ae-496c-b505-85c6bb708a42 | 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 Produto)) {
return false;
}
Produto other = (Produto) object;
if ((this.id == null && other.id != null) || (thi... |
30c7999f-0537-4441-8f41-11517f272cd7 | 4 | public static void main(String[] args)
{
Digraph G = null;
try
{
G = new Digraph(new In(args[0]));
System.out.println(args[0] + "\n" + G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
System.out.print("Source vertices : ");
List<Integer> sources = new LinkedList<I... |
cac30781-50ff-4d27-bce5-a66c3490962c | 4 | private DataInstance scoreRack(int turns){
DataInstance max_score = null;
double rack_size = game.rack_size;
//Loop through every long usable sequence for this rack
double rack_de = rack.scoreRackDE(game.dist_flat, null),
rack_de_skew = rack.scoreRackDE(game.dist_flat, game.dist_skew);
for (Rack.LUS lu... |
221c17d5-fad0-4544-a357-5dc8202b53c9 | 0 | public void setId(int id) {
this.id = id;
} |
993a301d-c145-4589-8844-a0345d8408ba | 4 | public static LinkedList<Dist>[] getDistNearestMatrix(Node[] nodes){
LinkedList<Dist>[] mtrx = new LinkedList[nodes.length];
for (int i = 0; i < nodes.length; i++) {
mtrx[i] = new LinkedList<Dist>();
}
for (short i = 0; i < nodes.length; i++) {
for (short j = 0; j < nodes.length; j++) {
if(i==j ... |
d965277d-9d36-49b2-9e6c-b4100b284b64 | 2 | public DataAccess()
{
try{
Class.forName("org.sqlite.JDBC");
//conn = DriverManager.getConnection("jdbc:sqlite:Database.db");
conn = DriverManager.getConnection("jdbc:sqlite:./Database");
stat = conn.createStatement();
}
catch(ClassNotFoundException e)... |
ac7517b5-ad89-4e0f-873a-aaf82f06305f | 2 | public final ChunkyObject setName(String name) {
ChunkyObjectNameEvent event = new ChunkyObjectNameEvent(this, name);
Chunky.getModuleManager().callEvent(event);
if (event.isCancelled()) return this;
try {
getData().put("name", event.getNewName());
} catch (JSONExcept... |
6c6ded14-64d7-4c3a-b835-79ca2f32d956 | 3 | public Map() {
for (int x = 0; x < GameGlobals.mapSize; x++){
for (int y = 0; y < GameGlobals.mapSize; y++){
map[x][y] = (Math.random() > 0.5f) ? 1 : 0;
fog[x][y] = true;
}
}
} |
06f6ea1e-863a-4d2f-a00f-5b78e6d24e1b | 0 | public StateTool(AutomatonPane view, AutomatonDrawer drawer) {
super(view, drawer);
} |
b30976fd-6c5c-448e-aa32-914b6d51dc99 | 9 | public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Greška: stepen multiprogramiranja nije prosleđen!");
return;
}
if (args.length > 1) {
System.err.println("Greška: prosleđeno više od jednog parametra!");
return;
}
int stepenMultiprogramiranja;
try {
s... |
e1b2e97a-4375-4b4b-99e6-684a0117fa01 | 1 | public int getBreakPenalty() {
if (subExpressions[0] instanceof Operator)
return ((Operator) subExpressions[0]).getBreakPenalty();
return 0;
} |
9ee85aac-5553-4064-889e-d6d9f19ab6ee | 5 | public static ArrayList<Bookmark> load() {
try {
System.out.println("du");
br = new BufferedReader(new FileReader("bookmarks.txt"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println(e);
e.printStackTrace();
}
System.out.println("tjabba");
ArrayLi... |
ed6dcb6e-0ca4-47ef-9187-4e5160b9c154 | 7 | protected void updateAsMobile() {
super.updateAsMobile() ;
final float height = position.z / INIT_HIGH ;
//
// Check to see if ascent or descent are complete-
if (stage == STAGE_ASCENT && height >= 1) {
for (Mobile m : inside()) m.exitWorld() ;
exitWorld() ;
stage = STAGE_AWAY ;
... |
921ea1ec-bf5b-432b-8926-36f3a04ca235 | 1 | public void visit_athrow(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
07f3fef7-0902-4246-ba14-77fe94f9d72c | 2 | public void jjtAddChild(Node n, int i) {
if (children == null) {
children = new Node[i + 1];
} else if (i >= children.length) {
Node c[] = new Node[i + 1];
System.arraycopy(children, 0, c, 0, children.length);
children = c;
}
children[i] = n;
} |
86b4e40d-b8c7-4f16-8710-feb4da4203c5 | 4 | public PrimitiveOperator combineLeftNRight(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[4];
// the other gate is on the left side - on the LSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 1 : 0) | 0]; //00
newTruthTable[1] = truthTable[((other.truthTable[2]) ? 1 : 0) | 2];... |
801fe924-fe5d-4c01-b121-66461d91f0ca | 8 | private void crawl() throws Exception {
String line = null;
try {
while ((line = receive()) != null) {
if (line.startsWith("+")) {
// 忽略心跳
} else if (line.startsWith("$")) {
line = receive();
PushMessage message = (PushMessage) JSONObject.toBean(JSONObject.fromObject(line), PushMessage.cla... |
b5ddef2d-d662-4545-90ad-300415ea718a | 6 | public static List<User> getFriendsList() {
try {
//who we're followed by
long[] followers = twitter.getFollowersIDs(-1).getIDs();
//who we're following
long[] friends = twitter.getFriendsIDs(-1).getIDs();
//temp array of user ids to send to twitter
... |
0e112a2b-d41a-4c01-ae0d-7ea45aa91ca3 | 5 | @Override
public void actionPerformed(ActionEvent e) {
DBAccess = new DALObject();
String name = "";
do {
name = new DialogBox(frame).getText();
} while (!(name != null && !name.isEmpty() && !name.trim().isEmpty()));
try {
DBAccess.createCSVExport(name... |
c79b9ce3-a47a-4690-bcdf-5ffe6b510255 | 0 | public String getStepName() {
return stepName;
} |
535e828d-67cc-4973-915e-937e9e318bea | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Recipe other = (Recipe) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... |
ca33e6e2-6ebf-4ab8-83f5-d96b976c28a5 | 9 | public void start(){
if (printer == null) return;
printer.printTitle();
createPlayers();
createBoard();
printer.printBoard(B);
Utils.setThreatsOnBoard(B);
while ((checkmate2!=null) && (checkmate2==false))
{
//printer.printThreateningOnBoard(B);
//printer.printThreatenOnBoard(B);
checkmate =... |
dbb9b8b6-0202-4603-a5aa-3704b70b8d5b | 5 | public String getState() {
String state = "STATE[";
if(winner == 0)
state += turn+"]";
else
state += "0]";
for(int i=0;i<3;i++) {
for(int j=0;j<3;j++) {
state += grid[i][j];
if(j < 2)
state +=",";
... |
3c63998f-c08f-4c3a-964e-4a08680a6728 | 0 | private ShowRouteTable() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Tabla de Ruteo");
putValue(SHORT_DESCRIPTION, "Mostrar Tabla de Ruteo");
putValue(LONG_DESCRIPTION, "Mostrar Tabla de Ruteo");
putVa... |
a47cf5d7-e0cb-441e-bab9-78ddb84c1676 | 6 | private int countCardsInHand(BufferedImage image) {
int y = handRow + 2;
int cardCount = 0;
boolean currentlyYellow = false;
int stripeLength = 0;
int gapLength = 0;
for(int x = 391; x < 1100; ++x) {
if(isSufficientlyYellow(image.getRGB(x, y))) {
gapLength = 0;
++stripeLength;
if(!currentlyYe... |
fc7a659e-ae75-46f9-8d42-561032a36bfc | 7 | public static Keyword[] createCharacterTypeTable() {
{ Keyword[] table = new Keyword[256];
{ int code = Stella.NULL_INTEGER;
int iter000 = 0;
int upperBound000 = 255;
for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
code = iter000;
table[code] = Stella.KWD... |
8b092008-92b9-47d0-aaee-85e7abf79ff7 | 8 | public static double[][] benchmarkJLargeArraysByteSequentualNative(long[] sizes, int[] nthreads, int iters, String file)
{
LargeArray.setMaxSizeOf32bitArray(1);
double[][] results = new double[nthreads.length][sizes.length];
long k;
System.out.println("Benchmarking JLargeArrays (byte... |
05aca45d-3f2f-40b9-b186-e5b8f65f42b4 | 9 | public Location getLocation(MouseEvent e){
Location mouseLocation = null;
int relative_X = e.getX() - margin;
int relative_Y = e.getY() - headHeight;
int temp_X = 0;
int temp_Y = 0;
if(relative_X >=0 && relative_X <= colons*size){
if(relative_Y >=0 && relative_Y <= rows*size){
for(int i=1;i<colons+1;... |
9065faed-cc0a-4416-a38f-18fb8d44e2f3 | 8 | public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit student;
try {
student = player.getFreeColGameObject(studentId, Unit.class);
} catch (Exception e) {
... |
b7275fc7-e443-46ff-baeb-ac1ad85efd4d | 1 | public void appendNullCharToAlignStream() {
int mod = stream.size() % 4;
int pad = 4 - mod;
for (int i = 0; i < pad; i++) {
stream.write(0);
}
} |
18655d42-3938-4a90-be08-c42c07e78dda | 6 | private static File writeAnInteration(HashMap<String, String> fileLines, String key,HashMap<String, String> caseContolMap)
throws Exception
{
File trainingData = new File("D:\\MachineLearningJournalClub\\trainingDataSVM_" + key+ ".txt");
OtuWrapperToSVMLight.deleteOrThrow(trainingData);
BufferedWriter wr... |
de5766b0-71d0-40b5-9ffb-b1cedc407ed1 | 9 | public void run() {
while(true) {
try{
//process any pending changes
synchronized(this.changeRequests){
Iterator changes = this.changeRequests.iterator();
while(changes.hasNext()){
ChangeRequest change = (ChangeRequest) changes.next();
switch(change.type){
case ChangeRequ... |
8c4f4ca0-6f85-45d2-9c91-4fe6cd75fee0 | 7 | private void addDefinition(String name, Vector<String> partproc, int depth) {
if (!definitions.containsKey(name)) {
definitions.put(name, new Vector<Vector<PatternComponent>>());
}
Pattern charcterRange = Pattern.compile("([a-zA-Z])-([a-zA-Z])");
Vector<PatternComponent> components = new Vector<PatternCom... |
6fb09766-adb8-40bf-8efd-77cd9cf74004 | 3 | private void initDatabase() {
database = new MyDatabase(this) {
protected List<Class<?>> getDatabaseClasses() {
List<Class<?>> list = new ArrayList<Class<?>>();
list.add(Level.class);
list.add(User.class);
return list;
};
};
database.initializeDatabase(Config.dbDriver, Config.dbURL, Config... |
41f78b68-6c5b-451a-8015-0b96779874c7 | 3 | private void add(String str){
if(strList.isEmpty()){
strList.add(str);
}
else{
for(int i = 0; i < strList.size(); i++){
if(str.compareTo(strList.get(i)) <= 0){
//Add str to the ith element and move the latter elements by one.
strList.add(i, str);
break;
}
}
}
} |
9ea93ea6-21ac-47b9-88e4-bdb9b79244fb | 8 | protected void adjustTopPrideStats(final List<Pair<String,Integer>>[][] topWhat, final String name, final AccountStats.PrideStat stat, final AccountStats astats)
{
for(final TimeClock.TimePeriod period : TimeClock.TimePeriod.values())
{
final List<Pair<String,Integer>> top=topWhat[period.ordinal()][stat.ordinal... |
73f52afa-a23e-4618-8aa6-37e649784fc1 | 3 | public boolean showDialog() {
Frame[] frames = Frame.getFrames();
for (int i = 0; i < frames.length; i++) {
if (frames[i].isAlwaysOnTop()) {
frames[i].setAlwaysOnTop(false);
if (frames[i].isFocused()) win = (Window)frames[i];
}
}
return super.showDialog(null);
} |
ff81041e-12d3-40c9-b0fb-5963f25ef41e | 6 | private static String getNumber(String text) {
int nombre = 0; // contient le nombre entré
String choix = ""; // contient le texte entré par l'utilisateur
do {
choix = JOptionPane.showInputDialog(text);
// s'assurer que la réponse entrée est correcte
if(c... |
823e9837-fec4-47de-85dd-43cb6270f7a1 | 2 | private static void outputTable(int аrray[][]) {
for (int i = 0; i < аrray.length; i++) {
for (int j = 0; j < аrray.length; j++) {
System.out.print(Integer.toString(аrray[i][j]) + " ");
}
System.out.println();
}
} |
4842bc67-226b-4567-8e45-2892764b8c21 | 2 | public void lisaaPalikatPeliin(List<Palikka> palikat) {
for (Palikka palikka : palikat) {
pelipalikat[palikka.getY()][palikka.getX()] = palikka;
if (palikka.getY() == 0) {
jatkuu = false;
break;
}
}
} |
67fa12cf-f07d-473e-b048-5887b4b20cd5 | 7 | private void loginSubmitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginSubmitButtonActionPerformed
// TODO add your handling code here:
String userName = userNameText.getText();
String password = passwordText.getText();
Boolean accountAvailable = false;
... |
9e66265a-9d14-449e-a611-2aab8318f36c | 8 | public static int osd_fseek(Object file, int offset, int whence) {
FakeFileHandle f = (FakeFileHandle) file;
int err = 0;
switch (f.type) {
case kPlainFile:
if (whence == SEEK_SET) {
fseek(f.file, offset, SEEK_SET);
return 0;
... |
187dee0f-7816-480a-add2-f334dcda823a | 4 | @Override
public boolean matches(List<Character> currentMatching) {
if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE)
return false;
if(currentMatching.size() == 1)
return true;
if(!Character.isLetterOrDigit(currentMatching.get(1)))
return false;
... |
09168ff3-84c2-4fa0-a749-d95099533fa5 | 3 | public void sort(double[] input) {
for (int i = 0; i < input.length; i++) {
// Find minimimum value
int lowest = i;
for (int j = i; j < input.length; j++) {
if (Helper.less(input, j, lowest)) {
lowest = j;
}
}
Helper.exch(input, lowest, i);
}
} |
ebaf4163-f3d2-4a32-b6ae-2899a519b9b5 | 5 | public void testAssertWithTranscriptAndBookkeeping() {
System.out.println("\n**** testAssertWithTranscriptAndBookkeeping ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} els... |
69493f9c-c4d1-49ae-b0ec-e37b5d7bbf04 | 7 | public static final void QuestAction(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
final byte action = slea.readByte();
final int quest = slea.readShort2();
switch (action) {
case 0: { // Restore lost item
slea.skip(4);
final int itemid = slea.readInt();
MapleQ... |
04db5542-cfda-405b-a6d6-314c281ff17e | 4 | @Override
public List<String> read() {
List<String> expList = new ArrayList<String>();
try {
File xmlFile = new File("C:\\calcXmlFiles\\calc.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBu... |
3b14bff1-621c-475d-8e42-15e1b844deaa | 7 | public void run() {
long lastread = System.currentTimeMillis();
try {
boolean isread;
//while (true){
while (!clientSocket.isClosed()){
isread = false;
while (in.available() > 0) {
String command = in.readUTF();
System.out.println("Received from TCP clie... |
80ae4de4-bd43-49e1-bee5-d1b44cb1600e | 2 | private void setupPawns(Color color) {
int pawnRow = (color == Color.WHITE) ? Constants.INITIAL_WHITE_PAWN_RANK : Constants.INITIAL_BLACK_PAWN_RANK;
for (int i = 0; i < NUMBER_OF_COLS; i++) {
pieces[i][pawnRow] = new Pawn(color);
}
} |
6bcc46d6-1f35-41ae-845a-bd180c193734 | 8 | public static List<String> getFileAndDirectoryNames( File directory, String includes, String excludes,
boolean includeBasedir, boolean isCaseSensitive,
boolean getFiles, boolean getDirectories )
thr... |
b7e8223d-9f46-4c8e-bba2-38b5814fb68b | 5 | private boolean isAbleToMove(GameAreaBrick brick, int rowToMove, int columnToMove)
{
if(rowToMove < 0 || columnToMove < 0 || rowToMove >= rows || columnToMove >= columns)
return false;
if(bricks[rowToMove][columnToMove] == null)
return true;
return... |
bff9264f-d33e-4299-8230-aa6a569a422a | 0 | public void like()
{
likes++;
} |
76090630-b05b-4443-b93b-0b8b050cfd6e | 2 | public String GetPlayedEver(String profileId) throws Exception {
String gamesString = loadGames(profileId, "games?tab=all");
List<String> games = parseGamesData(gamesString, "hours_forever");
float total = 0;
for (String str : games) {
try {
total += Float.par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.