method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8c81bb6c-7ab6-4469-9892-481d854a1173 | 3 | private synchronized boolean processLine() throws IOException {
if (!isFull() && (eof == false)) {
String theLine = buffer.readLine();
if (theLine == null) {
eof = true;
fileOpen = false;
return false;
} else {
add(theLine);
return true;
}
} else {
return false;
}
} |
3c7d117f-0fe5-4602-9806-d91ab5446f7c | 7 | @Override
public boolean equals(Object obj) {
if (obj instanceof DrawableSegment) {
DrawableSegment d = (DrawableSegment) obj;
if (this.x1 == d.x1 && this.x2 == d.x2 && this.y1 == d.y1 && this.y2 == d.y2 && this.color.equals(d.color)
&& this.brushWidth == d.brushW... |
496060c9-725a-498d-86aa-26a9efa6d31e | 9 | public Effect(Type type, float effectDuration) {
this.type = type;
this.effectDuration = effectDuration;
// Apply effect (if applicable)
switch (type) {
case ENLARGE_PADDLE:
App.getMainWindow().getScene().getPaddle().expand();
break;
case MULTIBALL:
App.getMainWindow().getScene().spawnBal... |
15ab6f75-4766-4ccf-8ffe-5bf95fed12bc | 8 | private void initMsInfo() {
msCheck = new LinkedHashMap<String, JCheckBox>();
isMsCheck = new HashMap<String, Boolean>();
// Cookie情報用リストにCookieからMS種別の選択状態を取得
List<String> valueGetList = Arrays.asList(SystemProperties.getInstance().getDefaultMsList());
// ArrayList<String> valueGetList = cm.getCookie(... |
9f146258-afd2-4353-a558-0ff408db82ac | 7 | private boolean setModDir() {
if (!useModDirCheckBox.isSelected()) {
if (hadModDir)
config.removeVariable("moddir");
return true;
} else {
StringBuilder filename = new StringBuilder(mainDirTextField.getText());
char last = filename.charAt(f... |
cd4d8631-6144-412f-a247-b4081926a48d | 9 | private boolean r_combo_suffix() {
int among_var;
int v_1;
// test, line 91
v_1 = limit - cursor;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
... |
b4e5d7ec-882d-4520-894c-9de8268e07e9 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
QuizImpl quiz = (QuizImpl) o;
if (quizId != quiz.quizId) return false;
if (quizName != null ? !quizName.equals(quiz.quizName) : quiz.quizName !... |
e3413c2d-0ebf-429f-9c79-d35930629600 | 5 | public synchronized boolean insertarProcesoExpirado(Proceso p) {
boolean insertado = false;
/* Si el proceso esta corriendo o es interrumpible*/
if (p.getEstado() == Constantes.TASK_RUNNING || p.getEstado() == Constantes.TASK_INTERRUPTIBLE) {
insertado = expirados.insertarProceso(p)... |
9d5d8f26-f56b-47e0-945b-c64ab122e057 | 0 | public String getAge() {
return age;
} |
63e18550-6833-4a79-b830-8eacfe20aebd | 4 | public boolean equals(Object var1) {
if(!(var1 instanceof PathPoint)) {
return false;
} else {
PathPoint var2 = (PathPoint)var1;
return this.hash == var2.hash && this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord;
}
} |
556a7f1b-4c35-4238-81ed-45da795f2d46 | 1 | @Override
public void messageArrived(String data)
{
String text = responseTextArea.getText();
if(!text.isEmpty())
text += "\n";
responseTextArea.setText(text + data);
} |
79ecbec1-75f7-449a-91ac-7537c4f349b2 | 4 | protected void logout() {
this.dispose();
if (setTeamRepJfme != null) {
setTeamRepJfme.dispose();
}
if (editDetailsJfme != null) {
editDetailsJfme.dispose();
}
if (newActionJfme != null) {
newActionJfme.dispose();
}
if (editDetailsJfme != null) {
editDetailsJfme.dispose();
}
LoginGUI... |
56776bb6-d213-4067-92a5-7ece63a97d00 | 4 | public boolean setOffset(Point paramPoint)
{
if ((paramPoint.x < 0) || (paramPoint.y < 0) || (paramPoint.x >= this.MapSize.width - WINDOWTILEWIDTH) || (paramPoint.y >= this.MapSize.height - WINDOWTILEHEIGHT))
{
return false;
}
this.NewOffset = paramPoint;
repaint();
return true;
} |
44905e62-6607-427b-a370-1bd628e71747 | 0 | public Tester(String name) {
this.name = name;
} |
6bd7f170-3cfe-43b0-8eb6-01a9f469abba | 8 | private void checkSong(final String song, final FolderConfig folderConfig) {
String trackString = null;
final long trackId;
try {
trackId = getApi().resolve(song);
final HttpResponse trackResponse = getApi().get(new Request(String.format(Constants.TRACK_URL, trackId, Constants.CLIENT_ID)));
trackString =... |
45423079-49df-4136-9973-060e8f8eb176 | 8 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for (String ln;(ln=in.readLine())!=null;) {
int N=parseInt(ln.trim()),max=0,C,R;
String[] arr=new String[N];
for(int i=0;i<N;i++)max=ma... |
2e7c4e69-815b-4ad1-b7bd-d37dce960ec4 | 6 | @Override
public boolean incrementToken() {
if (valSize == 0)
throw new IllegalStateException("call set???Value() before usage");
if (shift >= valSize)
return false;
clearAttributes();
final char[] buffer;
switch (valSize) {
case 64:
buffer = termAtt.resizeTermBuffer(Num... |
e45a35cf-5a5b-41ce-82c3-0257672bbbb6 | 1 | public static int flipCoin()
{
if(RAND_GENERATOR.nextBoolean())
return 0;
else
return 2;
} |
54725f2d-34b4-40f8-b676-859350e9dab4 | 0 | public Map<QName, String> getOtherAttributes() {
return otherAttributes;
} |
2a969cb1-8fb4-489d-be9b-43ad028ce834 | 6 | public int compareTo(Individual arg) {
// Compare by class name first:
String first = getClass().getSimpleName();
String argFirst = arg.getClass().getSimpleName();
int firstCompare = first.compareTo(argFirst);
if(firstCompare != 0)
return firstCompare;
if(name != null && arg.name != null) {
... |
81b055f1-69e0-412d-a089-0089fc53805d | 5 | public void update(){
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles.length; y++){
if(tiles[x][y] == null)
continue;
if(tiles[x][y].foreground != null)
tiles[x][y].foreground.update();
if(tiles[x][y].background != null){
tiles[x][y].background.background = true;
... |
beedfe3a-26d4-45ac-be95-9e4aaa137c84 | 0 | private void initialize() {
model = new PortTableModel();
manager = new DataAccess(model);
table=new PortTable(model);
PortTablePanel panel = new PortTablePanel(table);
setLayout(new BorderLayout());
GridBagConstraints c = new GridBagConstraints();
SearchPanel search = new SearchPanel(manager);
c.gri... |
2432e4df-9879-4423-abd3-16a2a56f48c3 | 8 | public static Cons translateLoomStatement(Cons tree) {
{ GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree.value));
if (testValue000 == Logic.SYM_STELLA_ASK) {
return (Logic.translateLoomAsk(tree));
}
else if (testValue000 == Logic.SYM_STELLA_RETRIEVE) {
return (Logic.tra... |
f2e4952f-8114-4e3c-bc20-6ce738f3d677 | 2 | private static int elementNumber(String element) { //locates the element in elementStringArray and
for (int x = 0; x <= elementStringArray.length -1; x++) { //returns the string's int /
if (elementStringArray[x].equalsIgnoreCase(element)) { //the location of the string in the
return x; //array
}
}
retu... |
6a10a58a-38f8-4d43-9ddf-54dc3c48f43c | 6 | public boolean processMsg(CConnection cc) {
boolean res = true;
if (state == 0) {
if (state0 != null)
res = state0.processMsg(cc);
if (!res)
return res;
state++;
}
if (state == 1) {
if (state1 != null)
res = state1.processMsg(cc);
if (!res)
... |
9e142260-c278-46d8-b3f7-77ef50b0ca58 | 3 | public void action(){
Player player = World.current.getPlayers().get(0);
switch(type){
case GoldCoin:
player.coins += actionFactor;
player.inventory.inventory.remove(this);
break;
case HealthUp:
player.addHealth(actionFactor);
player.inventory.inventory.remove(this);
break;
case MeleeW... |
a1c0eb6f-bc49-45d1-a3fe-cc417055bb4b | 8 | private void recover() throws IOException {
String logName = makeLogName();
File logFile = new File(logName);
if (!logFile.exists())
return;
if (logFile.length() == 0) {
logFile.delete();
return;
}
FileInputStream fis = new FileInputSt... |
32a928b6-e287-455d-895b-77926362eaf4 | 5 | public ByteBuffer processInput(ByteBuffer buffer) throws SSLException {
mAppData.clear();
mInboundData = buffer;
insertUnderflowData();
loop:
while (mInboundData.hasRemaining() && canProceed()) {
SSLEngineResult result = mEngine.unwrap(mInboundData, mAppData);
switch (result.getStatus()) {
case ... |
ea50d298-b0fd-4244-a2f7-64858ce48555 | 6 | public String[] getUriAndLyricsSnippet(String artistName,String songName){
if (artistName.equals(null) || artistName.equals("") || songName.equals(null) || songName.equals(""))
return null;
String url = buildUrl(artistName,songName);
try {
Document document = reader.read(url);
// XMLUtil.writeToFile(docume... |
15aedc3c-9e1b-45cd-a0f7-1dab8129f6e1 | 2 | private void addProgram(String text, int type) {
int shader = glCreateShader(type);
if (shader == 0) {
System.err
.println("engine.graphics.Shader creation failed: Could not find valid memory location when adding shader");
System.exit(1);
}
g... |
29f6b563-f502-41d2-835b-e268e2791a60 | 9 | public void getSystemTray(){
//Check the SystemTray is supported
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
final PopupMenu popup = new PopupMenu();
trayIcon =
new TrayIcon(Toolkit.ge... |
d6a8a711-e466-4776-a229-9fad5f5ad313 | 5 | public int getDirection() {
if (this.getOneLength() > 1) {
Logger
.printLine("ERROR: Requested direction of Offset longer than 1");
}
if (this.xOffset == 1)
return 0;
else if (this.yOffset == 1)
return 1;
else if (this.xOffset == -1)
return 2;
else if (this.yOffset == -1)
return 3;
els... |
319772f5-ff1b-4ca7-9eaa-aa5f5fd11aaa | 7 | private static String getByteBinaryStringForFloat(float f) {
String signBit = "0";
if (f < 0) {
signBit = "1";
f = -f;
}
int integerPart = (int) f;
float fractionalPart = f - integerPart;
fractionalPart *= 16;
float tmp = fractionalPart;
... |
e3037526-e46e-4988-9327-a86eb2cf219f | 6 | private void reportNode(
Side s, Node node,
String indent, StringBuffer sB
) {
if (node == null) return ;
else {
final String tick = (s == null) ? "" : ((s == Side.L) ? " \\" : " /") ;
final String cross = (s == null) ?
">-|- " :
((node.height > 0)) ? "|- " : ">- " ;
... |
c6858f83-611a-4a3e-9f36-3ba8b66c96cf | 2 | public int getNumberOfDead(){
int res = 0;
for (Being being: beings){
if (being.isDead()){
res++;
}
}
return res;
} |
b11ffdfc-1650-44f6-9087-a4ce2af9419f | 9 | private boolean checkInput()
{
boolean result = true;
result = result && !loginTextField.getText().equals("");
result = result && !nameTextField.getText().equals("");
result = result && !surnameTextField.getText().equals("");
result = result && !passwordField.getText().equals... |
ec5ed8da-0845-4649-b669-002878fcf723 | 2 | public static void main(String[] args) {
try {
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("yourdb");
// get a single collection
DBCollection collection = db.getCollection("dummyColl");
logger.debug("Testing 1...");
insertDummyDocuments(collection);
//find hosting = hostB, an... |
bf2a96eb-2e9e-4492-a2f3-3498d1d3e162 | 2 | private String getContentInfo(String[] cbEntries) {
String comboboxHintAddition = "";
if (cbEntries != null) {
String sep = System.getProperty("line.separator");
comboboxHintAddition = sep + sep + GUIStrings.keyToLocatedString(GUIStrings.KEY_EDITOR_COMBOBOXHINTCONTENT) + sep;
... |
eef679c8-286c-4143-af24-8bac64de948a | 4 | public void copyToPencilMode () {
int i = 0, j = 0;
for (i = 0; i < 9; i++) {
for (j = 0; j < 9; j++) {
if ((pencilEntries[i][j].isEditable()) && (pencilEntries[i][j].getText().equals(""))) {
pencilEntries[i][j].setText(entries[i][j].getText());
}
}
}
} |
38bd424a-5c51-4867-91eb-f29981839750 | 6 | protected void fireInsertUpdate(DocumentEvent e) {
/*
* Now that the text is actually inserted into the content and
* element structure, we can update our token elements and "last
* tokens on lines" structure.
*/
Element lineMap = getDefaultRootElement();
DocumentEvent.ElementChange change = e.getCh... |
7eb0b4dd-bea5-4be8-99cf-2de1b97f654e | 9 | public void checkGECKs() throws IOException {
if (new File("plugins/CakesMinerApocalypse/").mkdirs())
System.out.println("GECK file created");
File myFile = new File("plugins/CakesMinerApocalypse/GECKs.txt");
if (!myFile.exists()){
PrintWriter outputFile = new PrintWriter("plugins/CakesMinerApocalypse/GECKs... |
1e26c360-9cac-4467-866a-8f0bfd1f5f77 | 6 | @onKeyAction(actions = {KeyAction.down, KeyAction.up, KeyAction.left, KeyAction.right, KeyAction.zoom_in, KeyAction.zoom_out}, states = {KeyState.held, KeyState.pressed})
private void moveCamera(KeyActionEvent event){
KeyAction action = event.getKeyAction();
if(action.equals(KeyAction.down)){
yD--;
}else if(a... |
1036c3ad-0900-4adb-9557-ce65495eb915 | 9 | static int[] buildSuffixArray(String s) {
int n = s.length(); // 空文字を含むならここで+1
SuffixArrayEntry[] sa = new SuffixArrayEntry[n];
int[][] pos = new int[2][n]; // pos[t][i]: s.substr(i)の位置(ランク)
for (int i = 0; i < n; i++) { // まず1文字だけでのランクを作成
sa[i] = new SuffixArrayEntry();
... |
57307b4f-964e-4ff8-8d02-0e0460a07c28 | 8 | public boolean isANeighbor(MenPoint toCheck) {
if (this.hasNeighborPoint(MenPointNeighbor.Upper) && this.neighborPoint(MenPointNeighbor.Upper).equals(toCheck)) {
return true;
} else if (this.hasNeighborPoint(MenPointNeighbor.Left) && this.neighborPoint(MenPointNeighbor.Left).equals(toCheck)... |
c90ac8b1-d39a-40fb-87b1-71d2f9e92e0a | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cliente other = (Cliente) obj;
if (codigo == null) {
if (other.codigo != null)
return false;
} else if (!codigo.equals(other.codigo))
... |
2619eac4-2ab4-4511-9dd6-a37176d154ee | 1 | public void useDynamite() {
if(dynamite >= 1) {
notifyPropertyChangeListeners(new PropertyChangeEvent(this, "dynamite",
dynamite, --dynamite));
}
} |
f6a59b1c-df10-4e85-86d0-a8cfdb69485c | 9 | private byte[] put(String filename, byte[] file, boolean isFirstRun) {
//System.out.println("put entrance");
this.fs.getGs().getMembershipList().setMaster();
//if you are the master you need to shard the file and send a call to the
//other servers to save the file
this.fs.getGs().getMembershipList().setSucces... |
a67588ec-63f2-4cac-9c76-044fa10bc096 | 8 | private long updateRewrite(Master master, File f, Location accessLoc, int rewriteCount) {
MasterMeta fm = null;
if (master.map.containsKey(f.getId())) {
fm = master.map.get(f.getId());
} else {
fm = new MasterMeta(f);
master.map.put(f.getId(), fm);
}
int cCount = master.clusters.s... |
980f7f72-9d74-479e-ae0e-db1f7e96ef39 | 1 | public static void captureScreenshot() {
Calendar cal = new GregorianCalendar();
int month = cal.get(Calendar.MONTH); //4
int year = cal.get(Calendar.YEAR); //2013
int sec =cal.get(Calendar.SECOND);
int min =cal.get(Calendar.MINUTE);
int date = cal.get(Calendar.DATE);
int day =cal.get(Cale... |
0c3739a2-38d6-487a-8770-f38cdd87995d | 5 | protected boolean layout(Construct construct) {
if(construct == null || mConstructRatioWidth == 0.0f) {
return false;
}
if(construct.getIsMultilined() == false) {
construct.setMultilined(true);
mFrame.invalidate();
mFrame.repaint();
return true;
} else {
for(Construct child : construct.... |
f4ae0370-dfbd-4b55-a923-bc0cda959b3f | 2 | private String getFileName(String f) {
// get file name of a file
String fname = "";
int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) {
fname = f.substring(0, i);
}
return fname;
} |
ecd9515e-00f6-495a-b7fd-0ddb8cc5c98b | 5 | public boolean remove(DockLayoutNode node) {
if (node == mChildren[0]) {
mChildren[0] = null;
pullUp(mChildren[1]);
return true;
} else if (node == mChildren[1]) {
mChildren[1] = null;
pullUp(mChildren[0]);
return true;
}
for (DockLayoutNode child : mChildren) {
if (child instanceof DockLay... |
3dc92173-35eb-4530-88d8-80ac9bbbe131 | 4 | @Override
public void read(String path) {
long startTime = System.currentTimeMillis();
try {
Scanner in = new Scanner(new FileReader(path));
rows = in.nextInt();
cols = in.nextInt();
in.useLocale(Locale.US);
for (int i = 0; i < rows; i++... |
7180879c-bfcc-4c9d-bd71-0c6251f91eba | 4 | public void checkLives()
{
// Whenever player lose life, remove corresponding life bar
if (lives == 3)
{
removeObject(live3);
}
if (lives == 2)
{
removeObject(live2);
}
if (lives == 1)
{
removeObject(live... |
607b4d4a-928b-4a3b-b7b1-16faa0abab30 | 9 | private static int parseObjectives(int index, List<Word> wordList,
List<Field> objectives, String comma) throws SQLCompilerException {
while (index < wordList.size()) {
ParseExpressionResult result = ExpressionParser.parse(index,
wordList);
if (result.getIndex() <= index) {
break;
} else {
Fi... |
e1581a17-ace3-49eb-9abf-39eca369f105 | 0 | public void setType(int type) {this.type = type;} |
2d2c2ae3-252d-4f92-b554-ce47831c07e8 | 3 | public float diff(MultiColor b)
{
float res = 0;
for (int i = 0; i < data.length; i++)
{
if (data[i] == -1 || b.data[i] == -1)
continue;
float d = data[i] - b.data[i];
res += d * d;
}
... |
8afbea0a-76d5-4a8c-b789-65f4e6081be6 | 5 | public void menuStopped(ACTION action)
{
switch(action)
{
case NEW_GAME:
graphicsEngine.stopMenu(ui);
playTheGame();
break;
case OPTIONS:
break;
case MANUAL:
break;
... |
882e8468-6bac-4402-9eb4-7d60273b4045 | 6 | public void renderShadowedString(String text, float x, float y, float factor) {
boolean flag = false;
if (factor <= 0.0F) {
flag = true;
}
forceUseGL = true;
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA... |
7ddaf8f1-9621-44ef-a436-2c8906637969 | 9 | @Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
// Put the named entities recognized by PosAnnotator in a sentence into mPosSet.
mPosSet.clear();
for (org.apache.uima.jcas.tcas.Annotation geneEntity : aJCas
.getAnnotationIndex(Annotation.type)) {
Annotat... |
daf44c02-32c4-4f61-b959-616d53bbc036 | 5 | public Traversal<T> getRest() {
if (isEmpty()) {
throw new UnsupportedOperationException(
"Cannot advance to the rest of an empty data set"); // empty tree
}
if (leftBranch != null && !leftBranch.isEmpty()) { // if there's non-empty left sub-tree
Traversal<T> lbRest = leftBranch.getRest(); /... |
b2ebf554-73b1-499a-8ad9-dd712deedcfd | 2 | public Object opt(int index) {
return (index < 0 || index >= this.length()) ? null : this.myArrayList
.get(index);
} |
8029a6de-6543-4628-966c-cac1f207a73a | 0 | public Entity fillModel() {
Entity entity = new Entity();
entity.setName(this.name);
entity.setDescription(this.description);
return entity;
} |
c5827c6f-5841-4eda-9cff-c2ba3b4928b1 | 3 | public void dump(String prefix) {
System.out.println(toString(prefix));
if (children != null) {
for (int i = 0; i < children.length; ++i) {
SimpleNode n = (SimpleNode)children[i];
if (n != null) {
n.dump(prefix + " ");
}
}
}
} |
ff264f7b-920f-45ad-a78e-a20e53884b68 | 1 | @Override
public Set<FoodObject> lookUpFoodByCollection(Collection<String> names) {
Set<FoodObject> resultSet = new HashSet<FoodObject>();
for (String s : names)
{
resultSet.add(this.lookUpFood(s));
}
return resultSet;
} |
b582b142-c0d7-4192-bca7-b4c2e2e94a35 | 4 | private void findDNGFiles(AbstractQueue<String> queue, String path) {
System.out.print(".");
File root = new File(path);
File[] list = root.listFiles();
if (list == null) return;
for (File f : list) {
if (f.isDirectory()) {
findDNGFiles(queue, f.getAbsolutePath());... |
3c0dce97-8cf2-4dcb-bd6a-6463816987cd | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
m = sc.nextInt();
if(m==0)break;
n = sc.nextInt();
s = sc.nextInt();
int[][][] a = new int[s][m+1][n+1];
for(int i=0;i<s;i++)a[i]=bfs(sc.nextInt(), sc.nextInt());
int max = 0;
int t = sc.nextInt();
... |
9bd01825-2d61-4fae-835f-47b7150c8df4 | 7 | final private boolean jj_3R_94() {
if (jj_3R_42()) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(13)) {
jj_scanpos = xsp;
if (jj_3R_129()) return true;
}
if (jj_scan_token(IDENTIFIER)) return true;
xsp = jj_scanpos;
if (jj_3R_178()) jj_scanpos = xsp;
xsp = jj_sc... |
cb66198d-e3d5-4728-b2d7-39fecade7331 | 3 | public boolean anyValid(OthelloPiece colour){
boolean valid = false;
for(int i=0; i<WIDTH;i++){
for(int j=0;j<HEIGHT;j++){
if(anyMove(i,j,colour)){
valid = true;
}
}
}
clea... |
651f16f1-3d80-4af4-a14e-c83b7dba3c37 | 1 | @Override
public void deserialize(ByteBuffer buf) {
name = BufferUtil.getString(buf);
type = buf.get() == 0 ? PlayerType.PLAYING : PlayerType.SPECTATING;
side = Side.values()[buf.get()];
} |
2e7e8194-6e34-49ca-b548-8dea592a78d8 | 3 | public Point getNeighbour(Direction direction) {
switch (direction) {
case UP: return new Point(x, y-1);
case DOWN: return new Point(x, y+1);
case LEFT: return new Point(x-1, y);
default: return new Point(x+1, y);
}
} |
24946efc-ef8a-449e-9fdd-8fb53d188f50 | 7 | private List<List<MazeNode>> generateBlankMaze(){
List<List<MazeNode>> maze = new ArrayList<List<MazeNode>>(columns);
for(int i = 0; i < rows; i++){
maze.add(new ArrayList<MazeNode>());
}
//add a node to each element
for(int row = 0; row < rows; row++){
for(int column = 0; column < columns; column++){
... |
686638ee-268a-4fc7-a1f1-889fb4d29350 | 0 | public void setLive(boolean isLive) {
this.isLive = isLive;
} |
85a21727-8097-49ca-b509-18c0b94e732a | 3 | public void getUser() throws IOException{
while(true){
String line = reader2.readLine();
if (line == null) break;
try {
JSONObject user = new JSONObject(line);
String u_id = user.getString("user_id");
String u_name = user.getString("name");
int u_reviewCount = user.getInt("review_count");
... |
fc10516b-0cf8-4d0b-9562-da842f5b289e | 3 | private void btnLogarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogarActionPerformed
if (!txtUsuario.getText().isEmpty() && !txtSenha.getText().isEmpty()) {
Validacoes valida = new Validacoes();
boolean valido = valida.isValidLogin(txtUsuario.getText(), txtSen... |
412ad990-1f37-40ae-a2d5-ab5779d48c64 | 7 | public void gameLoop() throws IOException{
while(gameRunning)
{
player1move();
renderSprites(); // Iterate through and draw all sprites
if(player1.Collided(powerUp1))
{
spriteCache.remove(powerUp... |
2d300bb3-51e9-4bab-a94f-c7fe41f5cd5d | 9 | private char escapedStringChar(PositionTrackingPushbackReader par1PositionTrackingPushbackReader) throws IOException, InvalidSyntaxException
{
char var3 = (char)par1PositionTrackingPushbackReader.read();
char var2;
switch (var3)
{
case 34:
var2 = 34;
... |
7d9dbed8-f3fd-4b72-933d-80e6c73f5e06 | 3 | static public Location[] getLocations()
{
Charset charset = Charset.forName("UTF-8");
try (BufferedReader reader = Files.newBufferedReader(new File("VMlocations.ini").toPath(), charset))
{
String line;
StringBuilder builder = new StringBuilder();
while ((line = reader.readLine()) != nul... |
10ee77dc-6d63-4c58-b3f1-c1fe051f2068 | 5 | public JInternalFrame createInfoFrame(final JFrame frame, String objName, GameObject rootObj)
{
String name = "";
if(objName.endsWith(" <GameObject>"))
{
objName = objName.substring(0, objName.length() - 13);
}
int index = 0;
boolean instantClose = false;
synchronized(rootObj.getAllAttache... |
7c11b00e-37a7-4bf8-8ec9-94639f1990fb | 8 | public void generateParentsTree(String current){
int rank = fullGenreList.get(current).getRank();
if(rank ==0)
{
return;
}
else {
int max = 0;
List<String> parents = new ArrayList<String>();
for (String keys : fullGenr... |
9c903a58-9033-4d82-bb21-92ef5686e502 | 8 | public void updateLight(int x, int y) {
BlockType b = getBlockAt(x, y);
boolean air = false;
if (b == null) {
air = true;
byte l = (byte) 0x0;
int airCount = 0;
for (int i = y; i > 0; i--) {
airCount++;
}
l += airCount / 40;
setLight(x, y, l);
if (getTopY(x) > y)
return;
}
if (... |
fe9e4d39-b2ec-4ecd-bb69-29004e36af7b | 9 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
String P_KEY = null;
StringBuilder sB = new StringBuilder();
sB.append("CREATE TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n");
sB.append(" (\n");
int i = 0;
for(Col... |
465d29a2-2c69-40c6-b440-32c436ff94cc | 2 | @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPhysics(BlockPhysicsEvent event){
if (event.getChangedType() != Material.PORTAL) return;
if (event.getChangedType() == Material.PORTAL){
event.setCancelled(true);
}
} |
b1d28d2e-dfc1-423a-81e0-d121368458b3 | 0 | public void matchesContainsMethodWithArguments()
{
Filter containsMethod = containsMethod( "matches", Class.class );
assert containsMethod.matches( Filter.class );
assert !containsMethod.matches( MeiyoScanner.class );
} |
204810be-ec7d-4136-8c51-5103f1fca42c | 0 | public void setSpeakerList(final List<Speaker> speakerList) {
this.speakerList = speakerList;
} |
3ec1ccf5-6f29-41de-b8ac-6546e9d99421 | 7 | public boolean TopologicalSort(ArrayList<Vertex> graph) {
Stack<Vertex> vertexStack = new Stack<Vertex>();
//ArrayList<Vertex> vertexVisitedOrder = new ArrayList<Vertex>();
// Add all vertices with an indegree of 0 to the stack.
for (Vertex vertex : graph) {
if (vertex.inCount == 0) {
ve... |
19da8315-2c40-4e71-b2de-7ebc9e7b9ec9 | 8 | private static void combine(String f, String s){
try{
readerA = new BufferedReader(new FileReader("" + f + ".txt"));
new Scanner(readerA);
readerB = new BufferedReader(new FileReader("" + s + ".txt"));
new Scanner(readerB);
}
catch(FileNotFoundException e){
System.err.println("Files Could Not Be Fo... |
69066daa-b7c9-42ca-8418-58a6e7a96781 | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
e845dd52-4d58-4a0f-8485-1464e61b5870 | 7 | private void AreaDFS(AreaNode n)
{
ArrayList<Goal> neighborGoals = new ArrayList<Goal>();
// BFS adding all fields to AreaNode
Queue<Field> queue = new LinkedList<Field>();
queue.add(n.fields.get(0));
while (queue.size() > 0) {
Field t = queue.poll();
for (Field field : t.neighbors) {
if (field=... |
5de2cdb6-f9b2-45b7-9f29-7db12e712b7e | 7 | public PlayerActionGenerator(GameState a_gs) {
// Generate the reserved resources:
base_ru = new PlayerAction(a_gs.getMapWidth(), a_gs.getMapHeight());
gs = a_gs;
for(Unit u:gs.getMyUnits()) {
if (u.hasAction()) {
base_ru.mergeResourceUsage(u, u.getAc... |
7ea337ab-7416-475f-bf2f-7e39bc841ca1 | 2 | @Override
@SuppressWarnings("empty-statement")
public boolean savePrefs() throws IOException {
String rawData = toString();
byte[] data = rawData.getBytes();
FileOutputStream fileOut = null;
try {
fileOut = new FileOutputStream(prefsFile);
fileOut... |
c01cd1b8-8358-4750-9f29-7c4abd79b356 | 2 | public void mouseEntered(MouseEvent evt) {
if (evt.getSource()==buysell){
mousein = 1;
}
if (evt.getSource()==close){
mousein = 2;
}
} |
ee89fc83-0c8c-4376-9374-bb4c29a7ee36 | 1 | public boolean isEncoded(){
return audioInputStream.getFormat().getEncoding() != Encoding.PCM_SIGNED
&& audioInputStream.getFormat().getEncoding() != Encoding.PCM_UNSIGNED;
} |
d335a40c-22e8-4c54-952f-c8ecb101fc1a | 0 | public SpaceShip(String name) {
this.name = name;
} |
fc8fd8cc-6afa-4c8f-b47e-59ba594681a4 | 8 | public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... paramTypes) {
Class<?>[] t = toPrimitiveTypeArray(paramTypes);
for (Constructor<?> c : clazz.getConstructors()) {
Class<?>[] types = toPrimitiveTypeArray(c.getParameterTypes());
if (equalsTypeArray(types, t))
return c;
}
return nu... |
9dd89e2f-2f04-446e-a84d-0aa2fabb9807 | 0 | public void setType(int type) {
this.type = type;
} |
6cbc150d-203d-4bca-97da-c796cb041d69 | 1 | public void load30DegreeSlope(Rectangle2D e) {
for(int x = 0; x < TileSet.tileWidth / 2; x++) {
platforms.add(new Platform(new Rectangle2D.Double(e.getX() + (2f * x), e.getY() + x, 2f, 2f)));
//System.out.println("Upper " + platforms.get(platforms.size() - 1).getBox().getY());
}
} |
7e762802-cf5c-4b55-9237-6eacd53e3226 | 4 | @Override
public void simpleUpdate(float tpf)
{
Vector3f camDirection = cam.getDirection().clone().multLocal(0.6f);
Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);
listener.setLocation(cam.getLocation());
listener.setRotation(cam.getRotation());
walkDirecti... |
d969ef6d-74ef-4ba1-95a3-9aa5ea4b5614 | 9 | private static void insertUserAndTweets(List<User> users, List<Tweet> tweets) {
Connection con = null;
PreparedStatement stat = null;
ResultSet res = null;
try {
con = Database.getConnection();
for (User user : users) {
String preparedQuery = "INSERT INTO User VALUES (?,?,?,?)";
stat = con.prepa... |
3fa960c0-95ee-443b-be12-979262772ff2 | 9 | public Picture apply(String effect) {
List<Integer> attributes = new ArrayList<>();
int red;
int green;
int blue;
boolean invR;
boolean invG;
boolean invB;
if (effect != "inv") {
for (String string : Arrays.asList(effect.split(","))) {
int bytee = Integer.parseInt(string.trim());
// System.ou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.