method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7d5abe16-26ef-4ed7-9d2e-03032ac0e7ce | 6 | @Override
public final String value() {
final int key = this._key_;
final BEXFileLoader owner = this._owner_;
switch (BEXLoader._typeOf_(key)) {
case BEX_VOID_TYPE:
return "";
case BEX_ATTR_NODE:
return owner._attrValueText_.get(owner._attrValueRef_.get(BEXLoader._refOf_(key)));
case BE... |
29bf747a-5bbf-4b60-bcb5-c697b420d1a7 | 2 | public boolean equals(Node n) {
if (n == null)
return false;
return this.x == n.getX() && this.y == n.getY();
} |
a2758e31-31d0-41b9-be85-ad68d459e3be | 8 | public FlowContext getTargetContextForContinueLabel(char[] labelName) {
FlowContext current = this;
FlowContext lastContinuable = null;
FlowContext lastNonReturningSubRoutine = null;
while (current != null) {
if (current.isNonReturningContext()) {
lastNonReturningSubRoutine = current;
} else {
if (curren... |
c44ecb3b-8ef6-4ab5-8453-bd300ac58af8 | 9 | protected void readFactorsAndCovariates(Element model,
String factorOrCovariate)
throws Exception {
Instances miningSchemaI = m_miningSchema.getFieldsAsInstances();
NodeList factorL = model.getElementsByTagName(factorOrCovariate);
if (factorL.getLength() == 1... |
003429e7-150b-436e-abe5-3a9d8e94f96f | 0 | public void setDate(Date date) {
this.date = date;
} |
40143d32-54a1-413c-bf1f-80bfdc4f71ef | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReportPart other = (ReportPart) obj;
if (reportPartDetail == null) {
if (other.reportPartDetail != null)
return false;
} else if (!repor... |
52a0fc7b-4ca1-4b04-81b6-d0fb210533d0 | 1 | public static void main(String[] args) {
List<OOMObject> list = new ArrayList<OOMObject>();
while(true){
list.add(new OOMObject());
}
} |
727bf203-eb77-473a-bed7-aff66b3dae27 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PeopleData)) return false;
PeopleData that = (PeopleData) o;
if (key != null ? !key.equals(that.key) : that.key != null)
return false;
if (value != null ? !value.equals(th... |
ccd03897-2090-4783-94ba-bd587c0378ac | 6 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Grid) {
Grid<?> other = (Grid<?>) obj;
return rowCount() == other.rowCount() &&
columnCount() == other.columnCount() &&
... |
33ff962e-1f8b-419d-bd87-e0bf1fe678e8 | 6 | public void setPlayer(int x, int y) {
p.setTileX(x);
p.setTileY(y);
playerSet = true;
if(Maze.gridSize > 20) {
if(x > Maze.gridSize - 10) {
xOffset = Maze.gridSize - 20;
} else if(x > 10) {
xOffset = x - 10;
}
if(y > Maze.gridSize - 10) {
yOffset = Maze.gridSize - 20;
} else if(... |
d0b17e95-47ad-429a-a5c8-dbd27ed8e139 | 1 | public void setMonth(int month) {
// Test if month is between 0-12
// If true set the month if false set to zero
if (month <= 12 & month >= 0)
this._month = month;
else
this._month = 0;
this._set = true;
} |
a1c4e608-baab-4aaa-9189-b7630c3fa64b | 7 | public static void main(String[] args) {
if (args == null || args.length == 0) {
System.out.println(" Missing Settings File Argument!");
System.exit(-1);
}
File settingsFile = new File(args[0]);
if (!settingsFile.isFile()) {
System.out.println("Setting... |
d6894c0b-4795-4bf7-9c6a-ddb1b82a8507 | 6 | public Graph cloneGraph() {
Graph graphCopy = new Graph();
HashSet<Node> processed = new HashSet<Node>();
LinkedList<Node> queue = new LinkedList<Node>();
LinkedList<Node> queueCopy = new LinkedList<Node>();
Node currNode, currNodeCopy;
int index;
for (Node n : nodes) {
if (!processed.contains(n)... |
dc3129ca-fbd7-476a-bd06-a72b9970daec | 7 | @Override
public Dimension preferredLayoutSize(Container parent) {
int height = 0;
int width = (mColumns - 1) * mHGap;
synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets();
int compCount = parent.getComponentCount();
int[] widths = new int[mColumns];
int rows = 1 + (compCount - 1... |
a315ff6e-7383-4209-a362-a8e23907cc50 | 3 | /* */ public void updateBunkers(Graphics g)
/* */ {
/* 634 */ for (int i = 0; i < bunkers.size(); i++) {
/* 635 */ Bunker bunker = (Bunker)bunkers.get(i);
/* 636 */ g.drawImage(bunker.image, bunker.x + offsetX, bunker.y + offsetY,
/* 637 */ this);
/* 638 */ int[] newy = new in... |
df0ddd8c-ad95-45a4-8c6d-5b6f469ca787 | 3 | @Override
public Token parse() {
Token test = first;
term = new Term(test, scope);
test = term.parse();
while (test.isOperator()) {
Operator testOp = test.getOperator();
if (Operator.ADD.equals(testOp) || Operator.SUBTRACT.equals(testOp)) {
ops.add(testOp);
Term t = new Term(test.getNext(), sc... |
6aefba95-9d3b-4982-b3a4-23b74788bfdf | 2 | public String toString()
{
// return properties(this);
String quantityString = "";
if(quantity != 1)
quantityString = quantity+"";
String chargeString = "";
if(useSetCharge)
chargeString = "{"+charge+"}";
return getSymbol()+quantityString+chargeString;
} |
df261a6b-9d05-42df-abf0-d61e4f46f75a | 6 | public static void main(String args[]) {
if (args.length < 1 || (!args[0].equals("0") && !args[0].equals("1"))) {
System.out.println("USAGE: java TextLoop <mode>");
System.out.println(" mode 0: without threads");
System.out.println(" mode 1: with threads");
... |
3272555d-e0bf-43f7-820a-e894f6c69001 | 3 | private void carregaBairros(){
if(comboCidade.getSelectedItem().toString().equals("Selecionar ...")){
System.out.println("Nenhuma cidade selecionada");
}else{
System.out.println("Carregando bairros...");
String cod = String.valueOf(comboCidade.getSelectedIndex... |
08f809a0-a412-417f-95a5-2a70d79470c4 | 0 | public int GetSpeed()
{
return speed;
} |
6d27ddba-9e84-46bf-9bb5-8d82cf50e389 | 4 | @Override
public void onEnter(int x, int y, Tile tile) {
if (x < 1 || y < 1) {
return;
}
if (tile.isGround()) {
creature.x = x;
creature.y = y;
} else if (tile.isDiggable()) {
creature.dig(x, y);
}
} |
3c9bbe2a-4241-4e35-8cd7-1e0c2f3aa4a8 | 4 | @Override
public void update(float delta) {
this.x+=this.dx*delta;
this.y+=this.dy*delta;
if(this.dx < 0) {
this.dx = MathHelper.clampFloat(this.dx+0.1f, this.dx, 0f);
}
if(this.dx > 0) {
this.dx = MathHelper.clampFloat(this.dx+0.1f, 0f, this.dx);
}
if(this.dy < 0) {
this.dy = MathHelper.c... |
49d1183e-97c0-42ed-abfc-832077a9d54e | 1 | public static Logger getLogger(String logFile, String className) {
Logger logger;
try {
logger = Logger.getLogger(className);
FileHandler fileTxt = new FileHandler(logFile);
java.util.logging.Formatter formatterTxt = new SimpleFormatter();
fileTxt.setFormatter(formatterTxt);
logger... |
eb3fc97e-f4ea-49e9-8f60-8a6a3ce03dbc | 1 | public boolean end() {
return this.eof && !this.usePrevious;
} |
3588899c-a890-45ee-83bf-4e96618f46f2 | 1 | public Iterator getChilds() {
/*
* Since loadedClasses is somewhat sorted by the hashcode of the
* _original_ names, swap it here to prevent to guess even parts of the
* names.
*/
if (swappedClasses == null) {
swappedClasses = Arrays.asList(loadedClasses.values().toArray());
Collections.shuffle(sw... |
c3d63f1b-4cff-4e4b-ad8f-ae6bd7de6ee0 | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectLongMap ) ) {
return false;
}
TObjectLongMap that = ( TObjectLongMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectLongIterator iter = ... |
aa11c5c1-ea9b-4e3c-ad5a-35715c901773 | 6 | public void limitVelocity() {
double leftR = left.enc.getRate();
double rightR = right.enc.getRate();
if (leftR > vel) {
leftV -= INC;
}
if (rightR > vel) {
rightV -= INC;
} else if (leftR < vel && rightR < vel && leftV < GOAL_V && rightV < GOAL_V)... |
a9ef45c2-d878-4fc9-922b-2a05495a0ace | 5 | public HashMap<String,String> mainRequest(HashMap<String,String> items){
final HashMap<String,String> out= new HashMap<String,String>();
final String url_req=this.urlparse(items);
final String json_text=this.request_from_api(url_req);
final JSONObject output=this.get_data(json_text);
if(output!=null){
fin... |
882dfe8f-7775-4c60-a38d-5324a9ff73f7 | 8 | public static <GInput, GValue, GValue2> Field<GInput, GValue> convertedField(final Field<? super GInput, GValue2> field,
final Converter<? super GValue, ? extends GValue2> parser, final Converter<? super GValue2, ? extends GValue> formatter) throws NullPointerException {
if (field == null) throw new NullPointerExce... |
3d9fd22a-cbe7-45eb-a2f5-11878286f7c6 | 6 | private final void method2014(int i) {
if (anInt2419 != i) {
anInt2419 = i;
int j = WorldLocation.method996(i, true);
if (j > 512) {
j = 512;
}
if (j != anInt2414) {
anInt2414 = j;
aClass142_Sub27_Sub12_S... |
d35f6f7a-cda8-467c-8eb2-e2f59b56b459 | 9 | @Override
public String getMessage() {
List<String> msgList = new ArrayList<String>();
String existing = super.getMessage();
if (existing != null) {
msgList.add(existing);
}
if (status.getStatusCode() != 408) {
msgList.add(String.format("<Status=%d, Reason=%s>",
sta... |
af48a0f1-6741-4e2c-ab03-37f9e1d49d61 | 9 | private void eatBacteria(Bacteria bac){
int e = bac.getEnergy();
if (!bac.isDead() && e > 0) {
float aggressionDiff = this.getGenetics().getAggression() - bac.getGenetics().getAggression();
if(bac.isDying()){
int eatenEnergy = Math.min(e, 50);
... |
14d099fc-4f18-4c76-83d9-c0c71345b19f | 2 | public static Subcategorias sqlLeer(Subcategorias subcat){
String sql="SELECT * FROM subcategorias WHERE idsubcategorias = '"+subcat.getId()+"'";
if(!BD.getInstance().sqlSelect(sql)){
return null;
}
if(!BD.getInstance().sqlFetch()){
return null;
}
... |
e5c6e3a1-ecb1-45d0-94c6-49a9abc3c8b2 | 1 | public void hputbuf(int val)
{
int ofs = offset;
buf[ofs++] = val & 0x80;
buf[ofs++] = val & 0x40;
buf[ofs++] = val & 0x20;
buf[ofs++] = val & 0x10;
buf[ofs++] = val & 0x08;
buf[ofs++] = val & 0x04;
buf[ofs++] = val & 0x02;
buf[ofs++] = val & 0x01;
if (ofs==BUFSIZE)... |
cb6d75d8-6ec7-41b8-8515-e73115efaa66 | 8 | private void mouseHandler() {
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent event) {
// If it's not our round, exit.
if (!game.canPlay())
return;
// Get piece below the cursor.
if (event.getX() <= marginX || event.getX() >= marginX + gridSize)
ret... |
ce00f1e7-d4c8-475f-860b-745e6b18c488 | 9 | @RequestMapping(value = "/generateReport.do")
public ModelAndView generateReport(String txnType, String startDate,
String endDate, String fileName, HttpServletRequest request,
HttpServletResponse response) {
// 传递是否是admin到页面
HttpSession session = request.getSession();
Users u = (Users) session.getAttribut... |
cca3d684-0345-4fc5-90a6-750b277d15c1 | 3 | public void paint(GC gc, int width, int height) {
Device device = gc.getDevice();
// draw side lines
gc.setLineWidth(1);
gc.setLineStyle(SWT.LINE_DOT);
gc.setForeground(device.getSystemColor(SWT.COLOR_BLACK));
gc.drawLine(3*width/16, height/6, 3*width/16, 5*height/6);
gc.drawLine(13*width/16, height/6, 13*widt... |
24602c80-2b6f-497b-bfee-0b554c4eba85 | 6 | private void generateTextActionPerformed(java.awt.event.ActionEvent evt) {
NavigableSet<String> keySet = this.scheduleMap.navigableKeySet();
String textOutput = new String();
File readout = new File("Calendar.txt");
ArrayList<String> dutyRows = new ArrayList<String>();
int column = 1;
for (String i : keySe... |
07899348-ad53-4a1c-813f-71d99145cb26 | 8 | @EventHandler
public void onSignChange(SignChangeEvent event)
{
Player player = event.getPlayer();
String Line1 = event.getLine(0);
String Line2 = event.getLine(1);
String Line3 = event.getLine(2);
if(Line1.equals("[Promote]") || Line1.equals(ChatColor.GREEN + "[Promote]"... |
ee3327be-24ad-487a-ad31-11b1551bbf59 | 8 | public String getOutputFileExt() {
switch( outputFormat ) {
case txt: return ".txt";
case rtf: return ".rtf";
case docx: return ".docx";
case xlsx: return ".xlsx";
case pptx: return ".pptx";
case pdfSearchable:
case pdfTextAndImages: return ".pdf";
case xml: return ".xml";
}
return ".ocr";... |
fa2a0c05-b73c-48db-9c07-98198f8acaac | 6 | private static void makeDefaultBody(Bytecode b, CtClass type) {
int op;
int value;
if (type instanceof CtPrimitiveType) {
CtPrimitiveType pt = (CtPrimitiveType)type;
op = pt.getReturnOp();
if (op == Opcode.DRETURN)
value = Opcode.DCONST_0;
... |
1cc224b2-1c19-4c0c-ae98-d0cfebb846a3 | 5 | public static void main(String[] args) throws IOException {
BufferedReader dis = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter number of persons: ");
int num = Integer.parseInt(dis.readLine());
String s[] = new String[num];
int i,j;
System.out.println("Enter " + num + " perso... |
78a34795-24af-474d-8349-c8eae5967216 | 0 | public int getHeight() {
return this.size;
} |
b569d5d8-cb47-4edb-a252-b1e01abed7e9 | 7 | public void doPost(HttpServletRequest request, HttpServletResponse response) {
if( logger.isLoggable(Level.FINEST) ) {
logger.finest("Got post: " + request.toString());
}
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
logger.warn... |
39e2a6b0-7668-4d98-b1ca-1731f70d4803 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
645156ac-449f-4848-861d-014099fc27e3 | 1 | static void copyReversed(int dst[], int src[])
{
for (int i = 0; i < src.length/2; i++)
{
dst[ i*2 ] = src[src.length - i*2 - 2];
dst[ i*2 + 1 ] = src[src.length - i*2 + 1 - 2];
}
/* for (int i = 0; i < dst.length/2; i++)
System.out.println(dst[ i*2 ] + ", " + dst[ i*2 + 1 ] + "\t" +
... |
206352e7-8b89-45eb-8c54-f4b7e24072fc | 6 | public LabColor(PDFObject obj) throws IOException {
// obj is a dictionary that has the following parts:
// WhitePoint [a b c]
// BlackPoint [a b c]
// Gamma a
super(TYPE_Lab, 3);
PDFObject ary= obj.getDictRef("WhitePoint");
if (ary!=null) {
for(int i=0; i<3; i++) {
white[i]= ary.getAt(i).getFloatValue();... |
47800f50-8e89-4120-8075-63429971c8a9 | 1 | private List<T> mapperDBObject(DBCursor cursor, BeanMapper<T> mapper) {
List<T> list = new ArrayList<T>();
while (cursor.hasNext()) {
list.add(mapper.mapper(cursor.next()));
}
return list;
} |
f3a4ea34-8d87-4dc8-8a16-ce115a9b1547 | 3 | @Override
public boolean evaluate(Auction t) {
ArrayList<Auction> temp = new ArrayList<Auction>(searches.values());
for(Auction auc : temp){
if(auc.getName().equalsIgnoreCase(criteria)){
temp.add(auc);
}
}
return t.getName().contains(criteria) || t.getDescription().contains(criteria);
} |
1b40ee7b-7d5c-481b-a2e0-d13f3d0cfc0d | 8 | public void setSettings(final SettingsData data) {
if(_dialog == null) {
createDialog();
}
_dataIdentificationChoice.setDataIdentification(
data.getObjectTypes(), data.getAttributeGroup(), data.getAspect(), data.getObjects(), data.getSimulationVariant()
);
_dataIdentificationChoice.showTree(getA... |
df061ce2-94e7-4c1a-8d07-2ee3d65888b8 | 6 | protected boolean isFinished() {
final long timeDiff = System.currentTimeMillis() - startTime;
//TODO make sure things get finished (time to be on target)
return (((state != ClawPivotSubsystem.PICKUP && clawPID.onTarget() && timeDiff > 1500) || timeDiff > 4000) && (driveFinishedChecker == null ... |
fa91d5e3-3326-4c9f-9ee1-3b7e6a4f9b73 | 2 | @Override
public void renderControl(Graphics2D g) {
BufferedImage Control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) Control.getGraphics();
// Draw Background
if(this.getBackgroundColor() !=... |
da5704bc-0cff-4862-bdbf-447bfb479256 | 3 | public void setTypeAsString(String value) {
value = value.toLowerCase();
if (value.equals("buch")) {
type = Type.book;
}
else if (value.equals("dvd")) {
type = Type.dvd;
}
else if (value.equals("musik_cd")) {
type = Type.music;
}
else {
type = Type.valueOf(value);
}
} |
3ad35133-c07c-45b1-b163-b32cad75d00c | 7 | public void generateMoves(Piece[][] squares, ArrayList<Move> validMoves, ArrayList<Move> validCaptures) {
// for each possible direction (NE, SE, SW, NW)
int xPos;
int yPos;
for (int direction = 0; direction < xMoves.length; direction++) {
xPos = xPosition + xMoves[direction];
yPos = yPosition + yMoves[d... |
6aafa23c-9f4a-41a4-9f8a-35b93ee8db32 | 7 | public static Solucao VizinhoTwoFlip(Solucao inicio){
for(int a = 0; a<=inicio.getColunas().size()-2; a++){
for(int b = a+1; b<=inicio.getColunas().size()-1;b++){
for(Integer entrada1 : inicio.getLinhasX().keySet()){
for(Integer entrada2 : inicio.getLinhasX().keyS... |
751c7345-f208-47d4-b544-1702ad4feaea | 6 | @EventHandler
public void SilverfishJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble("Silverfis... |
703266d7-7902-4587-a7cb-ac01e46da9dc | 4 | protected void revertOffers()
{
for (ItemStack item : p1inv.getOwnItems()) {
if (item != null) {
p1.getInventory().addItem(new ItemStack[] { item });
}
}
for (ItemStack item : p2inv.getOwnItems())
if (item != null)
p2.getInventory().addItem(new ItemStack[] { item });
} |
200445a9-4329-4872-8f99-c1f9820e06d0 | 3 | public void sendInvoice(EmailInvoice invoice) {
// FIXME: this is Frank's job - fix it asap
if (invoice.isEmailInvoice()) {
emailService.send(invoice);
}
if (invoice.isFaxInvoice()) {
faxService.send((FaxInvoice) invoice);
}
if (invoice.isPaperInvo... |
fcde2a05-bf5b-4a68-9586-f9c4b23d40cd | 9 | public void notifySourceElementRequestor( ClassData clazz ) {
char [] typeName=clazz.name.toCharArray();
// prevent possible recurrsion
if (notifiedTypes.containsKey(typeName))
return;
notifiedTypes.put(typeName, null);
ISourceElementRequestor.TypeInfo typeInfo = new ISourceElementRequestor.TypeInf... |
a41defe0-8ab3-4e3d-b58c-54f9f350f3ba | 7 | @Override
public void run(){
while(true) {
try {
for (RemoteAccount ra : RemoteAccount.values()) {
this.ra = ra;
socket = new Socket(ra.server, ra.port);
reader = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
writer = new BufferedWriter(new OutputStreamWriter(... |
f857ce53-82ec-4cff-b15f-b2d9aa4ff0c7 | 3 | public ShortcutSettingsFrame()
{
ShortcutSettingsEventHandler handler = new ShortcutSettingsEventHandler(this);
this.setResizable(false);
this.setIconImage(Constants.ICON);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setBounds(100, 100, 450, 337);
JPanel contentPane = new JPanel();
conte... |
dc341fdd-4f39-4083-b192-9b39a62acb75 | 4 | public void SetBoard(String board) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetBoard() BEGIN");
}
repaint();
m_board = board;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetBoard() END");
}
} |
b6a95d34-1020-477c-9e7a-1b7b8ec90c30 | 2 | public final Opponent findHighMoney() {
checkDateCounter();
for (Opponent opp : highMoney) {
if (opp.canFight()) {
return opp;
}
}
return null;
} |
bb2f84c0-89cc-4d2a-a511-0d67e9c44ceb | 3 | public boolean checkException (ChainException e,
String expectedException) {
boolean notCaught = true;
while (true) {
String exception = e.getClass().getName();
if (exception.equals(expectedException)) {
return (!notCaught);
}
if ( e.prev==null ) {
return no... |
78783a71-a18e-4b6b-925a-ec639df790f6 | 3 | public void setOption(String option, Collection values) {
if (option.startsWith("keywords")) {
keywords = (String[]) values.toArray(new String[values.size()]);
} else if (option.startsWith("backup")) {
if (values.size() != 1)
throw new IllegalArgumentException("Only one backup is allowed");
backup = (R... |
d9277d36-4ce2-4066-9f43-2c7be0610adc | 8 | public void solve(){
solveRunning = true;
g = ctrl.getGrid();
//Add delay so that each step is visible.
while(!isSolved(g)){
try{
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
... |
eefac60d-550a-41e4-8693-d7ce4780f9fe | 8 | public void setNextSquare(String square){
nextYCoord = Integer.parseInt(square.substring(1,2));
switch(square.charAt(0)){
case 'a':
nextXCoord=1;
break;
case 'b':
nextXCoord=2;
break;
case 'c':
nextXCoord=3;
break;
case 'd':
nextXCoord=4;
break;
case 'e':
nextXCoord=5;
bre... |
758c0622-5d79-43b9-8e51-6f1f805cee96 | 9 | public static void main(String[] args) {
int poolSize = 2;
int trials = 300;
String[] cards = CardDB.getCards();
for(String s : cards){
System.out.println(s);
}
ArrayList<String[]> generation = Game.makeGeneration(poolSize);
System.out.println("New pool of " + poolSize
+ " decks generated. \nThi... |
90f39267-6949-4b3f-b48f-93d98763a1c3 | 7 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
if (!(e.getMessage() instanceof ChannelBuffer))
return;
Object sessionObject = ctx.getAttachment();
if (sessionObject != null && sessionObject instanceof Session) {
Session session = (Session) sessionObject;
if (session.g... |
5499200c-eab3-4536-bb76-f6dfd8372fff | 2 | @Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getID() == KeyEvent.KEY_PRESSED) {
KEY_STATE.set(event.getKeyCode());
} else if (event.getID() == KeyEvent.KEY_RELEASED) {
KEY_STATE.clear(event.getKeyCode());
}
return false;
} |
4e5c6ac8-8f57-4b94-a92a-586f46ee03c4 | 1 | public EnumElement checkVesselPosition(EnumBoard player, EnumLine line,
EnumColumn column) {
Map<String, EnumElement> board = (player.equals(EnumBoard.PLAYER1)) ? this.boardPlayer1
: this.boardPlayer2;
return board.get(this.createPosition(line, column));
} |
9db1bec5-d76c-4d9c-b9b0-50f1c3d92a00 | 5 | private void buildData() {
for (int i = 0; i < nodesSet.length; i++) {
nodes = new Pair[nodesSet[i] != null ? nodesSet[i].size() : 1];
nodes = nodesSet[i].toArray(nodes);
Pair root = null;
if (nodes != null && nodes.length > 0 && nodes[0] != null) {
... |
5e912f1f-3bab-4a36-9cc6-a2afda3ab695 | 5 | private void prepareTreeToWrite(Node node, final int infoPos, int deep) {
char[] log = null;
log = list.get(deep);
log[0] = String.valueOf(deep).charAt(0);
if (deep > 9) log[1] = String.valueOf(deep).charAt(1);
int newPosLeft = (int) (infoPos - infoPos/12);
int newPosRi... |
8ea79c9f-ad0e-485f-bcf7-ded37bb06851 | 9 | public void fillSocialMatrix() {
for (int i = 0; i < socialMatrix.length; i++)
for (int j = 0; j < socialMatrix.length; j++)
socialMatrix[i][j] = new SocialMatrixCell();
Set<String> keyNodes = socialGraphNodes.keySet();
for (Iterator<String> i = keyNodes.iterator(); i.hasNext();) {
String keyNode = (St... |
29e75964-6753-41b4-a2b0-c60f52bbefbf | 1 | @Override
public void stop() {
if (this.mcApplet != null) {
this.active = false;
this.mcApplet.stop();
return;
}
} |
986f5a9d-dc25-4188-bc96-2d31ee3ad7a2 | 3 | public boolean playSynchronous() {
MidiDevice receivingDevice = null;
try {
receivingDevice = getReceivingDevice();
receivingDevice.open();
File cancion = new File(fileName);
Sequence sequence1 = MidiSystem.getSequence(cancion);
Sequencer sequencer1 = MidiSystem.getSequencer(... |
7be80362-0937-488a-8b0f-8db2f7496e4d | 9 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == cancelButton)
closeWindow();
else if (e.getSource() == okButton)
{
String name = (String) comboBoxUnitName.getSelectedItem();
double azimuth = Utility.stringToDouble(textFieldAzimuth.getText());
double elevation = Utility.stringTo... |
f70b919b-f408-46cb-9ac1-c8754c226414 | 8 | private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0, 0L);
return 7;
}
switch(curChar)
{
ca... |
d43686cb-0347-4801-9777-6f98c37c3d3d | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Arch other = (Arch) obj;
if (start == null) {
if (other.start != null)
return false;
} else if (!start.equals(other.start))
return fa... |
5ddd3d17-6ce8-4480-aafb-7b271d0dd2b1 | 9 | private BookmarkModel createBookmarkModel(IPresentation[] selectingPresentations) {
if (selectingPresentations == null || selectingPresentations.length == 0) {
return null;
}
BookmarkModel ret = new BookmarkModel();
{
List<String> classIds = new ArrayList<String... |
0a67a606-919b-4140-9dc1-7c4ac601741c | 4 | private void handleFavicon() throws IOException {
if (this.pingResponse == null)
createPingResponse();
File favicon = new File("server-icon.png");
if (favicon.exists()) {
BufferedImage image = ImageIO.read(favicon);
if (image.getWidth() != 64 || image.getHei... |
136bcb73-bfb2-4f8f-92ab-ac541732df9e | 2 | public static void encodeFileToFile(String infile, String outfile)
throws java.io.IOException {
String encoded = Base64.encodeFromFile(infile);
java.io.OutputStream out = null;
try {
out = new java.io.BufferedOutputStream(
new java.io.FileOutputStream(outfile));
out.write(encoded.getBytes("US-ASCII... |
db81807e-c30c-4c36-a03b-ce2fb1817908 | 7 | private void makeWin(int n){
switch(n){
case 1: //master control
cpanel = new JFrame("Cellular Explorer v0.1.0");
cpanel.getContentPane().add( Alice ); Alice.setVisible(true); Alice.setEnabled(true);
cpanel.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
cpanel.pack();
Ali... |
e7ae03eb-7c23-4a3d-ad8e-1c0069eea825 | 9 | public void addBooks(Set<StockBook> bookSet)
throws BookStoreException {
if (bookSet == null) {
throw new BookStoreException(BookStoreConstants.NULL_INPUT);
}
// Check if all are there
for (StockBook book : bookSet) {
int ISBN = book.getISBN();
String bookTitle = book.getTitle();
String bookAuth... |
e56bf925-470a-4bbb-ad10-91769c44de21 | 2 | public void addRoster (Roster roster) {
if (roster == null)
return;
if (rosters.contains(roster.getRosterID())) {
return;
}
rosters.add(roster.getRosterID());
} |
dc601119-f9ec-49b9-835f-8a7d3c60e386 | 0 | public File showOpenFileDialog(String title){
return OpenFileDialog.showOpenFileDialog(frame, title);
} |
3fd5066a-a59d-46b1-8993-0a6db343c8d2 | 0 | public ObjectFactory() {
} |
6455d75c-011e-4d06-8e8d-be68d2310b62 | 0 | private void main_apply() {
Preferences.applyTemporaryToCurrent();
Preferences.applyCurrentToApplication();
Preferences.saveConfigFile(Outliner.CONFIG_FILE);
Outliner.documents.redrawAllOpenDocuments();
} |
0ff4d8ce-529e-4003-b4e8-09b6b89c74da | 0 | public String getSuite() {
return suite;
} |
dd453600-a4c3-4f8e-aa97-acb86c09f3ad | 1 | public boolean isSitting() {
Layered layered = gob().getattr(Layered.class);
if (layered != null) {
return layered.containsLayerName("gfx/borka/body/sitting/");
}
return false;
} |
7b04b6c1-904a-4348-9c5b-f99af3a32eb2 | 4 | public void encode() {
Color[] colorArray = secretToColorArray();
int colorCounter = 0;
for (int yScroll = 0; yScroll < currentImg.getHeight(); yScroll += this.heightMod) {
for (int xScroll = 0; xScroll < currentImg.getWidth(); xScroll += this.widthMod) {
if (colorC... |
8702e61c-0d37-4704-8d2a-5f7c523a8fef | 8 | private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {
time = Calendar.getInstance();
timestamp = timeFormat.format(time.getTime());
//Create a message from user details and message text
message = new MessageObj(1, messageTextBox.getText(), timestamp, username);
... |
1cdca73a-1090-41e0-b6ab-205ac61d92e2 | 8 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String ca... |
c2756ead-7dc3-4581-88f9-3bc62de2bbf7 | 2 | public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (Exception ex) {
ex.printStackTrace();
}
CometEngine engine = CometContext.getInstance().getEngine();
engine.sendToAll(CHANNEL, Runtime.getRuntime().freeMemory() / 1024);
}
} |
8ce671a8-f8a8-458c-a322-88fd828cd6f9 | 7 | public String getRawResultOutput() {
StringBuffer result = new StringBuffer();
if (m_Classifier == null) {
return "<null> classifier";
}
result.append(toString());
result.append("Classifier model: \n"+m_Classifier.toString()+'\n');
// append the performance statistics
if (m_result !=... |
de08c886-29f2-48ca-8847-e2252ed1ba7e | 9 | public static IntSeq ApplyToAll2 (Main.AA2 fun, IntSeq v1, IntSeq v2)
{
IntSeqIt is1 = new IntSeqIt(v1); //iterator to find length of v1
IntSeqIt is2 = new IntSeqIt(v2); //iterator to find length of v2
int length1 = 0; //length of v1
int length2 = 0; //length of v2
int currentval1 = -1; //current ... |
189c0ae5-f3ab-45ff-9811-35f5269fe181 | 3 | public void cargarClientes(){
try{
Connection conn = Conexion.GetConnection();
try {
st = conn.createStatement();
cli = st.executeQuery("SELECT * FROM Clientes");
} catch (SQLException e) {
JOptionPane.showMessageDialog(this,e.g... |
72cf3162-fd20-49fd-8858-7d654d9fd396 | 1 | public void createDir(File file){
try{
file.mkdir();
}catch(Exception e){
System.out.println( "File creation failed!" + e );
}
} |
e5a0a1f9-2851-4792-8e8c-43fdfcdb60bb | 3 | void begin() {
while(true){
if(toDo.isEmpty() == true){
toDo.add(new DefaultState(as));
toDo.addAll(done);
//toDo.add(new DefaultState(as));
done.clear();
}
else{
toDo.peek().show();
Event event = toDo.poll();
//done.offer(event);
//use event to call next
Event e... |
cd54fd27-8442-4232-aefe-f90bc4c1e617 | 5 | public static void main(String[] args){
InputStream in;
try {
if (args.length > 0){
File f = new File(args[0]);
if (f.exists()){
if (f.canRead()){
in = new FileInputStream(f);
} else {
throw new IOException("Could not open " + args[0]);
}
} else {
throw new IOException... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.