method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a5bd28ae-0cdc-4e55-be26-e8273d2083cf | 7 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
final MOB invoker = this.invoker();
super.unInvoke();
if(canBeUninvoked())
{
mob.tell(L("You feel less intoxicated."));
CMLib.commands().postStand(mob,true);... |
41f10f43-ce0e-47cd-95b1-5fb11271702f | 6 | public int largestRectangleArea(int[] height) {
int [] heights = new int[height.length+1];
System.arraycopy(height, 0, heights, 0, height.length);
Stack<Integer> stack = new Stack<Integer>();;
int max = 0;
for(int i = 0; i < heights.length; ++i){
if(stack.size() == 0 ... |
124d8e5e-c085-4022-ae52-95ae14594f6e | 6 | public NieuweGebruikerDialoog(JFrame fr) {
super(fr);
voorNaamLabel = new JLabel("Voornaam");
familieNaamLabel = new JLabel("familienaam");
afdelingLabel = new JLabel("Afdeling");
jaarAfdelingLabel = new JLabel("Jaar (1e of 2e)");
geboorteDatumLabel = new JLabel("Geboorte... |
fb55edfd-8594-4701-b5e3-87e750226494 | 9 | private static LinkedList<Diff> diff_lineMode(String text1, String text2, long deadline)
{
// Scan the text on a line-by-line basis first.
final LinesToCharsResult b = diff_linesToChars(text1, text2);
text1 = b.chars1;
text2 = b.chars2;
final List<String> linearray = b.lineArray;
final LinkedList<Diff> di... |
c399b770-8d19-4256-9d29-031dafc9e4d0 | 6 | public void executeAdmin(Object object) {
if (object instanceof Category) {
for (Category category : approveCategories) {
approveCategory(category.getName());
}
approveCategories.clear();
}
if (object instanceof Client) {
try {
... |
cddafad1-759c-4ec4-95c7-d03c43ea0127 | 9 | public void run() {
try {
boolean running = true;
while (running) {
try {
String line = null;
while ((line = _breader.readLine()) != null) {
... |
adf3ceb9-3dbe-4729-a08d-54be23170938 | 8 | public void temporalLearning(){
for(int r=0; r<row;r++){
for(int c=0; c<column; c++){
for(Cell cell: columns[r][c].cells){
if(cell.tLearnState==true){
cell.adaptSegments(true);
System.out.print("Y");
}
else if(cell.tPredictiveState == false && cell.pPredictiveState == true){
ce... |
c05193ce-12cc-4d0c-aa1f-b0ac5c5348da | 2 | public static void main(String args[]) {
File[] files = FileLister.getFilesArrayFile();
int selection = FileChooser.chooseFile();
if (selection < files.length) {
boolean success = files[selection].delete();
if (success) {
System.out.println(">File successfully deleted");
} else {
System.out.print... |
05c3e1ee-188c-4b2f-a000-d25569e4a23e | 1 | public void setUserKey(String userKey) {
if (this.userKey == null | !this.userKey.equals(userKey)) {
this.userKey = userKey;
NotifyUserKeyChanged();
}
} |
604476eb-a332-419e-84b4-ad1a38c0740d | 1 | @Test
public void size() throws IllegalAccessException {
Question q = mock(Question.class);
assertFalse(blocker.isDuplicate(q));
assertTrue(blocker.isDuplicate(q));
for (int i = 0; i < limit; i++) {
assertFalse(blocker.isDuplicate(mock(Question.class)));
}
... |
0cb0a22d-b79e-4918-a82c-9b92afb91e29 | 0 | public static void main(String[] args) {
new ThreadDemo("Thread 1");
new ThreadDemo("Thread 2");
new ThreadDemo("Thread 3");
} |
2ef03326-eae6-4eab-a066-3aa6e5caba71 | 3 | protected void analyzePixels() {
int len = pixels.length;
int nPix = len / 3;
indexedPixels = new byte[nPix];
MiniQuant nq = new MiniQuant(pixels, len, sample);
// initialize quantizer
colorTab = nq.process(); // create reduced palette
// convert map from BGR to RGB
for (int i = 0; i < colorTab.length; ... |
912dee64-ce03-410d-829a-a7d2003c8be3 | 8 | static public Direction opposite(Direction d) {
if (d == N) return S;
else if (d == W) return E;
else if (d == S) return N;
else if (d == E) return W;
else if (d == NW) return SE;
else if (d == NE) return SW;
else if (d == SW) return NE;
else if (... |
3f06e3f9-c2ec-4cf0-a24f-c2d0f812674e | 2 | public void testProperty() {
YearMonth test = new YearMonth(2005, 6);
assertEquals(test.year(), test.property(DateTimeFieldType.year()));
assertEquals(test.monthOfYear(), test.property(DateTimeFieldType.monthOfYear()));
try {
test.property(DateTimeFieldType.millisOfDay());
... |
0a6bc8e0-d024-4783-89e7-9e92e8c636d1 | 5 | private boolean checkStringMatch(String attr, String critVal) {
if (attr == null) {
return false;
}
attr = attr.toLowerCase();
critVal = critVal.toLowerCase();
boolean startsWith = critVal.startsWith("%");
boolean endsWith = critVal.endsWith("%");
if... |
ae088f9f-0cfc-4677-a28f-1e1d0cd4ec8b | 6 | public void updateBlocks(float delta) {
for (Block b : blocks) {
b.update(delta, blockSpeed);
if (b.isVisible()) {
if ((player.isDucked() && b.getRect().intersects(
player.getDuckRect()))
|| (!player.isDucked() && b.getRect().intersects(
player.getRect()))) {
b.onCollide(player);
... |
3cfcb7d5-abd2-4f88-a9d3-3ad10eb8c1eb | 3 | public EnemyLocation reserveLocation(long actor) {
if(!free()) {
return null;
}
Collections.shuffle(enemyLocations);
for(EnemyLocation loc : enemyLocations) {
if(loc.reserve(actor)) {
freeLocations--;
return loc;
... |
644d3a35-a1fa-4d76-abbd-3257908e84b3 | 0 | @Override
protected int processAppInfo (byte[] appInfo)
{
// TBD
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbTMReaderWriter:processAppInfo"); }
return SUCCESS ;
} // end method processAppInfo; |
eaf47bee-be5e-4b4e-b581-e1933a7b558f | 5 | static final void method1802(int i) throws IOException {
if (Class348_Sub40_Sub8.gameConnection != null
&& (Class348_Sub34.anInt6969 ^ 0xffffffff) < -1) {
int i_2_ = 0;
for (;;) {
BufferedPacket packet = (BufferedPacket) Class348_Sub40_Sub13.aClass262_9201.getFirst(i ^ 0x4);
if (packet == null)
... |
c3471f3c-e743-4d7f-8453-521ff58b8bc4 | 3 | @Override
public Object getDefaultAttributeValue(Class<? extends Attribute> category) {
if (category == Media.class) {
return MediaSizeName.NA_LETTER;
}
if (category == OrientationRequested.class) {
return OrientationRequested.PORTRAIT;
}
return null;
} |
694e4028-57a7-447b-9baf-3279ebe88920 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServerFile other = (ServerFile) obj;
if (id == 0) // newly created objects.
return this.getPath().equals(other.getPath())
&& this.getName... |
8007f9be-b9a2-4e39-a1ab-27b03cb2ad34 | 2 | public static <T> Collection<T> filter(Collection<T> collection, Predicate<T> predicate){
Collection<T> temp = new ArrayList<T>();
for(T t : collection){
if(predicate.evaluate(t)){
temp.add(t);
}
}
return temp;
} |
bd2fffc9-fee1-4d5e-b4a4-4d0ceea23c84 | 7 | private static void writeResults(HashMap<String, GeneHolder> map,
boolean removeDupes) throws Exception
{
System.out.println("Writing results");
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(
ConfigReader.getBioLockJDir() + File.separator + "resistantAnnotation" +
File.separator... |
a74f4fcf-8d61-4db5-939a-4f018d40549f | 5 | private static CubeNode search(int bound) {
nodesVisited++;
while (!frontier.isEmpty()) {
nodesVisited++;
CubeNode current = frontier.poll();
// If we have found the goal, return the goal node
if (Arrays.equals(current.state, Cube.GOAL.toCharArray())) {
return current;
}
// Add this current n... |
2f7ddcc2-109c-424c-b78e-aae5759aff6e | 0 | public void keyTyped(KeyEvent e) {
} |
a7c553da-3d62-4071-bdea-6f6a753e814b | 4 | public String[][] fill(String[][] table){
for (int i = 0; i < table.length; i++)
for (int j = 0; j < table[i].length; j++)
if ((i == 0) || (j ==0))
table[i][j] = "";
else
table[i][j] = "0.0";
return table;
} |
476ae026-fc25-4132-ade6-26bff7b78cb1 | 3 | public boolean isChromEqual(Chrom c)
{
boolean equals = true;
if(c.getGenes().length==g.length)
{
for(int i=0; i<g.length; i++)
{
if(!c.getGenes()[i].isGeneEqual(g[i]))
{
equals = false;
}
... |
0cda6dd1-949a-4473-9df3-48677ea8aaca | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
de76fb81-4842-4080-a36e-326b1501aeb1 | 6 | public static void helpPrintDecisionTree(DecisionTree tree, int level, PrintableStringWriter stream) {
if (tree.feature == null) {
if (tree.truthValue) {
stream.println("True");
}
else {
stream.println("False");
}
return;
}
stream.println();
{ int i = Stella... |
61de89f0-9f31-4959-ac36-76fbaaad8802 | 3 | public static double polinomioDeLagrange(Punto[] puntos, double x) {
double p = 0;
double l;
for (int i = 0; i < puntos.length; i++) {
l = 1;
for (int j = 0; j < puntos.length; j++) {
if (i != j) {
double xj = puntos[j].getX();
... |
8d529ee6-d98f-4453-9e7e-81c767857da1 | 1 | public void deleteLocation() {
World<T> world = parentFrame.getWorld();
Location loc = display.getCurrentLocation();
if (loc != null) {
world.remove(loc);
parentFrame.repaint();
}
} |
49e99f09-c102-4e6b-b533-d0c9bd328f28 | 1 | private boolean isEmpty(){
boolean result=true;
if(size==0){
assert firstNode==null;
result =true;
}else{
assert firstNode!=null;
result=false;
}
return result;
} |
c1270cc7-a896-4784-9d38-8898c63b8d87 | 8 | @Override
public void mouseClicked(MouseEvent e) {
for (ClickableObject object : gpanel.getPuzzle().getObjectList()) {
if ((mouseX(e) >= object.getX() && mouseX(e) <= object.getX() + object.getW()) && (mouseY(e) >= object.getY() && mouseY(e) <= object.getY() + object.getH())) {
i... |
a081f664-976a-4e4a-a43b-a72ab0bfedf7 | 9 | public boolean handleInput(String line) {
// quit the game
if (line.equalsIgnoreCase("quit")) {
return false;
}
// quit the game
if (line.equalsIgnoreCase("exit")) {
return false;
}
// help quest
if (line.equalsIg... |
9020c35c-ec78-4809-9936-e3e412a4e0e4 | 6 | public static String getC_MatchingCommandName(int _MatchingCommand){
switch(_MatchingCommand){
case C_VALUE_EXACT:
return "VALUE_EXACT";
case C_VALUE_BIGGER:
return "VALUE_BIGGER";
case C_VALUE_EQUAL_OR_BIGGER:
return "VALUE_EQUAL_OR_BIGGER";
case C... |
8bea7adc-3655-4d18-93e6-efea9a119e01 | 6 | public static void resolveChildrenReferences() {
if (Stella.$CLASSES_WITH_UNRESOLVED_CHILDREN_REFERENCES$.emptyP() ||
Stella.$UNFINALIZED_CLASSES$.emptyP()) {
return;
}
{ Cons unresolvableclasses = Stella.NIL;
Stella.$CLASSES_WITH_UNRESOLVED_CHILDREN_REFERENCES$.removeDeletedMembers();
... |
9270928e-a09b-4fd9-a490-41055618ecf5 | 5 | private List<Posicao> movimentosPossiveisPeaoPreto(Posicao posicao) {
List<Posicao> movimentosPossiveis = new ArrayList<>();
/* movimento inicial */
if (posicao.getLinha() == 6) {
if (this.getCasas(posicao.getColuna(), posicao.getLinha() - 1) == null) {
movimentosPo... |
dada0973-e58c-43d2-94f8-2062210e3efd | 9 | void distribute_op_args(SS_scriptset ss)
{
Enumeration<SS_script> scripts = ss.by_name.elements();
int ind1 = 0;
for (; scripts.hasMoreElements(); )
{
SS_script sc = scripts.nextElement();
ind1++;
Enumeration<SS_script> scripts2 = ss.by_name.elements();
boolean found = false;
i... |
f2ce59a4-4bfa-4df6-b8c3-1a422cf89064 | 5 | @EventHandler
public void MobNerf(EntityTargetEvent event){
Entity target = event.getTarget();
Entity e = event.getEntity();
if (e instanceof Player) {
return;
}
if(target instanceof Player){
String targetName = ((Player) target).getName();
for(i = 0; i < plugin.Watching.size(); i++){
if(plugin.... |
1c2cf6bd-a389-41cb-919d-e4e050d1f8e1 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
13f70225-d61e-4f67-806b-946d5d6124db | 7 | @Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof BeanKey)) {
return false;
}
final BeanKey beanKey = (BeanKey) obj;
if (beanType.equals(beanKey.getBeanType())) {
if (quali... |
274b4ad5-0679-4ebf-8042-2503b7aeb701 | 4 | public void eatPellet(int x, int y) {
int target = -1;
for (int i = 0; i < pellets.size(); i ++) {
if (pellets.get(i).x == x && pellets.get(i).y == y) {
target = i;
}
}
if (target > -1) {
pellets.remove(target);
}
} |
f6080162-ed4c-4eb2-aa71-cb6904505169 | 3 | private void initButtons() {
ImageButton title = new ImageButton(parent, "Loop " + (loopNum + 1), ViusicMain.screenWidth - (int)(ViusicMain.screenWidth / 1.2f) , (int)( ViusicMain.screenHeight / 1.45f), 400, 25, 1);
ImageButton backPane = new ImageButton(parent, "", title.getX(), title.getY(), title.getBo... |
e145f018-cc5b-421b-9ee9-3bfc61a02e8d | 2 | @Override
public boolean isEmpty() {
lock.lock();
try {
for (int i = 0; i < chairs.length; ++i) {
if (chairs[i] != null) {
return false;
}
}
return true;
} finally {
lock.unlock();
}... |
cbacb3a1-1020-4bf4-ae8e-c340e7e05a43 | 0 | public int getNumberOfGenerations() {
return this.generation_num;
} |
880260fb-b9eb-4161-b052-14d57a1a4035 | 7 | public long processDate(String input) {
int day = -1;
int month = -1;
int year = -1;
int hour = -1;
int minute = -1;
String period = "AM";
String[] inputArray = input.split(" ");
Calendar tempCal = Calendar.getInstance();
// At least need the day and month
if (inputArray.length < 2) {
retu... |
b572e1c9-3cb8-4713-9f33-e6a1ee089d0b | 1 | public void setContent(Component newContent)
{
Component oldContent = getContent();
if (hasContent()) {
remove(oldContent);
}
add(newContent, BorderLayout.CENTER);
firePropertyChange("content", oldContent, newContent);
} |
065bf68f-b2c4-473e-90c3-79359937e7bd | 7 | @Override
public void train(List<Instance> instances) {
this.D = this.getFeautreDimension(instances);
// initialize w and eta
double[] w = new double[this.D];
double[] eta = new double[this.D];
double[] I = new double[this.D];
for(int i=0; i<this.D; i++){
w[i] = 0;
eta[i] = this._eta0;
I[i] = 1... |
11129b8f-c4be-4b34-b0d5-d3b45459d8d8 | 1 | public void makeAvailable(String key) {
if(allItems.containsKey(key)) {
availableItems.put(key, allItems.get(key));
}
} |
347ef062-353d-4d9d-bead-07b6c5e708cd | 3 | public void setAAte(TNumeroInt node)
{
if(this._aAte_ != null)
{
this._aAte_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
199e3f63-4037-4b03-b52f-78448877624c | 1 | private void closeConnection()
{
System.out.println( "\nTerminating connection\n" );
// setTextFieldEditable( false ); // disable enterField
try
{
output.close(); // close output stream
input.close(); // close input stream
connection.close(); // close socket
} // end try
catch ( IOException ioE... |
700caf5a-9576-4652-847d-2e7b3a58be85 | 7 | private boolean solve_num(int row,int col,int[][] result)
{
int sq=result.length;
if(row==sq || col==sq)
return true;
// if(result[row][col]!=0)
// return true;
ArrayList<Integer> cands=new ArrayList<Integer>();
/* for(int i=0;i<filled.length;i++)
{
if(!filled[i] && is_valid(i+1,result,row,col))
... |
b5952358-ca9e-407c-8ed4-b027b38105a0 | 8 | final public void InclusiveOrExpression() throws ParseException {
Token t=null;
ExclusiveOrExpression();
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BIT_OR:
case BIT_ORX:
;
break;
default:
break label_9;
}
switch ((jj_ntk... |
af5d5031-397c-415d-be71-44bdd69f0b86 | 8 | public void run(){
msg.setText("Tuning...");
try {
final AudioFormat format = presetFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
line.start();
int bufferSize = (int) format.getSampleRat... |
0431179e-ab73-4e62-91c2-03cbcaebc369 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
241cf112-abb3-4812-b5fe-c6df39e42ed6 | 4 | public void update()
{
player.update();
for(Door door : doors)
door.update();
for(Monster monster : monsters)
monster.update();
for(Medkit medkit : medkits)
medkit.update();
for(Medkit medkit : removeList)
medkits.remove(medkit);
removeList.clear();
} |
a854a7cb-885d-490a-9eaf-57441d7a3209 | 2 | public static AccessFacilityEnumeration fromValue(String v) {
for (AccessFacilityEnumeration c: AccessFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
bd43a7ff-25c8-420a-9faf-47745c1ea362 | 2 | public static void outModel(ModelClassDesc modelClassDesc)
throws IOException, TemplateException {
Template temp = config.getTemplate("model.ftl");
String path = modelClassDesc.getPackgeName().replace(".", "/") + "/model/";
File file = new File(FreeMarkerUtils.class.getResource("/").getPath()
+ "/src/" + ... |
e43a0739-e59a-4f47-bce0-6b9d5cb942b4 | 7 | private void ConvertToGrid(int x, int y)
{
switch (this.tabToShow[x][y].getEtat())
{
case vide: //vide -- blanc -- 255,255,255 -- 0
this.grid[x][y].setBackground(new Color(255,255,255));
this.grid[x][y].setPositionX(x);
this.grid[x... |
5f949074-90e5-4d95-a6a4-b89a470b7f46 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((CMath.bset(msg.sourceMajor(),CMMsg.MASK_MAGIC))
||(CMath.bset(msg.targetMajor(),CMMsg.MASK_MAGIC))
||(CMath.bset(msg.othersMajor(),CMMsg.MASK_MAGIC)))
{
Room room=null;... |
9f46705f-c726-4636-b050-a66b1d7f69e6 | 0 | public JobSchedulerBuilder withTimeZone( TimeZone timeZone )
{
this.timeZone = timeZone;
return this;
} |
12cca210-fdbe-413c-8af6-64786bcf85fa | 8 | private ArrayList<String> recBreak(String s, Set<String> dict){
if(map.contains(s))
return null;
ArrayList<String> list = new ArrayList<String>();
ArrayList<String> temp = null;
for(int i =1; i<= s.length(); i++){
temp = new ArrayList<String>();
String... |
27a84534-f8cd-4f10-b9d7-b7b2ac4c8dc2 | 3 | public void run() {
init();
long start;
long elapsed;
long wait;
while (running) {
start = System.nanoTime();
update();
draw();
drawToScreen();
elapsed = System.nanoTime() - start;
wait = targetTime - elapsed / 1000000;
if (wait < 0)
wait = 5;
try {
Thread.sleep(wait);
} cat... |
1a75c935-13e0-4b2f-8730-02169d61878d | 1 | public void invalidateAllRowHeights() {
if (mRowHeight < 1) {
TreeRow[] rows = mRowHeightMap.keys(new TreeRow[mRowHeightMap.size()]);
mRowHeightMap.clear();
notify(TreeNotificationKeys.ROW_HEIGHT, rows);
}
} |
88efa689-17ed-432f-9edd-9771beda1c3a | 1 | public void render(IRenderContext target, double viewportX, double viewportY) {
Iterator<EntityComponent> it = components.iterator();
while (it.hasNext()) {
it.next().render(target, viewportX, viewportY);
}
} |
cb0728e3-9b94-4acc-ba15-6e3638576576 | 3 | public void ChangeState(State changeState) {
switch (changeState) {
case newState: {
changetoNewState();
break;
}
case gameState: {
changetoGameState();
break;
}
case menuState: {
... |
789d6f07-9853-45fb-8e53-beb94892f6f5 | 2 | private boolean pickduringobservation(int[] bowl, int[] record) {
System.out.println("we are in the pickduring observation");
System.out.printf("\n the score for this bow is %d\n", score(bowl));
if (score(bowl)>average(record)*1.5 && score(bowl)>=max)
return true;
else
return false;
} |
204e05c1-2a71-4ea8-b691-b44b2e71dd3c | 2 | public void random(PrintWriter writer) {
writer.println("#" + k + ":");
int i = 100;
while (i <= 10000000) //1000, 10000,...,100000000
{
for (int j = 1; j <= i; j++) {
add(1 + (int) (Math.random() * ((k - 1) + 1)));
}
makeMaxMin();
... |
ff9b16c9-5697-4d6b-a716-54f5c081e2dd | 9 | public synchronized Object borrowObject() throws Exception {
assertOpen();
Object obj = null;
boolean newlyCreated = false;
while(null == obj) {
if(_pool.isEmpty()) {
if(null == _factory) {
throw new NoSuchElementException();
... |
703518a2-ae40-474d-aeba-91ea0a496220 | 0 | public People(String name)
{
this.name =name;
} |
03ff8ff9-18cb-4095-9989-3bcc024b789e | 6 | private String getMatch(String s) {
for (int i = 0; i < dataList.size(); i++) {
String s1 = dataList.get(i).toString();
if (s1 != null) {
if (!isCaseSensitive
&& s1.toLowerCase().startsWith(s.toLowerCase())) {
return s1;
}
if (isCaseSensitive && s1.startsWith(s)) {
return s1;
}
}
... |
17fda57d-712b-4a20-8516-66e033c73e50 | 4 | @Override
public boolean equals(Object other) {
if (other == this)
return true;
if (other == null || other.getClass() != this.getClass())
return false;
Position pos = (Position) other;
return this.xCoordinate == pos.xCoordinate && this.yCoordinate == pos.yCoordinate;
} |
5b4a22be-3521-4945-918d-6af7216cca6a | 8 | public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2)
{
if (mode1.getWidth() != mode2.getWidth()
|| mode1.getHeight() != mode2.getHeight())
return false;
if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI
&& mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI
&& mode1.getBitDep... |
85783980-6f50-45ba-bb79-b5d5a439abae | 2 | static boolean safeIsBlack(int i, int j){
if(i>=isBlack.length || j>=isBlack[0].length) return true;
else return isBlack[i][j];
} |
03452e09-c493-4880-913c-488855be1388 | 8 | public QueueNode pop() {
if (this.isEmpty()) return null;
QueueNode result = this.peek();
int p = 0, p1, p2, pn;
this.innerList.set(0, this.innerList.get(this.innerList.size()-1));
this.innerList.remove(this.innerList.size()-1);
this.nodeIDs.set(result.getNodeID(), -1);
... |
5e4f6f29-e9dc-4095-8f46-47010e060af4 | 1 | public void addNode(Node node) {
if (this.next == null) {
this.next = node;
node.previous = this;
} else {
this.next.addNode(node);
}
} |
5c5c77c8-ff48-4ae2-b771-e9930e289256 | 1 | public String getString(String o) {
try {
String v = Pattern.compile(o + ": \"").split(line)[1];
return v.substring(0, v.indexOf("\""));
} catch(Exception ex) {
}
return null;
} |
a1f10b17-6ac1-43df-9d90-17e0d41d77e7 | 9 | protected void writeDocType(String type, String systemId, String publicId) throws XPathException {
try {
if (declarationIsWritten && !indenting) {
// don't add a newline if indenting, because the indenter will already have done so
writer.write("\n");
}
... |
37919722-c200-4a90-8a45-d49e05f290ce | 4 | public ArrayList<String> query1(int studentid) {
try{
openDatabase();
}catch(Exception e){}
String query = "SELECT name FROM t8005t2 .modules WHERE ID IN (SELECT ID FROM t8005t2 .takes WHERE StudentID = "
+ studentid + ")";
ArrayList<String> modules = new ArrayList<String>();
try {
stmt = conn... |
6959f91f-6831-452b-92c6-e319a0c85b36 | 6 | final public List<TableField> FieldList() throws ParseException {
List<TableField> l = new ArrayList<TableField>();
TableField f;
f = Field();
l.add(f);
label_9: while (true) {
if (jj_2_6(2)) {
;
} else {
break label_9;
}
FieldSep();
f = Field();
l.add(f);
}
switch ((jj_ntk == -1... |
3d33dfe1-77b6-4456-a57a-53e40d60c60e | 4 | public void render(int x, int y){
int dx = x / World.cur.tileSize;
int dy = y / World.cur.tileSize;
World w = World.cur;
if(w.getTile(dx - 1, dy) == id && w.getTile(dx, dy - 1) == id && w.getTile(dx + 1, dy) == id && w.getTile(dx, dy + 1) == id){
Renderer.Quad(textures[0], new Vector2(x, y), w.tileSize, w... |
7821663a-1983-479d-a7f4-679a7868f27d | 1 | public static void loadImages() {
try {
tree = ImageIO.read(new File("res/tree.png"));
townhall = ImageIO.read(new File("res/townhall.png"));
lumberpost = ImageIO.read(new File("res/lumberpost.png"));
stone = ImageIO.read(new File("res/stone.png"));
gold = ImageIO.read(new File("res/gold.png"));
log... |
91a2b55f-10ff-401c-97d8-4f214e5af104 | 8 | private Value factor() {
// System.out.println("factor " + data.get(0).getTokenType().name() + ":" + data.get(0).getValue());
Token t = popToken();
switch(t.getTokenType()) {
case SCONSTANT:
return new ConstantValue(t.getValue(), new Type("integer"));
case SSTRING:
String tmp = t.getValue().substring(1,... |
191b4774-caa1-454d-ac8e-c02a79cf066e | 4 | public int compareTo(Alignment other)
{
if(this.alignSize>other.getAlignSize())
return 1;
else if(this.alignSize<other.getAlignSize())
return -1;
else
{
if(this.iscScore>other.getIscScore())
return 1;
else if(this.iscScore<other.getIscScore())
return -1;
else
return 0;
}
} |
830ac12d-a65a-401e-9db4-33b3d914f9ef | 8 | private ChartEntry readEntryAll(ScanfReader scanReader, String fname)
throws IOException {
String entryName = scanReader.scanString("%S");
ChartEntry entry = new ChartEntry(entryName);
String attributeName;
while (!(attributeName = scanReader.scanString()).equals("end... |
e2a49f0d-f762-427c-a3f2-b094abb62173 | 7 | @Override
public void run() {
for (Map.Entry<String, String> entry : urlMap.entrySet()) {
if (!stopDownloading) {
boolean isSuccessfullyDownloaded = false;
String superLink = createSuperLink ? createSuperLink(entry.getValue()) : "";
if (!superLink.isEmpty())
isSuccessfullyDownloaded = downloadFil... |
3dbefd46-02f9-4b81-869f-61e836c3de5a | 3 | public static void supprimerSujet(Sujet sujet, Utilisateur utilisateur) {
if (!sujet.peutSupprimer(utilisateur))
throw new InterditException("Vous n'avez pas les droits requis pour modifier cette réponse");
EntityTransaction transaction = SujetRepo.get().transaction();
try {
... |
8ee12564-ff55-4325-960a-f1977c24743d | 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://download.ora... |
2fad1818-8458-4bcc-bcc2-74f355b1f9aa | 2 | public static boolean load() {
if (Config.isUsingMySQL()) {
if (!loadMySQL()) loadSQLite();
} else
loadSQLite();
database.loadAllObjects();
Logging.info("Loaded objects.");
database.loadAllOwnership();
Logging.info("Loaded ownership.");
dat... |
fa82cae5-e56b-4095-9416-a1c516fff12e | 3 | public void addGameResult(String name, int result) {
switch(result) {
case WIN_OPT: db.get(name).getStatistic().win++; break;
case LOSE_OPT: db.get(name).getStatistic().lose++; break;
case DRAW_OPT: db.get(name).getStatistic().draw++; break;
default: ... |
cf5ad836-9f64-4ffe-886d-96f7591b064c | 9 | @Override
public void validate(Object object, Errors errors) {
NewUserForm newUserForm = (NewUserForm)object;
if (!StringUtils.hasText(newUserForm.getName())){
errors.rejectValue("name", "error.required", null, "Field required.");
}
if (!StringUtils.hasText(newUserForm.getSurname())){
errors.rejectValue(... |
e20fc783-6906-4b12-a709-9bcffe8c3215 | 6 | private List<Posicao> posicoesAdjacentesPeca(Posicao posicao) {
List<Posicao> posicoesAdjacentes = new ArrayList<>();
int coluna;
int linha;
for (int varianteColuna = -1; varianteColuna < 2; varianteColuna++) {
for (int varianteLinha = -1; varianteLinha < 2; varianteLinha++... |
54ef5960-fa6c-4f0c-acb6-6ef2cde93e4f | 4 | public void registerSystem(ProcessSystem system){
boolean systemExists = systemMap.containsKey(system.getUniqueID());
if(!systemExists && !system.getUniqueID().equals("NULL")){
if(system.getSystemType() == ProcessSystem.SystemType.PROCESS) processSystems.add(system);
else if(system.getSystemType() == ProcessS... |
5e875abe-66f4-44d3-845a-1c3c1846e9ba | 4 | public void sendCommandToClients(Command command, Socket skip) {
for (Socket client: clients) {
if (!skip.equals(client)) {
try {
if (!client.isClosed()) {
System.out.println("sending to client");
PrintWriter out = n... |
76b67d17-55b1-41e7-bbf7-4181c5a56918 | 8 | public static int getArgbFromString(String strColor) {
if (strColor != null) {
if (strColor.length() == 9 && strColor.indexOf("[x") == 0 && strColor.indexOf("]") == 8)
strColor = "#" + strColor.substring(2, 8);
if (strColor.length() == 7 && strColor.charAt(0) == '#') {
try {
int red = Integer.parse... |
e888fad7-cb3c-40db-a1ad-2408950f0eec | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CarType other = (CarType) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return ... |
4f7851fe-60d9-44d7-873b-6a4d405fc0f8 | 8 | public void engineNextBytes(byte[] bytes) {
if (DEBUG && debuglevel > 8) debug(">>> engineNextBytes()");
if (!adaptee.isInitialised()) {
this.engineSetSeed(new byte[0]);
}
while (true) {
try {
adaptee.nextBytes(bytes, 0, bytes.length);
break;
}... |
20407220-1eb0-4ddb-abc4-8b00ce900e18 | 1 | public int get(int row, int clums) {
int i = 0;
File f = new File("C:/config/config.xlsx");
try {
InputStream input = new FileInputStream(f);
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(input);
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
XSSFRow xssfRow = xssfSheet.getRow(row - 1);
XSSFCell ... |
7df10ffa-d9d3-42bf-8341-58b93f8a7be8 | 4 | protected static Ptg calcFV( Ptg[] operands )
{
if( operands.length < 3 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "calcFV" );
double rate = operands[0].getDoubleVal();
int nper = operands[1].getIntVal();
double pmt = operands[2].getDoubleVal();
double pv = 0;
int type... |
e4ee4924-9f6c-4932-b743-e680bcd71481 | 6 | public ConfigParam processAndGetParam(String str){
if(sectionAnalizer.isValidObject() && !sectionAnalizer.isValidObjectForAddedValue(str)){
sectionIsReadyEvent();
} else if(descAnalizer.isValidObject() && !descAnalizer.isValidObjectForAddedValue(str)){
descIsReadyEvent();
} else if(paramAnalizer.isValidO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.