method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
be5be504-1e99-4f99-8179-9e9004b8f7d8 | 3 | @BeforeClass
public static void setUpBeforeClass() {
try {
String localTestProperty = System
.getProperty(BookStoreConstants.PROPERTY_KEY_LOCAL_TEST);
localTest = (localTestProperty != null) ? Boolean
.parseBoolean(localTestProperty) : localTest;
if (localTest) {
CertainBookStore store = new C... |
4f026116-9208-4376-a78f-71bb301ed70e | 1 | public Medicine findMedicine(int id) {
String query = "SELECT * FROM `medicine` WHERE `id` = %d LIMIT 1;";
Utils.DBA dba = Helper.getDBA();
Medicine m = new Medicine();
try {
ResultSet rs = dba.executeQuery(String.format(query, id));
rs.next();
m.setID... |
e322752f-a920-4963-b480-15096faf28a9 | 8 | public static long convertUnitToOrigByte(String unitByte) {
if (isEmpty(unitByte)) return 0;
unitByte = unitByte.toUpperCase();
// , 제거
unitByte = unitByte.replace(",", "");
String regx = "^\\p{Digit}+(K|KB|M|MB|G|GB)?$";
if (!unitByte.matches(regx)) return 0;
long origByte = parseLong(stra... |
6d66e224-a008-4e5a-ba61-1bcb52e563bb | 6 | public boolean func_48647_a(PathEntity par1PathEntity)
{
if (par1PathEntity == null)
{
return false;
}
else if (par1PathEntity.points.length != this.points.length)
{
return false;
}
else
{
for (int var2 = 0; var2 < t... |
216e3856-6c41-4a57-aced-b814c3264bfb | 9 | private void register() {
if (brokerUrl == null
|| registryId == null
|| (System.currentTimeMillis() - lastRegistered > 10 * 1000)) {
Response response = null;
if(getType().equals("producer")){
response = Announce.callAsProducer(getLocation());
} else {
response = Announce.callAsConsumer(regi... |
15aa56b9-5820-4160-92cb-cd32b8515ba5 | 7 | @Override
public void mouseMoved(MouseEvent event) {
if (isEnabled()) {
Row rollRow = null;
try {
boolean local = event.getSource() == this;
int x = event.getX();
int y = event.getY();
Row rowHit;
Column column;
Cursor cursor = Cursor.getDefaultCursor();
if (overColumnDivider(x) !... |
d795cba3-bff1-4ff4-b9fa-02076aec5894 | 6 | public void setType(Type otherType) {
Type newType = otherType.intersection(type);
if (type.equals(newType))
return;
if (newType == Type.tError && otherType != Type.tError) {
GlobalOptions.err.println("setType: Type error in " + this
+ ": merging " + type + " and " + otherType);
if (parent != null)
... |
dae877fc-395d-4efb-9191-a7d746e88b2c | 8 | public void changeCellType(int x, int y, CellType selectedMode, boolean delete) {
Cell cell = getCell(x, y);
switch (selectedMode) {
case FOOD:
if (cell.getType().equals(CellType.FOOD)) {
cell.setType(CellType.SPACE);
} else {
cell.setType(CellType.FOOD);
}
break;
case ANTHILL:
C... |
d83febb0-fcc4-45b8-a5a6-bf46993da553 | 1 | private void sendData( String message )
{
try // send object to server
{
output.writeObject( "CLIENT>>> " + message );
output.flush(); // flush data to output
System.out.println( "\nCLIENT>>> " + message );
} // end try
catch ( IOException ioException )
{
... |
c3649d19-edd7-4b21-b8e8-921e5aa8aa2e | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector3f vector3f = (Vector3f) o;
if (Float.compare(vector3f.x, x) != 0) return false;
if (Float.compare(vector3f.y, y) != 0) return false;
... |
8972529c-a792-42be-8145-448675d7af2a | 9 | Pakkit(Plugin plugin) {
this.plugin = plugin;
final String serverPackage = this.plugin.getServer().getClass().getPackage().getName();
final String version = serverPackage.substring(serverPackage.lastIndexOf('.') + 1);
try {
this.craftPlayer = Class.forName(serverPackage + ".e... |
f14f2e55-59b5-4766-bdcf-9c1161bbd7dd | 9 | * @param output
*/
public static void translateLoomFile(String input, String output) {
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
Object old$PrintprettyP$000 = Stella.$PRINTPRETTYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
Native.s... |
6957af31-cec1-49c9-9831-ee430f86bdec | 6 | public void UpdateLevelConditions() {
if (TimeMet() && TimePrimary) {
if (RequiredMet()) {
gameCondition = 2;
}
gameCondition = 3;
return;
} else if (RequiredMet()) {
gameCondition = 2;
} else if (p.health < 0) {
gameCondition = 3;
} else if (AnySecondaryMet()) {
gameCondition = 2;
} ... |
2fcfe6f3-5de5-47fa-b27f-9086e24da90d | 5 | public void loadFromFile(File f) {
try {
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(f));
Osoba osoba = null;
while((osoba = (Osoba) inputStream.readObject()) != null){
data.addElement(osoba);
}
inputStream.close();
fireTableDataChanged();
} catch (FileNotFoundExc... |
cfc1d15f-1c9e-415a-b7bc-8ffa82cb8d78 | 4 | public static void writeAverageMetrics(String outputFile, int k, double size, boolean calcTags, boolean endLine) {
try {
FileWriter writer = new FileWriter(new File("./data/metrics/" + outputFile + "_avg.txt"), true);
BufferedWriter bw = new BufferedWriter(writer);
double recall = recallSum / size;
double... |
6964b676-5234-4d37-a738-ee356c8fcb2a | 3 | public FillFrame(DataStore DS) {
this.ds = DS;
this.setBounds(100, 100, 450, 300);
this.pane = new JPanel();
this.setContentPane(pane);
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
JLabel lblTraitementDesErreurs = new JLabel("Traitement des erreurs :");
lblTraitementDesErreurs.setAlignment... |
38291446-3a3e-43a4-91fb-590953e89ca6 | 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... |
8d8c081c-78ab-4daf-bc20-3e83b3059e19 | 1 | public RowUndoSnapshot(Row row) {
mParent = row.getParent();
mOpen = row.isOpen();
mChildren = row.canHaveChildren() ? new ArrayList<>(row.getChildren()) : null;
} |
c472a8d4-8c93-4903-9e03-aa54f53aa682 | 2 | public Boolean dropGraph(String graphURI) {
this.dropGraphs.add(graphURI);
if(this.autoCommit){
//TODO ändern!!!
this.beginTransaction();
Boolean ret = this.commit();
this.endTransaction();
if(ret){
this.dropGraphs.clear();
}
return ret;
}
return null;
} |
08e34ab8-55d4-49f4-b90f-749556e2fccf | 5 | public static int[][] loadColors(String filename) throws FileNotFoundException{
int[][] colors = new int[COLORDEPTH][3];
if (filename.equals("")){
return null;
}
File colorFile = new File("src" + File.separator + "mnd" + File.separator + filename);
if(!colorFile.exists()){
System.out.print("I... |
7b914e1e-9ac7-407c-83ed-68f7740791c8 | 0 | public VuePraticiens(CtrlAbstrait ctrlA) {
super(ctrlA);
initComponents();
} |
75c81f8b-8ed8-4bae-9b18-49eac7d955de | 0 | public void setB(float b) {
this.b = b;
} |
6ebffe92-6d92-471b-8fcf-cd87aecec044 | 5 | public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
if(subMenu){
if(menuSelect==0)
if(newFileMenu)
if(l.mouseSelect(244, 170, 152, 28))
if(Mouse.isButtonDown(0))
sbg.enterState(1);
}
gc.setFullscreen(Main.fullScreen);
AppGameContainer appgc = (App... |
28e6a074-4835-4ca1-976c-592b8d08bc15 | 1 | public Object get(int index) throws JSONException {
Object object = this.opt(index);
if (object == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return object;
} |
e9466ecc-61db-42ce-af7f-a09e6b881712 | 8 | private ExtendedModInfo examinePathForMod(IDirectory dir) {
String path = dir.getPath();
String modMainFile = findModMainClassFilePath(dir);
if(modMainFile == null) {
return null;
}
if(!dir.exists(modMainFile.replace('.', '/'))) {
log.err("Directory[" + dir.getPath() + "] does not contain ... |
8c2ba62d-bfb5-4c63-94a1-0147666c0a3d | 0 | private Padding10() {
} |
39e968ca-d88f-4f3d-b864-f746186a8ce4 | 1 | private static JComponent[] copy(JComponent[] c) {
JComponent[] newArray = new JComponent[c.length];
for (int a = 0; a < c.length; a++) {
newArray[a] = c[a];
}
return newArray;
} |
a2ffc484-1656-4245-9146-4264161c61c6 | 2 | public void run() {
setSizeField();
array = new ButtonArray(field.sizeField);
setBounds(500, 300, 500, 500);
this.setLayout(new GridLayout(field.sizeField, field.sizeField, 5, 5));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
field.initField();
Check check = ne... |
ca9ce233-22c9-450d-a6db-0bc621198f9d | 7 | public boolean getBoolean(String key) throws JSONException {
Object o = get(key);
if(o==null) return false;
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String)o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Bool... |
27d7f1bc-9d2b-4948-a4f0-de15b09c6ed2 | 1 | public void visitTryCatchBlock(
final Label start,
final Label end,
final Label handler,
final String type)
{
buf.setLength(0);
buf.append(tab2).append("TRYCATCHBLOCK ");
appendLabel(start);
buf.append(' ');
appendLabel(end);
buf.append... |
7a65356f-1dea-4d41-8255-f17124610f97 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
4807f1a9-440a-4a57-8f31-ef36b337d6e0 | 9 | public int search(char[] word) {
int i, j, k;
ST_NODE tmpnode = new ST_NODE();
ST_NODE rnode = null;
int child;
byte cs;
for (i = 0, j = 0; j < word.length && i < this.search_end; i++) {
if (word[j] == this.search_word[i])
j++;
else break;
}
this.search_end = i;
if (this.search_end == 0 ) ... |
aaa20aee-9857-4fbc-ae35-8939f38344bc | 2 | public static long arrayPositiveElementsSum(long[]array){
long sum = 0L;
for(long i:array)if(i>0)sum += i;
return sum;
} |
82069c5c-983e-477a-8f76-d8376e5a4cac | 3 | @SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
long lall = 0, tall = 0;
int[] efforts = {1, 50, 100};
for(int effort : efforts) {
for(File f : new File("resources/testdata/").listFiles()) {
RandomAccessFile raf = new RandomAccessFile(f, "r");
byte[] data = n... |
921dbac2-2cdb-40ac-bead-be8e708dda76 | 8 | public int CheckSmithing(int ItemID, int ItemSlot) {
boolean GoFalse = false;
int Type = -1;
if (IsItemInBag(2347) == false) {
sendMessage("You need a "+GetItemName(2347)+" to hammer bars.");
return -1;
}
switch (ItemID) {
case 2349: //Bronze Bar
Type = 1;
break;
case 2351: //Iron Bar
... |
391bf076-7bec-4784-8dd3-a53338c18c38 | 8 | private void unfilterPaeth(byte[] curLine, byte[] prevLine) {
final int bpp = this.bytesPerPixel;
int i;
for(i=1 ; i<=bpp ; ++i) {
curLine[i] += prevLine[i];
}
for(int n=curLine.length ; i<n ; ++i) {
int a = curLine[i - bpp] & 255;
int... |
509d002b-a1f0-471f-8119-e8d76ac6a1f1 | 1 | private SceneObject getAt(final Tile tile) {
final SceneObject[] locations = SceneEntities.getLoaded(tile);
return locations.length > 0 ? locations[0] : null;
} |
f3e12330-5da7-4e57-98a0-a1519d323881 | 3 | public static void main(String[] args){
int[] dimension = {30,1,40,10,25};
// method 1
int min = CMMNo(dimension);
System.out.println(min);
// method 2
int[][] array = new int[dimension.length-1][dimension.length-1];
String[][] sequence = new String[dimension.length-1][dimension.length-1];
for(int i =... |
4af74b79-3442-482d-b762-b008d2fd0597 | 6 | public void update(Avatar player, Map map, long gameTime) {
if (!isOutOfScreen) {
if (!canFall) {
Rectangle2D rectplayer = new Rectangle2D.Float(player.getX(),
player.getY(), 18, 18);
Rectangle2D thisrect = new Rectangle2D.Float(x - 1, y - 1, 19,
19);
if (rectplayer.intersects(thisrect)) {
... |
8d6a444c-5b8d-407f-93a4-e9cea9e5fdd7 | 5 | public static boolean withinRange(int objectType, int objectX, int objectY, int playerX, int playerY, int atHeight)
{
if(objectSizes.size() == 0)
loadObjectSizes();
int sizeX = 1;
int sizeY = 1;
if(objectSizes.get(objectType) != null)
{
sizeX = objectSizes.get(objectType)[0];
sizeY = objectSizes.get... |
4dfdd04c-fbab-495d-83e9-c56bfd17f6e0 | 4 | public void run() {
// signal that this thread has started
threadStarted();
while (!isInterrupted()) {
// get a task to run
Runnable task = null;
try {
task = getTask();
}
catch (Int... |
335849a1-cc60-4fc5-a64e-6ccb68ff5cb4 | 9 | private static void modRest(int decisio){
int opcio = 0;
while( opcio != 7 ) {
opcio = 0;
if(decisio == 1)System.out.println(" Indica el tipus de restriccio a modificar ");
if(decisio == 2)System.out.println(" Indica el tipus de restriccio a esborrar ");
Sy... |
b7c72e47-d8f7-4a3b-ad5c-7d52ac60c0f0 | 2 | public void onUserLogout(NetworkSharedUser user) {
if(thisUser == null) return;
if(privateChats.get(user.getId()) != null) {
privateChats.get(user.getId()).userDisconnected(user.getName());
}
globalChat.addText(user.getName() + " has logged out.");
model.removeElement(user.getName());
} |
a951ba19-c93a-4ee9-a8b6-05923ca5311f | 7 | private void doWalk(Ant ant) {
//set reachable and shuffle it
ACOUtil.changeReachable(reachable, 0);
ACOUtil.shuffleArray(reachable, rand);
ant.setWorkUnitIndex(0, reachable[0]);
for (int step = 1; step < indexes.length; step++) {
//1]
int previousIndex = ant.getWorkUnitIndex(step-1);
//2] comput... |
19f0a5e7-2bbe-46b6-8d54-f2eb5b7bd5d6 | 9 | protected static boolean isWrapperClass(String name) {
return name.equals("java.lang.Integer")
|| name.equals("java.lang.Long")
|| name.equals("java.lang.Short")
|| name.equals("java.math.BigInteger")
|| name.equals("java.math.BigDecimal")
|| name.equals("java.lang.Float")
|| name.equals("java... |
4bb08f78-ce49-47f9-b8e8-40e1d98ea2fe | 9 | public void update(){
if(speedX <0){
centerX += speedX;
}
if(speedX ==0 || speedX < 0){
bg1.setSpeedX(0);
bg2.setSpeedX(0);
}
if(centerX<=200 && speedX > 0){
centerX += speedX;
}//end scrolling else
if(centerY + speedY >=GROUND){
centerY = GROUND;
}
if(jumped==true){
speedY+=1;
if(centerY+sp... |
78f313df-0d27-48b4-9565-bfbd2d5473a8 | 9 | protected void paintComponent(Graphics g) {
if (isOpaque()) {
Dimension size = getSize();
g.setColor(getBackground());
g.fillRect(0, 0, size.width, size.height);
}
int stepSize = 0;
int cDist = 0;
int rDist = 0;
for (int vectorIndex =... |
9084d5a4-57ff-4b92-929f-f417c515c064 | 4 | protected int sync_header(byte [] stream){
int offset = 0;
for(; offset < stream.length; offset++)
if(stream[offset] == -1 &&
((stream[offset+1] & 0xf0) >>> 4)
== 0xf && (stream[offset+1]&0xf ) != 0xf)
break;
return of... |
5e8394db-56cd-4aed-b9f3-1902a15bd7f9 | 7 | public static String loadFile(String filePath)
{
String result = "";
FileInputStream inputStream = null;
DataInputStream dataInputStream = null;
StringBuilder stringBuilder = new StringBuilder();
String charset = "";
try
{
inputStream = new FileInputStream(filePath);
String line = "";
byte[] arr... |
4b7a5500-b6de-48ba-a549-d21f86b35c28 | 8 | public int findFreeNumSmallMemory(File file, final int blocksCount, final int blockSize) throws IOException {
final int vector_item_size = 32; //because we use int
int freeBlock;
if ((freeBlock = findFreeBlock(file, blocksCount, blockSize)) != -1) {
//find free num in block: read from file
int... |
6abd61be-509e-44b0-a2d5-be820f5ab147 | 5 | public boolean removeVertex(final City city) {
int index = getIndex(city);
if (index < 0) {
return false;
} else {
cities[index] = null;
}
for (int i = 0; i < edges.length; i++) {
if (i == index) {
edges[index] = new int[edges[i... |
4871538a-af9d-4592-886b-d7bb52175330 | 4 | private static boolean isLocalMax(double[] frequencyData, int i) {
if (i - 1 < 0 || i + 1 >= frequencyData.length)
return false;
double left = frequencyData[i - 1];
double mid = frequencyData[i];
double right = frequencyData[i + 1];
if (right < mid && mid > left)
return true;
return false;
} |
1fd3a31f-37cd-4fee-92ee-a2929c224509 | 5 | private Color getPColor(Player p){
if(p instanceof White ){
return Color.WHITE;
}
else if(p instanceof Green){
return Color.GREEN;
}
else if(p instanceof Peacock){
return Color.BLUE;
}
else if(p instanceof Plum){
return Color.pink;
}
else if(p instanceof Scarlett){
return Color.RED;
}... |
fbe9dad4-58db-4ffe-acf0-ac717ce0b3d7 | 4 | private void fillHighScore(){
scores = Database.DatabaseInstance.fillTopScores(singlePlayer);
for(ScoreUser score : scores){
usernameLabel = new JLabel(score.getUserName());
usernameLabel.setForeground(Color.white);
toReturnPanel.add(usernameLabel);
scoreLabel... |
dfa42163-c4e9-415d-b451-0f792ad0b535 | 0 | public void setActivityType(ActivityTypes activityType) {
this.activityType = activityType;
} |
0bdfeac8-8381-4cae-8e59-dfa038942e25 | 0 | public boolean isExpired() {
return expired;
} |
7a2f5d23-7d7e-4dc4-b221-e9786a399455 | 4 | private void parseRest(String measureDefinition) {
for (int i = 1; i < measureDefinition.length(); i++) {
switch(measureDefinition.charAt(i)) {
case 't':
beats.add(SongEvent.TITLE_CARD);
break;
case '.':
beats.add(SongEvent.REST);
break;
case '-':
beats.add(SongEvent.HOLD);
break;
... |
e7a7521f-f9ef-4a9c-b109-c873ea396a5c | 1 | public void initXML() {
vermilionCascadeNotebook.initDataDir();
File dataFile = new File(VCNConstants.WORK_FILE_PATH);
boolean isExistDataFile = dataFile.isFile();
if (!isExistDataFile) {
GeneralUtils.clearTree(vermilionCascadeNotebook.getTree());
TreeItem iItem = new VCNTreeItem(vermilionCascadeNoteb... |
c1fc7e03-5f9c-4266-897b-ceac19be0c0b | 5 | public void gainItem(int id, int quantity) {
if (quantity >= 0) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
IItem item = ii.getEquipById(id);
MapleInventoryType type = InventoryConstants.getInventoryType(id);
if (!MapleInventory... |
b53aecce-4a5e-4126-a779-548ad17e5c4f | 7 | public RdpPacket_Localised receive(Rdp rdpLayer) throws RdesktopException,
IOException, CryptoException, OrderException {
int sec_flags = 0;
RdpPacket_Localised buffer = null;
while (true) {
int[] channel = new int[1];
GWT.log("new receive at MCS");
buffer = McsLayer.receive(channel, rdpLayer);
GWT... |
91a340b3-ef17-4a70-a483-acd3119accfd | 7 | public static double queryFoilGain(Cons rule, double utility, List coveredPos, List coveredNeg) {
{ int p = 0;
int n = 0;
double result = 0.0;
{ TrainingExample example = null;
Cons iter000 = coveredNeg.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
... |
427d33be-9a47-4889-bd9d-cdfc2e5858b2 | 5 | @EventHandler(ignoreCancelled = true)
public void handle(BlockBreakEvent event) {
Player player = event.getPlayer();
GameSession session = plugin.getGameManager().getGameSessionOfPlayer(
player);
if (session == null) {
return;
}
if (!(session.isStarted()) && !(session.isAdmin(player))) {
event.setC... |
742f0a8a-9311-4732-b15c-d4c83f3bb58a | 5 | boolean doubledUp( String token, String mergedCell, FragList cell )
{
if ( token.equals(mergedCell) )
{
if ( cell.fragments.size()==1 )
{
Atom a = cell.fragments.get(0);
if ( a instanceof Fragment )
{
Fragmen... |
e8188bc5-050a-4dd7-bd57-d5c94966a7b9 | 2 | public void insert(A a) {
assert a != null;
Match m = findMatch(a);
if (m.matchFound) {
m.node.contents = a;
splay(m.node);
} else {
Node parent = m.node;
Node newNode = new Node(a);
if (m.smallerThanNode) {
parent.setLeft(newNode);
} else {
paren... |
9185a022-67af-46bf-b916-a93116342690 | 5 | @Override
public List<Entry<String, List<?>>> getValue() {
List<Entry<String, List<?>>> ret = new ArrayList<>();
for(ParseOption<?> p : optionList) {
ret.add(new ArgsEntry<String, List<?>>(p.getShortOption(), p.getValue()));
}
return ret;
} |
5d3f23c3-f6b1-443d-a541-1f5a9d4fa84b | 6 | private static void PriorityQueueMenu(PriorityQueue<Integer> PriorityQueue){
System.out.println("What do you want to do ?");
System.out.println("1) Dequeue");
System.out.println("2) Enqueue");
System.out.println("3) Print");
System.out.println("Enter your option");
try{
choose = in.nextInt();
switch ... |
fb6c990d-8c5e-4925-8951-26293e2aeaa8 | 8 | public void focusLost(FocusEvent e) {
Debug.print("Focus changed on: " + e.getSource());
if(e.getSource() == txtName) {
// this is where we have lost focus, so now we need to populate the data
// See if we can find the Fermentable
Fermentable temp = new Fermentable();
temp.setName(txtName.getText());
... |
29d5926d-24ec-4b30-ab0d-1fe3445b897d | 4 | private ImageIcon getTexture(int id, int x, int y) {
switch (id) {
case 1:
field = new ImageIcon("Images/textures/Gras-Erde.png");
Rectangle rec = new Rectangle(x, y, dimension, dimension);
World.fieldColList.add(rec);
break;
case 2:
field = new ImageIcon("Images/textures/Erde.png");
break;
ca... |
6365d9af-5b1d-412e-b038-3dc92fed91a4 | 2 | void reportDetail(String date, BufferedWriter bw) {
List<Map<String, Object>> maps = getPersist().readMapList(Sql.get("report-detail.sql"), date);
for (Map<String, Object> map : maps) {
String supplierCode = map.get("suppliercode").toString();
String supplierName = map.get("name"... |
2888442f-c431-425c-b49f-36ac6f940e2f | 9 | public boolean canSendNextPacket() {
if (timeStampNow - lastZeroWindow > getTimeOutMicros() && lastZeroWindow != 0 && maxWindow == 0) {
log.debug("setting window to one packet size. current window is:" + currentWindow);
maxWindow = MAX_PACKET_SIZE;
}
boolean windowNotFull = !isWondowFull();
boolean burstF... |
630c8157-afcf-48b4-a756-4df3f27b98ee | 2 | public static BufferedImage[] loadMultiImage(String s, int x, int y, int subImages) {
BufferedImage[] ret;
try {
final BufferedImage spritesheet = ImageIO.read(Images.class.getResourceAsStream(s));
ret = new BufferedImage[subImages];
for (int i = 0; i < subImages; i++)
ret[i] = spritesheet.getSubimag... |
37172fda-009a-4ae3-9cd0-f5bf194fdf51 | 1 | public static void main(String args[]){
//crear un arreglo con frutas que me gusten
String frutas []={"kiwi", "mango", "sandia", "caña", "platano"};
for(String x:frutas){
System.out.println(x);
}
} |
da9e6f99-7898-42e9-9098-dd8e3340b46e | 2 | public Vector<Object> subarray_as_Vector(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Vector<Object> vec = new Vector<Object>(end-start+1);
for(int i=start; i<=end; i++)vec.addElement(array... |
4d263a9b-712e-4a91-942b-008f02021cac | 3 | public TransactionSet twoItemSubsets(TransactionSet candidSet, double minSupportLevel, TransactionSet transSet) {
//System.out.println("2 ItemSubsets starting");
//System.out.println("Starting ItemSet to make 2 item subsets");
TransactionSet allSubsets = new TransactionSet();/*New subset of transactions to ret... |
e02a2caf-71e7-4210-aa98-ae82f04275c1 | 0 | public void setArenaState(ArenaState state) {
this.arenastate = state;
} |
bcac3be2-3e51-41fb-b1a3-a17667523992 | 1 | @Override
public HandshakeBuilder postProcessHandshakeResponseAsServer(
Handshakedata request, HandshakeBuilder response) throws Exception {
response.put("Upgrade", "websocket");
response.put("Connection", request.getFieldValue("Connection")); // to
// respond
// to
... |
287cc3e0-197a-4c66-ab3a-b1d84c4c1161 | 0 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {} |
ecb37565-8688-4465-9c28-07fe37721457 | 6 | public String[] obtenerRespuestasCorrectas(int tamaño){
String csvFile = "dataset/diabetes_prueba_resultados.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String respuestas [] = new String [tamaño];
int contador = 0;
try {
br = new BufferedReader(new FileReader(csvFile))... |
aa6f22ed-13dd-4a9d-9c59-2676d5cc110f | 0 | public HashMapStats(){
stats = new HashMap<StatType, Stat>(8);
} |
b1af2316-72ad-4d8d-b211-0f37f9290d0d | 8 | private JPanel createRoadtypeBox(String roadtypeString, boolean selected) {
JPanel roadTypeBoxPanel = new JPanel(new FlowLayout(0));
JCheckBox box = new JCheckBox(roadtypeString);
box = setLabelFont(box);
box.setSelected(selected);
box.addItemListener(new ItemListener() {
public void itemStateChanged(ItemE... |
4505a4c8-8a5f-4627-b8bc-7a5d84e8df92 | 9 | public String getConfigPath(String filename) {
if (eng.isApplet()) return null;
File jgamedir;
try {
jgamedir = new File(System.getProperty("user.home"), ".jgame");
} catch (Exception e) {
// probably AccessControlException of unsigned webstart
return null;
}
if (!jgamedir.exists()) {
// try to ... |
8b4fa287-648f-499e-963c-44ef408f21ee | 7 | @Override
public Object intercept(Invocation invocation) throws Throwable {
MappedStatement ms = (MappedStatement) invocation.getArgs()[0];
Object parameterObject = invocation.getArgs()[1];
final Configuration configuration = ms.getConfiguration();
final StatementHandler handler = co... |
bb945144-6ac4-4850-a859-34a07950e1c5 | 1 | public ConnectionLabelConfiguration( String id ) {
if( id == null ) {
throw new IllegalArgumentException( "id must not be null" );
}
this.id = id;
} |
9895c4a3-4cc1-4c33-b38a-ae8c04a95311 | 3 | private int[] getBaseEncoding(String encodingName) {
if (encodingName.equals("MacRomanEncoding")) {
return FontSupport.macRomanEncoding;
} else if (encodingName.equals("MacExpertEncoding")) {
return FontSupport.type1CExpertCharset;
} else if (encodingName.equals("WinAnsiE... |
4b8bbff7-198f-4795-8588-b7ea646d3769 | 6 | private void setLookAndFeel() {
//<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.oracle.com/javase/tutorial/uiswing/lookandfeel/... |
b1bb2e94-9c20-4829-b906-effe5974b899 | 0 | @Test
public void determineHighestStraight_whenHandContainsTto7FourCardStraight_returnsNull() {
assertNull(findHighestStraight(nonStraightFiveFlush()));
} |
79957e7d-e040-4912-adb6-72fea153cf7d | 9 | protected Behaviour getNextStep() {
if (eventsVerbose && begun()) {
I.sayAbout(actor, "NEXT COMBAT STEP "+this.hashCode()) ;
}
//
// This might need to be tweaked in cases of self-defence, where you just
// want to see off an attacker.
if (isDowned(target)) { // TODO: This might need ... |
0775030a-32a1-4b6b-970a-cefb928916b4 | 1 | public void visitTypeInsn(final int opcode, final String type) {
minSize += 3;
maxSize += 3;
if (mv != null) {
mv.visitTypeInsn(opcode, type);
}
} |
ef98fda2-c278-4c58-8d3a-6158b0271a16 | 8 | public void run() {
DCPU cpu = new DCPU();
this.display = ((VirtualMonitor)new VirtualMonitor().connectTo(cpu));
this.keyboard = ((VirtualKeyboard)new VirtualKeyboard(new AWTKeyMapping()).connectTo(cpu));
new VirtualClock().connectTo(cpu);
new VirtualFloppyDrive().connectTo(cpu);
new VirtualSlee... |
d8987431-04c2-4b9b-b937-da62934d2d67 | 3 | public int endElement(String name) throws MiniXMLException {
if (name == null)
throw new MiniXMLException(MiniXMLException._MXMLE_AE_UKNOWN_END_TOKEN);
if (name.compareToIgnoreCase(getName()) != 0)
throw new MiniXMLException(MiniXMLException._MXMLE_AE_UKNOWN_END_TOKEN);
int state = oState.getStateID();
oS... |
77c4837d-6b62-4019-ae18-957398e9e647 | 6 | public static int decodeAnimationBytes( byte prgsection[], int offset, CHREditorModel modelRef) {
int cnt = 0;
int numAnimations = prgsection[offset + cnt] & 0xFF; cnt++;
int animDuration = prgsection[offset+cnt] & 0xFF; cnt++;
int animGrid[][] = new int[numAnimations][animDuration]... |
0408ec93-3d7e-40ca-9445-d6266250b8a3 | 8 | protected Item getPoison(MOB mob)
{
if(mob==null)
return null;
if(mob.location()==null)
return null;
for(int i=0;i<mob.location().numItems();i++)
{
final Item I=mob.location().getItem(i);
if((I!=null)
&&(I instanceof Drink)
&&(((((Drink)I).containsDrink())
&&(((Drink)I).liquidType()==RawM... |
c10a75cd-4f91-446e-aaf2-888516bc8bea | 4 | public void deleteTable(byte[] table)
{
boolean isSystemTable = ForemanConstants.TableIdentifier.getIdentifierFromName(table) != null;
if (tableExists(table) && !isSystemTable)
{
instance.hdel(ForemanConstants.TableIdentifier.TABLE.getId(), table);
Set<byte[]> keys = instance.hkeys(table);
for (byte[] k... |
8d668703-0434-4cd5-89d4-1c6ebe011b14 | 6 | public boolean append(E element) {
if (lastPos == array.length - 1 || array.length == 0) {
changeCapacityBy(1);
if (array.length == 1) {
return setElement(0, element);
}
}
if (array.length > 0 && lastPos == 0 && array[lastPos] == null) {
... |
7aaaccc0-cf29-45cb-9614-cdc80bb7780b | 8 | public void update(boolean up, boolean down, boolean left, boolean right, Dimension d) {
//check for movment
if(up){
this.setPlayerY(this.getPlayerY()-4);
}
else if(down){
this.setPlayerY(this.getPlayerY()+4);
}
if(left){
this.setPlayerX(this.getPlayerX()-7);
}
else if(right){
this.setPlay... |
5000b410-6fed-428a-8c34-629688410adf | 9 | protected static void createDescriptor()
{
try
{
InputStream descriptorStream = RtgParseControllerGenerated.class.getResourceAsStream(DESCRIPTOR);
InputStream table = RtgParseControllerGenerated.class.getResourceAsStream(TABLE);
boolean filesystem = false;
if(descriptorStream == null... |
656c58e6-96be-4fb6-8ee4-d80556a26a36 | 5 | @Override
public void keyPressed(int key, char character, GUIComponent component) {
switch (key) {
case (Keyboard.KEY_ESCAPE) : this.deactivate(500); break;
case (Keyboard.KEY_1) : suiteSelected(Card.CLUBS); break;
case (Keyboard.KEY_2) : suiteSelected(Card.DIAMONDS); bre... |
e6391c2f-4e37-4ddc-91f6-b1d9f7039fd8 | 7 | public void ENTER() {
if (atTitle) {
atTitle = !atTitle;
inTransition = !inTransition;
Pikachu = PikaDance1;
num = 0;
gameTimer.setDelay(25);
} else if (gamestarted && !inMenu && movable && !inBattle && !walking && !inDialog) {
SE.p... |
258d66cd-78d1-4d89-8051-0fe94d41085f | 9 | public void rowEventListener(RowEditEvent e) {
try {
PersonasDTO personasDTO = (PersonasDTO) e.getObject();
if (txtGenero == null) {
txtGenero = new InputText();
}
txtGenero.setValue(personasDTO.getGenero());
if (txtPrimerApellido ==... |
6445d955-aeb7-45f3-9f64-cf19a0427d57 | 5 | @Override
public Competicao get(Object key) {
try {
Competicao al = null;
Statement stm = conn.createStatement();
String sql = "SELECT Competicao.*,Torneio.* FROM Torneio,competicao WHERE Torneio.Cod_Torneio='" + (String) key + "'and competicao.cod_competicao=torneio.cod_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.