method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cef2c0ce-67ec-475b-a0b7-92611530df78 | 2 | public LocalInfo getLocalInfo() {
if (shadow != null) {
while (shadow.shadow != null) {
shadow = shadow.shadow;
}
return shadow;
}
return this;
} |
52d85e49-62a3-4a81-bdff-116a8daf0ff0 | 0 | public MeasureKitInteger(DataStructures inData){
this.inData = inData;
outData = new DataArrays<Integer[]>();
} |
da53d121-5442-4cf4-b1bd-ab71ff82a796 | 3 | public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.shovel) {
if (player.payStamina(4 - tool.level)) {
level.setTile(xt, yt, Tile.dirt, 0);
return true;
}
}... |
0b171e1b-9daa-43bc-bc57-b13c70ea4333 | 4 | private void update(DocumentEvent e) {
try {
int value = Integer.valueOf(textField.getText());
if (value < 0 || value > 255) {
throw new NumberFormatException();
}
if (value != slider.getValue()) {
slider.setValue(value);
... |
018e8bcb-05b2-429e-ae78-f9bdf2d4987b | 6 | protected void addPossibleMovesInDirection(final List<Move> result,
final int fileStep, final int fileBorder, final int rankStep,
final int rankBorder) {
// Catch the condition for infinite loops.
// IMPROVE add additional sanity checking if necessary
if (fileStep == 0 &&... |
9c93222e-3e40-4265-bc94-a174c6df6d7e | 9 | private boolean parseDay() {
boolean parsingSuccessful = true;
d = new Day();
if(existing) {
d.setDayID(id);
}
try {
d.setDate(StrUtil.dateParser(dateF.getText()));
} catch (Exception ex) {
parsingSuccessful = false;
... |
213a25ec-8108-4099-914c-d47dfb5f948f | 4 | public void listWhispers(){
ChannelTree tmp;
Channel chan;
String str;
for(long id : channelManager.getTree().keySet()){
tmp = channelManager.getChannel(id);
if(tmp instanceof Channel){
str = "";
if(((Channel) tmp).isWhisper()){
chan = (Channel)tmp;
str += " " + id + " - " + chan.getName... |
7ea11735-57a8-493e-88a2-87f588612c42 | 7 | @Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
CompilationUnit compilationUnit = getCompilationUnit(description);
if(compilationUnit == null){
throw new KoanError("Failed to load Koan");
... |
cd1acb16-fa48-4123-8fcc-448dda1b79a6 | 9 | @Override
public void mouseMoved(MouseEvent e)
{
positionMouse = new Point2D.Float(e.getX() - offset, e.getY() - offset);
if (selectedObject != null)
{
DragDirection cursorDir = selectedObject.isInsideBorder(positionMouse);
if (cursorDir == DragDirection.EAST)
{
this.setCursor(Cursor.getPredefinedC... |
229e6240-04e4-429a-851c-a85c043629ca | 8 | public void getNeighbours(final ArrayList<Space> spaces, final Space center, final Criterion criterion) {
if(intersects(center)) {
if(!criterion.permitDiagonal) {
final float epsilon = 0.01f;
Rectangle i = intersection(center);
if(i.width < epsilon &... |
8bb8b22a-a581-41cd-8ec5-51c7faa63eb3 | 8 | public void run(){
try {
String response;
this.write("NEW " + user);
if(this.read().equals("OK")){
while (! isInterrupted()) {
this.write("INFO");
response = this.read();
... |
4654b272-6b36-4aad-b77c-8363d57dcf6d | 6 | private Vector<Utils.Identifier> getIdentifiers(Vector<Utils.Identifier> v1,
Vector<Utils.Identifier> v2) {
Vector<Utils.Identifier> res = new Vector<Utils.Identifier>();
if (v1.isEmpty()) {
for (Utils.Identifier iden : v2) {
Vector<Utils.Identifier> vect = new V... |
98d25259-20d1-4cea-92a9-8162ed1e49c0 | 0 | public void setGeometries(List<GeoJsonObject> geometries)
{
this.geometries = geometries;
} |
4dfc3689-e52d-4391-84f0-7eec8f040641 | 5 | protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) {
if (value != null) {
if (keyWord == BPKeyWords.UNIQUE_NAME) {
this.uniqueNameTf.setText((String) value);
} else if (keyWord == BPKeyWords.NAME) {
this.nameTf.setText((Strin... |
0df041e3-8b9b-4200-9648-6b9e787a95dd | 8 | public static boolean adjustOutputPath(File outputDir, Object comp, Logger log) {
boolean adjusted = false;
ComponentAccess cp = new ComponentAccess(comp);
for (Access in : cp.inputs()) {
String fieldName = in.getField().getName();
Class fieldType = in.getField().getType(... |
b476f22f-b529-4db2-ae9a-6daedfca9d21 | 3 | @Override
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof UniqueID) {
UniqueID other = (UniqueID) obj;
return mSubID == other.mSubID && mTimeStamp == other.mTimeStamp;
}
return false;
} |
770fc3c2-569e-4795-b09b-2e41071218dc | 1 | public void visit_ior(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
d11322f6-29ae-4e0c-9b14-505b45f290db | 3 | private void setBombs()
{
int x, y;
final Random random = new Random();
final Tiles tiles = mField.getTiles();
final byte bombId = tiles.getBomb().getId();
for (int i = 0; i < mBombs; i++ )
{
x = random.nextInt(mWidth);
y = random.nextInt(mHeight);
if (mField.getTileValue(x, y).isBomb()) i-- ;
... |
d439dbdc-8399-4959-9175-767f02433bd1 | 4 | private void addTypeAdaptersForDate(String datePattern, int dateStyle, int timeStyle,
List<TypeAdapterFactory> factories) {
DefaultDateTypeAdapter dateTypeAdapter;
if (datePattern != null && !"".equals(datePattern.trim())) {
dateTypeAdapter = new DefaultDateTypeAdapter(datePattern);
} else if (d... |
21092d96-9981-492e-9e7e-7bc574e7ed60 | 3 | @Override
public void removerIntNota(ItensNota intensNot) throws ClassNotFoundException, SQLException,Exception {
dados.removerIntNota(intensNot);
if(intensNot.getQtdComprada()<=0){
throw new ItensNotaException("Quantidade Comprada nao pode ser menor ou igual zero");
}
if(... |
1ab5bc19-a391-40a6-908a-cdd73b50638d | 2 | public static MessageQueue getInstance() {
if (uniqueInstance == null) {
synchronized (MessageQueue.class) {
if (uniqueInstance == null) {
uniqueInstance = new MessageQueue();
}
}
}
return uniqueInstance;
} |
e3e8f89c-ed78-4f81-aae4-a30e401614e4 | 1 | private void init(){
// Focus on the screen automatically
requestFocus();
BufferedImageLoader loader = new BufferedImageLoader();
try{
BufferedImage headers_image = loader.loadImage("/sprite_sheet_header.png");
header_ss = new SpriteSheet(headers_image);
b... |
3b70744b-d1a8-4f4a-bbf5-4a36ea3955eb | 8 | static final void method2181(long l, int i, int i_13_, int i_14_,
int i_15_, Widget class46, int i_16_,
int i_17_, aa var_aa) {
try {
anInt3686++;
int i_18_ = i_14_ * i_14_ + i_16_ * i_16_;
if (((long) i_18_ ^ 0xffffffffffffffffL)
>= (l ^ 0xffffffffffffffffL)) {
if (i_13_ > -49)
meth... |
60e13099-018f-4fa8-b18c-c158c35ee949 | 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... |
5546869f-f4ac-4ca7-a7a0-f21ca52f350a | 2 | public static void main(String[] args) {
MaxSubArray msa = new MaxSubArray();
int[] msa1 = { 2, 6, -5, 7, -9, -3 };
System.out.println(msa.maxSubArray(msa1));
System.out.println(msa.maxSubArray2(msa1));
System.out.println(msa.maxSubArray3(msa1));
BestTimeToBuyAndSell bttbas = new BestTimeToBuyAndSell();
... |
77ebb609-0e15-4cab-8ddf-3a7d670b50fb | 3 | @Override
protected Interactable.Result unhandledKeyboardEvent(Key key) {
if(getSelectedIndex() == -1)
return Interactable.Result.DO_NOTHING;
if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') {
checkedIndex = getSelectedIndex();
}
retur... |
c85fb7b4-e184-43c6-be55-2ff421d1040b | 6 | public boolean analyze(String str){
if(!stack.isEmpty()){
stack = new Stack(stackSize);
}
for (int i = 0; i < str.length(); i++){
if (str.charAt(i) == '('){
stack.push('(');
}
if (str.charAt(i) == ')')
{
... |
590f8514-c2b3-499b-befa-f82e26828fe1 | 9 | @Override
public Move[] getMoves(Location l, Peice[][] board) {
Location[] loc = new Location[8];
loc[0]= new Location(l.x-1,l.y-2);
loc[1]= new Location(l.x-2,l.y-1);
loc[2]= new Location(l.x+1,l.y-2);
loc[3]= new Location(l.x+2,l.y-1);
loc[4]= new Location(l.x-1,l.y+2);
loc[5]= new Location(l.x-2,l.y+1... |
72c9dbe2-ff02-4994-9df9-af5e2823204a | 4 | public int libraryUpdate(Network A, Molecule Asub, Molecule Bsub){
int index=-1;
int i = 0;
while (index==-1 && i<library.size()){
index = (A.equals(library.get(i))) ? i : -1;
i++;
}
if(index == -1){
library.add(A);
index = library.size()-1;
library.get(inde... |
0d886d2e-0809-4a00-89b9-7f3215ee1cef | 6 | public static void main(String[] args) {
Connection dbConnection = null;
try {
// Establish connection and display information about the database
System.out.println("Database Information\n-----------------------------");
dbConnection = ConnectionManager.getConnection();
ConnectionManager.displayDatab... |
9398ab49-2af7-48af-94d1-b99532eb5ab2 | 4 | @Override
public void keyPressed(KeyEvent e) {
//To change body of implemented methods use File | Settings | File Templates.
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
snake.setDirection(Direction.Up);
break;
case KeyEvent.VK_DOWN:
... |
8260a656-1bb6-4f27-9fff-b205d03ddc57 | 7 | public static void main(String[] args){
int a = -1;
int b = 1;
int c = 1;
int d = -1;
CyberusAI ai = new CyberusAI();
for(a = -1; a > -11; a --){
for(b = 1; b < 11; b++){
for(c = 1; c < 11; c++){
for(d = -1; d > -11; d--){
int average = 0;
for(int i = 0; i < 200; i ++){
... |
cf0ad9f6-bf7b-4ea2-82bd-02a0fb822d0f | 9 | public void UpdateGame(long gameTime, Point mousePosition)
{
// adds a new duck to a random position if, enough time has past between the last duck
if(System.nanoTime() - Duck.lastDuckTime >= Duck.timeBetweenDucks)
{
ducks.add(new Duck(Duck.duckLines[Duck.nextDuc... |
92edbec4-39e1-4b63-ab33-8a1f42fde522 | 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 Student)) {
return false;
}
Student other = (Student) object;
if ((this.id == null && other.id != null) || (thi... |
f7a13c30-6996-4edd-bd44-281842603bcd | 1 | public static String successOrFailure(boolean b) {
if (b)
return "Success";
return "Failure";
} |
e83fc5b5-aba6-420a-bb81-aa080b3ab0d0 | 4 | private final long ktol(final K key) {
long k;
if (key instanceof Long) k = (Long)key;
else if (key instanceof Number) k = ((Number)key).longValue();
else if (key instanceof String) k = new BigInteger(((String)key).getBytes()).longValue();
else {
ByteArrayOutputStream byteout = new ByteArrayOutputStream()... |
74426975-049f-4953-9c1a-bba645a1e76e | 3 | public static void main(String args[]) {
BitSet bits1 = new BitSet(16);
BitSet bits2 = new BitSet(16);
// set some bits
for(int i=0; i<16; i++) {
if((i%2) == 0) bits1.set(i);
if((i%5) != 0) bits2.set(i);
}
System.out.println("Initial pattern in bi... |
450c92fa-20fe-48be-affc-86402a018ab4 | 7 | @Override
protected Object doTaskImpl(TaskMonitor monitor, ObjectRepository repository) {
InstanceStream stream = (InstanceStream) getPreparedClassOption(this.streamOption);
Instances cache = new Instances(stream.getHeader(), 0);
monitor.setCurrentActivity("Caching instances...", -1.0);
... |
545e57bd-238c-4539-b671-32f463d9721a | 4 | @Override
public void actionPerformed(ActionEvent e) {
Object source=e.getSource();
while(((Case) source).getEstOccupe()){
this.actionPerformed(e); //genere erreur dans le console mais fonctionne
}
ArrayList<ArrayList<Case>> tabLignes = cartePan.getTabLignes();
Chevalier chev=cartePan... |
d1f53275-2e0a-48c4-b298-6e533288a858 | 5 | public static void main(String[] args){
Player pl = null;
try {
pl = Manager.createRealizedPlayer(new URL("file:///D:\\Muzyka\\05.Pray!.mp3"));
pl.getGainControl().setLevel(0.0f);
} catch (NoPlayerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotRealizeExcepti... |
27be188e-425a-4885-bf7a-802a52c13a46 | 6 | public void update(double dt, int x, int y, Input ip, Vector2 camPos) throws SlickException
{
level.Update(camPos);
if (inEditor)
{
if (level.UpdateEditor(new Vector2(x + camPos.X, y + camPos.Y), ip))
lightManager.init(level.getAllRooms());
}
player.HandleInput(ip, dt);
player.Update();
// ennem... |
1ccdb3cc-40e0-4b61-997e-81bc97436011 | 3 | private Boolean getConsoleNodeValue(final Document doc) {
Node outputsNode = this.getFirstLevelNodeByTag(doc, OUTPUTS_TAG);
if (outputsNode == null) {
return DEFAULT_CONSOLE;
}
Node consoleNode = this.getNodeByTagInNode(outputsNode, CONSOLE_TAG);
if (consoleNode == null) {
return DEFAULT_CONSOLE;
}
... |
8f013302-535b-41cd-9150-02ea7af22973 | 1 | public void poistaTiedote(Tiedote t) throws DAOPoikkeus {
try {
TiedoteDAO tDao = new TiedoteDAO();
// Kutsutaan daoluokan poistaTiedote-metodia
tDao.poistaTiedote(t.getTiedoteId());
} catch (DAOPoikkeus p) {
throw new DAOPoikkeus("Tietokannasta poistamin... |
f63852c6-fbce-46a0-8de8-eb8db9306973 | 7 | private void readPreferences(final BufferedReader reader) throws IOException, InvalidPreferencesFormatException {
final String kvPid = _application.getConnection().getLocalConfigurationAuthority().getPid();
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final BufferedWriter writ... |
a87dd99f-b90d-4f84-9647-a9cf3c9669ba | 1 | public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException ex) {
throw new IncompatibleClassChangeError(getClass().getName());
}
} |
2f3f2c24-6799-4fa6-9880-9e6bd6aa9057 | 2 | public synchronized static void writeStockValues(ArrayList<Stock> stocks) {
File f = new File("stocks.txt");
FileWriter fr = null;
try {
fr = new FileWriter(f);
BufferedWriter br = new BufferedWriter(fr);
String s = "";
for (Stock e : stocks) {
s += e.getTickername() + " " + e.getNo() + " " + e... |
b6b777c6-2c99-4dd2-a39e-1952dabd6e78 | 8 | private void inhibitAdjacentOtherShapeRecognizers(int shape,int otherShape){
//System.out.println(" inhibadgy " + shape);
int shapeOffset = 2500 * shape;
for (int neuron = 0; neuron < 2500; neuron += 5) {
int fromNeuron = neuron + shapeOffset;
int fromRow = neuron / 50;
if ((fromRow % 10) ... |
878b1f8d-256a-4d55-9dc8-e12568f2716a | 7 | private void gripperDragged(MouseEvent e) {
// where are we ?
@SuppressWarnings("unused")
Component gripper = e.getComponent();
ToolBarPanel panel = (ToolBarPanel) this.getParent();
if(! (panel.getParent() instanceof ToolBarContainer)) { //2006/12/01
// this is a safety for users willing to include toolbar... |
d192ff05-be32-416c-83d5-5803f64c9154 | 1 | public void setFrontLeftTrim(int frontLeftTrim) {
this.frontLeftTrim = frontLeftTrim;
if ( ccDialog != null ) {
ccDialog.getTrim1().setText( Integer.toString(frontLeftTrim) );
}
} |
fe5499e7-f4a4-4404-8f0d-c84fce17fbeb | 1 | private static void extractGrid(String recurso, File destino) throws IOException {
if (destino.exists()){
return;
}
InputStream inputStream = Config.class.getClassLoader().getResourceAsStream("cat2osm/grids/"+recurso);
OutputStream outputStream = new FileOutputStream(destino);
IOUtils.copy(inputStream, out... |
8392c625-d99d-43dd-9119-80d9222fe381 | 5 | public static boolean userOK(String input)
{
/*
* Funktion som kollar om nickname som är angivet är ok.
* Null, Server eller något som redan finns är dåligt.
*/
boolean svar = false;
for(int i = 0; i < Main.users.size(); i++)
{
if(input.equalsIgnoreCase(Main.users.get(i).getNickname()) || input.equ... |
f69e7bda-ff81-48d6-ae3b-95bbd405c1b2 | 3 | public Map<Point, List<Point>> cluster() {
// 随即选取k个点作为中心点
List<Point> keys = Random.choice(points, k);
while (true) {
// 根据中心点对属性点聚类
clusters = clusterPoints(keys);
// 根据聚类结果计算中心点
ArrayList<Point> tmpKeys = new ArrayList<Point>();
for... |
27de6ccb-6d9e-47bc-8c05-f2115232c322 | 1 | private void copyToClipboard(String selectString){
if (selectString != null){
StringSelection stringSelection = new StringSelection (selectString);
Clipboard clipboard = Toolkit.getDefaultToolkit ().getSystemClipboard ();
clipboard.setContents (stringSelection, null);
... |
a589d128-03a3-4509-945c-a49f9305b169 | 1 | private void print(Employee[] e) {
for (int i = 0; i < e.length; i++)
System.out.println(e[i].surName + "," + e[i].givenName);
} |
0200f232-e73e-4e27-9503-349545639c76 | 9 | private void set(String type, int id_tank, int id) throws Exception{
int tankTypeID = garage.getTankID(id_tank);
if(type == null){
close();
}else if(type.equals("$armor$")){
if(tankTypeID == dataBaseConnector.getTankIDForArmor(id)){
... |
6e80d939-a916-4431-beac-ae5e240b1eef | 5 | @Override
public void run() {
options.status = "Open bank";
for (Item item : ctx.equipment.select().id(Banking.ALWAYS_DEPOSIT)) {
if (ctx.backpack.isFull()) {
break;
}
ctx.equipment.unequip(item.id());
}
if (!ctx.bank.open()) {
final Locatable nearest = ctx.bank.nearest();
if (nearest inst... |
1efde10f-3453-4266-a249-714ff5d77a4e | 0 | protected NoDiscountStrategy(double price, int copies) {
super(price, copies);
} |
9846920a-0ad1-498b-adf4-06cd7edcf5b7 | 6 | private EnumSoundLoadError getALErrorAsErrorEnum(int err)
{
switch (err)
{
case AL_NO_ERROR:
return EnumSoundLoadError.ERROR_NULL;
case AL_INVALID_NAME:
return EnumSoundLoadError.ERROR_INVALID_NAME;
case AL_INVALID_ENUM:
... |
7c2a10f8-4104-403c-8303-15412d1d9832 | 0 | public String getExportEncoding() {
return (String) exportEncodingComboBox.getSelectedItem();
} |
4fc8e28d-3380-46b5-8b1d-e7b10ccde310 | 2 | public static void main(String[ ] args)
{
String[ ][ ] animals = {
{ "DanaDog", "WallyDog", "JessieDog", "AlexisDog", "LuckyDog" },
{ "BibsCat", "DoodleCat", "MillieCat", "SimonCat" },
{ "ElyFish", "CloieFish", "GoldieFi... |
16042403-a8b6-4a00-a12f-e5002ef7c322 | 8 | public boolean looseEquals(Object keyObj) {
boolean isEqual = false;
if (key != null) {
// Checks a compound key (ObjectKey[] or String[]
// based) with the delimited String created by the
// toString() method. Slightly expensive, but should be less
// than parsing the String into its... |
2d03b7ac-15f2-4dd9-b3bb-f59444ba5d9a | 7 | public static List<Presente> corte(List<Presente> p1, List<Presente> p2, int posCorteInicial, int posCorteFinal, int tamanho) {
System.out.println("----");
System.out.println(posCorteInicial + " " + posCorteFinal);
imprimirPresentes(new Cromossomo(p1));
imprimirPresentes(new Cromossomo(p... |
7de0cfce-1cfc-4261-8dc2-9e4829d8b343 | 7 | @Override
public void update(int delta) {
if (!active) {
return;
}
// calculate x
x = entity.getX() - (Globals.APP_WIDTH / 2);
if (x < 0) {
x = 0;
}
if (x >= Engine.getMap().getWidth() - Globals.APP_WIDTH) {
x = Engine.getMap().getWidth() - Globals.APP_WIDTH;
}
// calculate y
y = entity.... |
9cfef7a9-4db0-4cf6-983b-884fbdb24a7b | 1 | public static int getCopies(PrintService service, PrintRequestAttributeSet set) {
Copies copies = (Copies) PrintUtilities.getSetting(service, set, Copies.class, false);
return copies == null ? 1 : copies.getValue();
} |
e5221525-3278-48eb-97a2-444f51d051bc | 6 | public static char nine(int r, int c, int f) {
if (s1(r, c, f) || s4(r, c, f) || s5(r, c, f))
return '|';
else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f))
return '_';
return '.';
} |
893256d1-b237-4645-96b3-82d6afd94566 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
{
final String str=CMParms.combine(commands,0).toUpperCase();
if(str.equals("MONEY")... |
7fd0e699-0772-4107-9a15-b913893a24b9 | 0 | public void setItemId(int itemId) {
this.itemId = itemId;
} |
18f22207-5e42-41db-bc2c-117cd41d57cc | 2 | public static String dump(Object comp) throws Exception {
StringBuilder b = new StringBuilder();
b.append("//" + comp.toString() + ":\n");
b.append("// In\n");
ComponentAccess cp = new ComponentAccess(comp);
for (Access in : cp.inputs()) {
String name = in.getField().... |
4dd013ee-57b2-46a1-9e84-6b79a3df14f3 | 2 | public static Res combine (Res l, Res r, char op) {
int total = ( l.cTrue + l.cFalse ) * (r.cTrue + r.cFalse);
int t = 0;
int f = 0;
if ( op == '^' ){
t = l.cFalse * r.cTrue + l.cTrue * r.cFalse;
f = total - t;
} else if ( op == '&' ) {
t = l.cTrue * r.cTrue;
f = total - t;
... |
73889f84-fb3e-429f-a388-cdbba27752f4 | 4 | private Task getResponse(HttpURLConnection connection) throws Exception {
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
InputStream inputStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inputStream));
return new Task(... |
b718978e-f971-4727-b095-399b5e11b695 | 2 | public static boolean containsAtLeastOneNonBlank(List<String> list){
for(String str : list){
if(StringUtils.isNotBlank(str)){
return true;
}
}
return false;
} |
0bb38944-0f1e-4094-9a38-5055702c92e5 | 1 | public static void main(String[] args) {
String s2 = "Akroma, Angel of Wrath";
System.out.println(s2.replaceAll("[',]", ""));
String s = "2 Pack Rat [RTR] ";
Matcher m = linePattern.matcher(s);
System.out.println(m.matches());
System.out.println(Integer.parseInt(m.group(1)));
for(int i = 0; i < 4; i++)... |
72b09c95-08e0-41f2-be94-0bb0a284c638 | 1 | public void mapRender(int scale, int xOff, int yOff){
if(texture == null) texture = tile.getTexture();
texture.bind(); // or GL11.glBind(texture.getTextureID());
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2f(x/scale + Game.PLAYER.getCameraX() + xOff, y/scale + Game.PLAYER.getCameraY... |
8d4a3d72-199e-4350-a7f4-c99637819489 | 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... |
9cde27de-6790-4654-bea2-87f0ec0e3165 | 0 | public void setAsset_id(String asset_id) {
this.asset_id = asset_id;
} |
07e90e21-d6ec-45c0-95ab-c755ca95f315 | 1 | void lisaaKentalle(List<Palikka> palikat) {
for (int i = 0; i < palikat.size(); i++) {
this.pelipalikat[palikat.get(i).getY()][palikat.get(i).getX()] = palikat.get(i);
}
} |
95cf48e8-8bd2-4604-b318-b760d8618021 | 4 | public List<String> query(String st) {
List<String> returnList = new ArrayList<>();
//System.out.println("SQL: "+st);
try {
PreparedStatement statement = conn.prepareStatement(st);
ResultSet rs = statement.executeQuery();
if (rs == null) {
... |
a824da64-8373-4ef0-b7ba-c4cc61fb5be5 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idHospital != null ? idHospital.hashCode() : 0);
return hash;
} |
9c35706e-8d1e-4ecd-ae35-52e379f66ffd | 1 | @Override
public void render() {
for (int i = 0; i < pixels.length; i++) {
pixels[i] = i + ticks;
}
renderSprite(Assets.GRASS, x, y, 0, false);
} |
9905166e-c466-4b33-9306-5692fcf522df | 5 | private static boolean[] primeBoolArray(int limit) {
boolean[] nums = new boolean[limit];
for (int i = 2; i < nums.length; i++)
nums[i] = true;
int nextPrime = 2;
while (nextPrime < nums.length / 2) {
int i = nextPrime;
for (; i < nums.length; i += nextPrime)
nums[i] = false;
nums[nextPrime] = t... |
2973c4db-1c1e-43aa-9db7-3dea9e1b941a | 9 | protected String getRequirementsDescription(String values)
{
if(values==null)
return "";
if(values.equalsIgnoreCase("integer")||values.equalsIgnoreCase("int"))
return " as an integer or integer expression";
else
if(values.equalsIgnoreCase("double")||values.equalsIgnoreCase("#")||values.equalsIgnoreCase("... |
30478e07-44b7-46d3-ac06-01b15f17881e | 4 | public void SetLampColorAndMessage(String s, int c)
{
switch( c )
{
case 0:
IluminationColor = Color.black;
break;
case 1:
IluminationColor = Color.green;
break;
case 2:
IluminationColor = Color.yellow;
break;
case 3:
IluminationColor = Color.red;
break;
} // switc... |
0b0785e7-5714-4ed9-b210-f168db80fd3d | 5 | public IVPBoolean greaterThan(IVPNumber num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){
... |
63e7380b-1f82-4584-8d40-0409ed14759b | 1 | public void generateInitialPopulation(int size){
population = new String[size][];
prevPopulation = new String[size][];
fitness = new Double[size];
for(int i = 0; i < size; i++){
population[i] = this.generateDeck("random");
fitness[i] = 0.0;
}
} |
c6b23f13-bb7b-4af0-9e82-720014ce7ab1 | 1 | public static Property getPropertyByName(String name) {
Property p=null;
try {
p=MediaProperty.valueOf(name);
} catch (IllegalArgumentException e) {
p=extendedProperties.get(name.toUpperCase());
}
return p;
} |
ad0148d3-229c-4da1-8c10-5369f660fd1c | 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 fe... |
a20e3a0f-7020-4bb2-8b2d-b96194647893 | 8 | public void addView(AbstractView view) {
if ("CONNECTION".equals(view.getType())){
this.getContentPane().add(view.getPanel());
} else {
this.getContentPane().add(contentPanel);
String type = view.getType();
if (type.equals("WEST")) {
conten... |
f7d45020-b533-45d8-943e-744c53f2d4cb | 7 | protected void randomizeFolders(String romId, ByteStream rom,
ChipLibrary library) {
// Randomize Folder
ItemProducer chipProducer
= new BN456RewardProducer(library);
FolderProducer producer
= new FolderProducer(chipProducer);
FolderProvider provider
= new FolderProvider(this, producer);
Pointe... |
7869bb5c-8931-42f4-881b-c741849ea0da | 0 | public void addText(String text)
{
combatLog = combatLog + "\n" + text;
updateLog(combatLog);
} |
d9bfe41b-a551-4ac1-ab55-0b556d5bbacf | 8 | private static void buildTimelineBackward(List<SmaliBlock> blockList, SmaliMethod method) {
//TODO: implement backward timeline scanning
SmaliBlock block = null;
RegisterTimeline timeline = null;
List<SmaliBlock> sortedList = new LinkedList<SmaliBlock>();
List<SmaliBlock> tmpList = new LinkedList<SmaliBloc... |
3a7e4b6b-48a3-4032-aafc-3fdd94a61f4f | 2 | public static void main(String[] args){
while(true){
AvgCyberusAI tetris = new AvgCyberusAIHelper();
tetris.startGame();
while(tetris.tc.gameOn){
System.out.print("");
}
}
} |
d273004f-56d7-41ba-9fc4-033d6a6940cc | 8 | public static ArrayList<Student> loadStu() {
ArrayList<Student> list = new ArrayList<>();
Student stu = new Student();
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader("d:/object.txt");
br = new BufferedReader(fr);
int ch = 0;
String tmp = "";
while (true) {
while (... |
bfc6e021-2bcb-46d5-8f18-e5fa31756a65 | 1 | public List<Aplicacion> ObtenerAplicacion(String consulta){
List<Aplicacion> lista=new ArrayList<Aplicacion>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
a952e9d2-3325-40ef-a35f-b8f9b09755f3 | 4 | public int readInt() {
int ch1 = readByte();
int ch2 = readByte();
int ch3 = readByte();
int ch4 = readByte();
if(ch1 < 0)
ch1 = BYTE_MAX + ch1;
if(ch2 < 0)
ch2 = BYTE_MAX + ch2;
if(ch3 < 0)
ch3 = BYTE_MAX + ch3;
if(ch4 < 0)
ch4 = BYTE_MAX + ch4;
//position += INT_SIZE;
return ((c... |
c34483d8-0df9-4eeb-8804-8f0c39c9f333 | 9 | public Move promoteSelf(boolean color) {
Move m = null;
for (Entry<Point, ChessSquare> e : potentialMoves.entrySet()) {
if (e.getKey().getY() == 0 && color) {
for (Entry<Point, Piece> f : e.getValue().getInbound(color).entrySet()) {
if (f.getValue().toString().equals("WP")) {
m = new Move(f.ge... |
8f227f82-e0ab-419c-bca1-bb2eb75a5cfb | 2 | public int getCharTextureID(char c) {
if (c < FIRST_STANDARD_CHAR || c > FIRST_STANDARD_CHAR + NUM_STANDARD_CHARS) {
System.out.println("Unsupported character: " + c + " (\\u" + Integer.toHexString(c) + ")");
return -1;
}
return TextureManager.getTextureID(name + "." + c)... |
915bae07-6630-47c1-a65b-07d5d692e264 | 2 | public static void loadAllAchievements() {
String statement = new String("SELECT * FROM " + DBTable + " WHERE type = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, QUIZ_CREATED_TYPE);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
Qu... |
8e0824ae-bc0b-49bb-ba18-e678da1f6fa3 | 9 | public Nutzer setUser(String name, String password, String password_repeat) throws Exception {
if (password == null || password.equals(""))
throw new PasswordEmptyException("Bitte ein Passwort eingeben");
if (password_repeat == null || password_repeat.equals(""))
... |
6009efa1-b54d-4401-a362-10f6b3dafde3 | 6 | public boolean ajouterSignalisation(Signalisation s) {
if (s instanceof Feu && this.getNbFeu() <= NOMBRE_MAX_FEUX) {
return signalisations.add(s);
} else if (s instanceof PanneauCedezLePassage && this.getNbCedezLePassage() <= NOMBRE_MAX_CEDEZLEPASSAGE) {
return signalisations.add... |
b25d7d27-f8fd-4a79-9dcc-0c2a897fc78f | 1 | private boolean newEntry()
{
try {
rs.moveToInsertRow();
return true;
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.