method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0c78fde0-8aa7-4bf9-8f3c-ca6744cdb306 | 6 | private void recalculateCellSize(int minSize)
{
if (numRows == 0 || numCols == 0)
{
cellSize = 0;
}
else
{
JViewport vp = getEnclosingViewport();
Dimension viewableSize = (vp != null) ? vp.getSize() : getSize();
int desiredCellS... |
50bad855-22c9-40b0-a082-7c9eb48d818f | 8 | private void commandSwitch(){
//Takes an input from the console and uses just the first letter
String input = menuScan.next();
char inputChar = input.charAt(0);
// Runs it through a switch to execute the appropriate command
switch (inputChar) {
case 'a': loadFile();
break;
case 'b': stateSearch();
... |
57625bf4-9ee0-40ca-9cae-4ff08975b5c4 | 6 | public static void main(String[] args)
{
System.out.println("Starting network example ...");
try
{
//////////////////////////////////////////
// First step: Initialize the GridSim package. It should be called
// before creating any entities. We can't run ... |
cc92e8bf-0a1f-4e2d-8dd9-09320af99d4d | 8 | public void addRequiredParameters(OAuthAccessor accessor)
throws OAuthException, IOException, URISyntaxException {
final Map<String, String> pMap = OAuth.newMap(parameters);
if (pMap.get(OAuth.OAUTH_TOKEN) == null && accessor.accessToken != null) {
addParameter(OAuth.OAUTH_TOKEN,... |
8e9baddf-c0d8-4245-a88b-746ba6a605cb | 0 | @Basic
@Column(name = "POP_NOMBRE_PROVEEDOR")
public String getPopNombreProveedor() {
return popNombreProveedor;
} |
4b8b6eb1-0ef6-4208-8eaa-0f782ec8013f | 9 | public static Keyword inequalitySpecialist(ControlFrame frame, Keyword lastmove) {
lastmove = lastmove;
{ Proposition proposition = frame.proposition;
Surrogate relation = ((Surrogate)(proposition.operator));
if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue()) {
{ Object old$Rev... |
5d416c6d-4471-48a5-b62e-489c8fb795ff | 0 | public Point2D getRelativeCenter()
{
return new Point2D.Double(getSideLength()/2.0, getSideLength()/2.0);
} |
c5f46422-9000-4f73-818b-0d05d7e5293b | 6 | public PERangeList intersection(PERangeList listb) {
PERangeList rIts = new PERangeList();
if(getNumPE() == 0 || listb.getNumPE() == 0) {
return rIts;
}
sortRanges();
listb.sortRanges();
for(PERange rq : this.ranges) {
for(PERange ru : listb.ranges) {
// rq's... |
3666fee1-f13d-493c-bc07-4f54bc6d44f2 | 5 | public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (Exception ex) {
ex.printStackTrace();
}
CometEngine engine = CometContext.getInstance().getEngine();
if (COM1.equals(portName)) {
long totalMemory = Runtime.getRuntime().totalMemory();
System.out.println("... |
09406153-f4d7-49d8-a4cc-ccbbf91f3538 | 5 | public static EasyDate smartParse(String date) {
if (date == null) {
throw new NullPointerException("指定的日期字符串不能为null");
}
int length = date.length(); // 字符串长度
String format = null;
switch (length) {
case 10:// 2012-01-02
format = DATE;
break;
case 19:// 2012-01-02 13:22:56
format = DATETIME;
... |
5c44479e-5d42-49ef-9be8-76269652ad0f | 4 | public boolean hasConverged() {
if (x >= 0 && x <= MAX_X && y >= 0 && y <= MAX_Y) {
return true;
}
return false;
} |
64fd283d-1171-4e52-9eb1-fa462f13da1e | 6 | private int binarySearchInArray(K key) {
int left = 0;
int right = entryList.size() - 1;
// Optimization: For the common case in which entries are added in
// ascending tag order, check the largest element in the array before
// doing a full binary search.
if (right >= 0) {
int cmp = key.... |
51b584f9-aa71-461c-9c79-e7dc35fc3fdb | 8 | private void clearRows()
{
for (int i=0;i<board.length;i++)
{
boolean canRowClear=true;
for (int j=0;j<board[0].length;j++)
{
if (board[i][j]==0)
{
canRowClear=false;
}
}
if (canRowClear)
{
score+=10;
//clear row
for (int k=0;k<board[0].length;k++)
{
board[i]... |
e54263ab-351e-4ba7-a01f-e0aa67800453 | 7 | String getNextDataToken() throws Exception {
String str = peekToken();
if (str == null)
return null;
if (wasUnQuoted())
if (str.charAt(0) == '_' || str.startsWith("loop_")
|| str.startsWith("data_")
|| str.startsWith("stop_")
|| str.startsWith("glob... |
55037c0a-05bb-4af4-af4e-0b381a66fbbb | 8 | public void deleteDuplicatesByGenes(List<Bin> newGenes) {
for(int i = 0; i < this.bins.size(); i++){
for(int j = 0; j < newGenes.size(); j++){
for(int n = 0; n < newGenes.get(j).getAll().size(); n++){
for(int m = 0; m < this.bins.get(i).getAll().size(); m++){
if(this.bins.get(i).getElem... |
c97a6ad4-fe94-43d2-8d18-ffc2288893c6 | 4 | @SuppressWarnings("unchecked")
protected T findOneResult(String namedQuery, Map<String, Object> parameters) {
T result = null;
try {
Query query = session.createQuery(namedQuery);
// Method that will populate parameters if they are passed not null and empty
if (parameters != null && !parameters.isEmpty(... |
1552eb03-9e92-4ad2-88d6-6e258f674caf | 2 | public boolean isOnEarth(){
if(jumpEnd){
if(jumpAnimation == 5){
jumpEnd = false;
jumpAnimation = 0;
} else {
jumpAnimation++;
}
return true;
} else {
return false;
}
} |
ee9ad308-70e6-4abd-b6ee-4fd8b967edc5 | 2 | static byte[] getFakedCookie(Session session){
synchronized(faked_cookie_hex_pool){
byte[] foo=(byte[])faked_cookie_hex_pool.get(session);
if(foo==null){
Random random=Session.random;
foo=new byte[16];
synchronized(random){
random.fill(foo, 0, 16);
}
/*
System.err.print("faked_cookie: ");
for(int... |
3dcb2b9a-e13a-4a57-9d93-26a990fe7f11 | 6 | private void checkWinner() {
boolean test = false;
if (test || m_test)
System.out.println("ConnectFour::checkWinner() - BEGIN");
for (int y = 0; y < GAME_HEIGHT; y++) {
for (int x = 0; x < GAME_WIDTH; x++) {
checkRight(x, y);
checkDown(x, y);
checkDiagonalUp(x, y);
checkDiagonalDown(x, y);
... |
96cd3367-40a9-48ef-af15-c145a11d245e | 3 | public static BufferedImage resizeImage(BufferedImage image, double scale) {
if ((scale == 1.0) || (image == null)) {
return image;
}
int type = image.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : image
.getType();
float width = image.getWidth();
float height = image.getHeight();
int newHeight = ... |
856c9e79-2c01-473c-b047-7738132a8219 | 1 | public ArrayList viewMyBookingCheckin() {
ArrayList temp = new ArrayList();
Query q = em.createQuery("SELECT t from BookingEntity t");
for (Object o : q.getResultList()) {
BookingEntity p = (BookingEntity) o;
temp.add(sdf.format(p.getCheckinDate()));
System.o... |
1f94dc28-8327-48b2-a74b-fc15521964b3 | 4 | private void jButtonBekaeftBetalingActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonBekaeftBetalingActionPerformed
{//GEN-HEADEREND:event_jButtonBekaeftBetalingActionPerformed
if (jCheckBoxBetalt.isSelected())
{
for (int i = 0; i < control.getOrderlist().size(); i+... |
fa75d76d-f0b2-4ea3-a8cf-6bc4e714677a | 3 | @Override
public void keyPressed(KeyEvent ke)
{
//synchronized(this)
//{
this.input = this.input.concat(Character.toString(ke.getKeyChar()));
if(ke.getKeyChar() == KeyEvent.VK_BACK_SPACE ) if(this.input.length()>=2)this.input= this.input.substring(0, this.input.length()-2);
... |
21c83019-cb63-4eab-a859-89c6c8d24f64 | 1 | private void storeEditData () {
int selRow = rosterTable.getSelectedRow();
if (selRow >= 0) {
Roster selRoster = MainWindow.rosterDB.getRosters().get(selRow);
selRoster.setFamilyName (familyNameField.getText());
selRoster.setGivenName (givenNameField.getText());
selRoster.setPhoneNumber(phoneNumberFi... |
c87f5031-3e3c-426a-8456-68309f2d240f | 6 | @Override
public void draw(Graphics2D drawScreen, int offsetX, int offsetY) {
totalVisibleEnities = 0;
clearMaps();
sortEntitiesToMap();
// At this point we will have a list of only visible sprites, and
// the map should contain the draw order required. Remember that not
// every key will match up with t... |
c1c70263-68b0-4b55-9636-71804790bd5b | 8 | private boolean r_factive() {
int among_var;
// (, line 132
// [, line 133
ket = cursor;
// substring, line 133
among_var = find_among_b(a_7, 2);
if (among_var == 0)
{
... |
a016b6c3-d84d-4212-a671-3519ea4fee65 | 4 | public boolean removeBlockFromRoulette(Block block) {
Set<Integer> tilesKeys = tilesLocations.keySet();
for(Integer key : tilesKeys) {
SerializableLocation blockLocation = new SerializableLocation(block.getLocation());
if(tilesLocations.get(key).contains(blockLocation)) {
tilesLocations.get(key).remove(bl... |
1ec452a2-e37e-49e0-81d3-3a046f522b92 | 7 | public static void back(int index, int cur) {
if (index >= list.length) {
if (cur > nBlacks) {
nBlacks = cur;
ans = color.clone();
}
return;
}
boolean neighBlack = false;
for (int i = 0; i < list[index].size() && !neighBlack; i++)
if (color[list[index].get(i)])
neighBlack = true;
if (!... |
74c4df69-feee-4a6e-bbc2-b2d1e556fe5c | 2 | @Override
public void render() {
if(location.getWeaponID() == WeaponLocation.NO_WEAPON) {
super.render();
}
if(renderData) {
locData.render();
}
} |
b0277cf9-5970-4ad7-8ff7-315e3e086577 | 8 | private void initialize() {
frmGui = new JFrame();
//frmGui.setResizable(false);
frmGui.setTitle("guiTSP");
frmGui.setBounds(100, 100, 346, 786);
frmGui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmGui.getContentPane().setLayout(new BorderLayout(0, 0));
JPanel pnlInput = new JPanel();
frmGui.getC... |
27b9535c-5a0f-45b2-b690-f3ddf68efa06 | 2 | private void itmMnu_EncarregadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnu_EncarregadoActionPerformed
if ((usuarioLogado.getTipo().equals("Diretor")) || (usuarioLogado.getTipo().equals("Gerente"))) {
GerenciarEncarregadoForm gerenciarEncarregadoForm = null;
... |
9f7a828d-6d7b-4e32-a0af-d0f0aa1d763b | 3 | @Override
protected void checkAfterParse(Method method) throws DaoGenerateException {
super.checkAfterParse(method);
Class<?> returnType = method.getReturnType();
isReturnCollection = ClassHelper.isTypeCollection(returnType);
if (isReturnCollection && StringUtils.isEmpty(vkey)) {
throw new DaoGenerateExcep... |
fdb309a2-9e37-472a-a8e3-9570b1178467 | 1 | public Map<String, Map<Integer, Map<String, Double>>> getAll()
throws FileNotFoundException, IOException {
for (String file : trainingFileString) {
getWordInClass(file);
}
return allMap;
} |
b83d5c6e-0c0e-4991-b97d-6c6f4f90a3a0 | 2 | private void processConnection() throws IOException
{
String message = "Connection successful";
sendData( message ); // send connection successful message
// enable enterField so server user can send messages
// setTextFieldEditable( true );
do // process messages sent from client
{
try // read mess... |
c32f4a37-f0bf-4a25-a929-8bb2e784b49a | 0 | public int getSteps() {
return steps;
} |
0f3002d2-4716-468a-b47a-db9f6791dbe3 | 6 | public void printOutput() throws Exception {
if (inFile==null) throw new Exception("class not initialized");
String sIn=this.inFile.readLine();
sIn=sIn.trim();
Integer iVal=new Integer(sIn);
System.out.println("Got3: [" + iVal + "]");
for (int i=1; i<=iVal.intValue(); ++i) {
boolean blThree=((i%3)==0);
... |
b3d33665-fb90-41b3-9f05-b4ad73e921ce | 1 | public static String[] dataToStringArray(byte[][] data) {
String[] strings = new String[data.length];
for(int i = 0; i < data.length; i++) {
strings[i] = new String(data[i]); //.toString();
}
return strings;
} |
026867b1-2223-49a3-8946-c967b799f2de | 9 | public void handleKeyboardEvent(int keycode){
availableMoves = gameboard.getAvailableMoves(workingTetromino, column, row);
//Gestion des mutateurs
switch(keycode) {
case KeyEvent.VK_UP:{
if(availableMoves.canRotateRight()) {
... |
71031de1-9f12-4e3f-98a7-65692f28c370 | 4 | public static float getFloat() {
float x = 0.0F;
while (true) {
String str = readRealString();
if (str == null) {
errorMessage("Floating point number not found.",
"Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE);
}
... |
9f1790a3-d4cb-4426-83ed-12f96c19ec34 | 0 | public static void main(String[] args) {
Human human = new Human();
//human.name = "Slava";
human.setName("Sanya");
System.out.println(human.getName());
human.setAge(10);
//human.age = -345;
System.out.println(human.getAge());
} |
df33c177-b21e-4153-9ee8-67129cdae9b0 | 9 | public Projectile createNewProjectile(String name)
{
Projectile projectile = null;
if (name.equals("random"))
{
name = Helper.getWeightedRandomValue(this.weightedValues);
}
try
{
Class<?> projectileClass = Class.forName(name);
Con... |
6e4d48c9-46a0-45ee-83a3-0d94a92b05fe | 8 | public void modelUpdate(final ModelEvent e) {
EventQueue.invokeLater(new Runnable() {
public void run() {
switch (e.getID()) {
case ModelEvent.SCRIPT_START:
if (disabledAtScript)
enableButton(false, e.getSource());
break;
case ModelEvent.SCRIPT_END:
if (disabledAtScript)
enab... |
8b62912a-09dc-4d68-bb40-7953fa74a306 | 7 | public void initToNull() {
for (int z = 0; z < mapSizeZ; z++) {
for (int x = 0; x < mapSizeX; x++) {
for (int y = 0; y < mapSizeY; y++)
groundArray[z][x][y] = null;
}
}
for (int l = 0; l < anInt472; l++) {
for (int j1 = 0; j1 < cullingClusterPointer[l]; j1++)
cullingClusters[l][j1] = null;... |
e2f0bd54-0733-49cb-9273-f3efee84370c | 9 | public static void ensureTokenizerBufferSize(TokenizerStreamState state, int currenttokenstart, int requiredspace) {
{ int size = state.bufferSize;
int newsize = size;
int end = ((state.end) % size);
int freespace = ((currenttokenstart == -1) ? size : (((end <= currenttokenstart) ? (currenttokenst... |
33d0f0fc-8494-4838-a1b2-73dbf979baa9 | 8 | private void qsort(Object[] items, Comparator comparator, int l, int r)
{
final int M = 4;
int i;
int j;
Object v;
if((r - l) > M)
{
i = (r + l) / 2;
if(comparator.compare(items[l], items[i]) > 0)
{
swap(items, l, i);
}
if(comparator.compare(items[l], ite... |
bfd4e0cc-97fe-4763-bcbd-c77a5d57ca5c | 5 | public boolean saveAsRaw(String filename) throws Exception {
if (null == filename) {
throw new Exception("Filename must not be null");
}
// open the streams and send the height data to the file.
try {
FileOutputStream fos = new FileOutputStream(filename);
DataOutputStream dos = new DataOutputStream(... |
44a805aa-5622-4322-a322-7d3847d61952 | 9 | private int getConstructorType(StructuredBlock body) {
/*
* A non static constructor must begin with a call to another
* constructor. Either to a constructor of the same class or to the
* super class
*/
InstructionBlock ib;
if (body instanceof InstructionBlock)
ib = (InstructionBlock) body;
else ... |
7009c8d5-8340-4833-8f0e-f067e8e89865 | 0 | public int[] getData() {
return data;
} |
85d88e53-9200-4a90-9c08-170b5238cae8 | 8 | public void WGListWords(String sender, String login, String hostname, Command command) {
Game game = null;
User user = null;
if(command.arguments.length == 2) {
game = games.get(getServer() + " " + command.arguments[1]);
user = getUser(game, sender, login, hostna... |
33b8b65f-7c49-4920-a364-bc19d1c50bfb | 1 | public static void run(Class serverClass) {
try {
executeInstance((NanoHTTPD) serverClass.newInstance());
} catch (Exception e) {
e.printStackTrace();
}
} |
2899e3e7-357d-4a48-af81-8e09b945fb8b | 0 | public Student(String name)
{
this.name = name;
} |
936091a4-6f7b-4690-b426-b0436cda978c | 8 | public static boolean modifyRow (Object bean, String field) {
PreparedStatement stmt = null;
try{
if(bean instanceof Patient){
return modifyPatient((Patient)bean, stmt, field);
}
if(bean instanceof Employee){
return modifyEmployee((Employee)bean, stmt, field);
}
if(bean instanceof Drug)... |
d7ce04a6-5959-4d1c-8f4e-d9ee04c2d02b | 2 | public void setServerTypeClassName(String newClassName){
if(newClassName.equals(serverTypeClassName))
return;
if (ServerType.isValidServerTypeClassName(newClassName))
throw new IllegalArgumentException(INVALID_CLASSNAME);
serverTypeClassName = newClassName;
useNewModel();
} |
7bd3d6ef-6d0a-42fd-ad5e-f47cb1783738 | 9 | public void configForLanding(Object arg[]) {
text.setText("") ;
text.append("\nExpedition Settings:\n") ;
describePerk(0, "Site Type" , SITE_DESC ) ;
describePerk(1, "Funding Level", FUNDING_DESC) ;
describePerk(2, "Granted Title", gender == 1 ? TITLE_MALE : TITLE_FEMALE) ;
text.a... |
2bf29cb0-9662-4771-8c75-3ac3065d62db | 0 | public void setName(String name) {
this.name = name;
} |
d3cda205-a8b7-491b-9a64-626d7e0214bc | 3 | private boolean createGridlets() {
int type = INTERACTIVE_JOBS;
int nodes = 1, runTime = -1;
long arrTime = -1;
arrivalInit(aarr, barr, anum, bnum, start, weights);
for (int i=0; i<numJobs; i++) {
long[] info = getNextArrival(type, weights, aarr, barr);
type = (int)in... |
29b49b71-f4b2-4693-a09c-68868ca5d43c | 9 | private void convertToArrAdj() {
// Log.print(Log.system, "Converting graph to ARR_ADJ");
switch (getState()) {
// ARR_INC -> ARR_ADJ
case ARR_INC:
clearGraph(States.ARR_ADJ);
for (int j = 0; j < M; j++) {
boolean isFirstFinded = false;
// First - отрицательное число, откуда ребро уходит, Second ... |
d087ca83-593a-4174-8ec6-2f46bf0cde9c | 8 | private Color getColor(int col) {
switch (col) {
case BLACK:
return Color.BLACK;
case LIGHT_GRAY:
return Color.LIGHT_GRAY;
case RED:
return Color.RED;
case ORANGE:
return Color.ORANGE;
case YELLOW:
return Color.Y... |
09d88278-6c83-4853-9219-d053b7e2866e | 6 | public void drawScreen(int par1, int par2, float par3)
{
this.func_41040_b(par1, par2, par3);
Tessellator var4 = Tessellator.instance;
short var5 = 274;
int var6 = this.width / 2 - var5 / 2;
int var7 = this.height + 50;
float var8 = -((float)this.updateCounter + par3)... |
b6677298-337a-428a-ab75-c4740c746cda | 5 | public void cancelPieceForConnection(ManagedConnection mc, int piece){
Piece p = disseminatedPiecesToCompete.get(piece);
if(p!=null){
List<ManagedConnection> list = pieceToClients.get(p);
list.remove(mc);
if(list.size()==0){
//ok remove this from every where.
//This might be the only client that ha... |
ed82bea0-3a8f-4c70-8cce-e7abc8d912c4 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
61cc685c-6409-40c7-9396-b2e7dbf5b746 | 6 | private boolean handleDamageBlocked(Player player, DamageCause type) {
if (WorldRegionsPlugin.getInstanceConfig().ENABLE_BLOCKED_DAMAGE && WGCommon.willFlagApply(player, WorldRegionsFlags.BLOCKED_DAMAGE)) {
// Disabled?
if (WGCommon.areRegionsDisabled(player.getWorld())) return true;
// Bypass?
if (!W... |
f0565308-029b-4d5e-b1a9-3dd3ce8baff2 | 5 | public void back()
{
i++;
if(i>modtexts.length-1)
i=0;
modname = modtexts[i].getName();
boolean gef=false;
for(Modinfo prop: proposals)
if(prop.getName().equals(modname)) gef=true;
if(!gef)back();
headl.setText(modname);
headl2.setText(modname);
if(geladen)
laden();
else
neu=fa... |
f7a9f022-dfd8-431e-9234-4439d7c630a0 | 2 | public void afficheTable(){
System.out.println("\nVoici la table de coordonnées [" + nombreColonne + "]["+ nombreRangee+ "]");
for(boolean[] temp : coordoneeJeu){
//System.out.print("Poura la rangée " + rangee);
for(boolean used : temp)
System.out.print(used+ " ")... |
681dc473-ff74-4999-b7b6-d8fdc7eb358d | 5 | private void creerTriangle(final int position,final Case c) {
int num = 25-position;
Point p = new Point(0,0);
if(num<=6)
{
p = new Point(454-(num-1)*33,30);
}else if(num<=12)
{
p = new Point(392-173-(num-7)*33,30);
}else if(num<=18)
{
p = new Point(392-173+(num-18)*33,233);
}else if(num<=24)... |
5abbab2c-4a2c-4be4-8881-7c246271000a | 1 | public static Entry[] mergeSort(Entry[] list) {
// Uses merge sort, and does not change the original array.
if(list.length == 1) {
return Arrays.copyOf(list, 1);
} else {
Entry[] list1 = Arrays.copyOfRange(list, list.length/2, list.length);
Entry[] list2 = Arrays.copyOfRange(list, 0, list.length/2);
r... |
9a699981-8429-40d4-bc32-958a9ae0af6d | 3 | public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
f = new JFrame("WiMAP");
JPanel p = new MainWindow();
f.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );
f.setContentPane(p);
f.setJMenuBar(createMenuBar());
... |
7c5677da-5d1c-40db-bd3d-6907af3f1a37 | 9 | public boolean canMakeMove(Direction dir, Color [] [] placedBlocks) {
int XCoord, YCoord, Y = 0,X = 0;
switch (dir) {
case DOWN:
Y = 1;
break;
case UP:
Y = -1;
break;
case LEFT:
X = -1;
... |
cd9e64e5-347c-442b-a111-f31179c47698 | 1 | private void drawGameElement(Graphics2D graphics, Element element,
Position position) {
Image image = findGameElementImage(element);
if (image != null) {
graphics.drawImage(image, position.xCoordinate,
position.yCoordinate, 40, 40, null);
}
} |
0d9e9687-3d02-4113-82b4-bbb6e6e5f7d9 | 2 | @Override
public boolean handleException(Throwable e, CommandBase command, CommandInvocation invocation)
{
for (ExceptionHandler handler : handlers)
{
if (handler.handleException(e, command, invocation))
{
return true;
}
}
retur... |
bcf0df4b-d703-4263-b144-4ea7107977df | 8 | public void printStyles() {
ensureOut();
// First, copy the base css
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
ToHtml.class.getResourceAsStream("excelStyle.css")));
String line;
while ((line = i... |
5210c466-1926-490c-8506-398fa4af5c41 | 5 | public ListingPanel(String user, Item i) {
super();
ImagePanel picture = new ImagePanel(i.getImage(), 65, 65);
JLabel title = new JLabel(i.getTitle());
JLabel bid = new JLabel(i.getHighestBid().formatted());
JLabel time = new DynamicTimeLabel(i);
// Won/Lost messages
if (i.timeLeft() == 0) {
time... |
b10c5e20-0d3a-4b95-af65-81dda91a0cbf | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Utilizador ut = dados.get(rowIndex);
switch (columnIndex) {
case 0:
return ut.getNome();
case 1:
return ut.getEmail();
case 2:
return ut.getLogIn()... |
08771515-3e0c-413b-b060-745119bcdc4b | 4 | public int getSignID(final Location sign) throws SQLException, InvalidSignLocationException{
long time = 0;
plugin.getLoggerUtility().log("getting Sign!", LoggerUtility.Level.DEBUG);
time = System.nanoTime();
Statement st = null;
String sql;
ResultSet result;
try {
st = connector.getConnection().create... |
993b3be7-1195-4cf3-8b6e-6d68bb09deb7 | 1 | @Override
public void go(HasWidgets container) {
this.container = container;
if ("".equals(History.getToken())) {
History.newItem(HISTORY_TOKEN);
} else {
History.fireCurrentHistoryState();
}
} |
2af4c349-17f0-4bc9-b1b0-824ebab284e7 | 9 | private static void method232(int ai[], int ai1[], int ai2[], byte abyte0[], int i, int j, int k)
{
int l = 0;
for(int i1 = i; i1 <= j; i1++)
{
for(int l2 = 0; l2 < k; l2++)
if(abyte0[l2] == i1)
{
ai2[l] = l2;
l++;
}
}
for(int j1 = 0; j1 < 23; j1++)
ai1[j1] = 0;
for(int k1 = ... |
ad71f994-0ccb-4ba8-8e89-c64fa920e0d8 | 8 | public void printBoard() {
for(int y = 0; y < 9; y++) {
for(int x = 0; x < 9; x++) {
Player player;
if (attacker.getPieceTypeOnBoardAt(new Point(x, y)) > 0) player = attacker;
else player = defender;
String str = "";
Boo... |
cc98fb88-2692-4971-bc8e-7a3695a190a0 | 1 | @Test
public void arithmeticInstr_testInvalidDestinationSourceRef() { //Checks instr. not created with invalid register ref.
try {
instr = new ArithmeticInstr(Opcode.DIV, 75, 2);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);
} |
92228eac-6e9c-4bb5-98c4-150e277d73a5 | 2 | public static BufferedImage[][] split(BufferedImage source, int xSize, int ySize)
{
int xSlices = source.getWidth() / xSize;
int ySlices = source.getHeight() / ySize;
BufferedImage[][] newIm = new BufferedImage[xSlices][ySlices];
for(int x = 0;x < xSlices;x++)
{
for(int y = 0;y < ySlices;y++)
{
new... |
1bfa53d0-5b05-485d-b0e8-1ba958c3b4bc | 5 | public void runDay() {
for(int i=0; i<teller.length; i++)
teller[i] = new RoboTeller();
for(int i=0; i<teller.length; i++)
teller[i].start();
int done = 0;
while(done < teller.length)
try{teller[done].join();done++;} catch(InterruptedException e) {}
int finalCapital = 0;
for(int i=0; i<acco... |
7ba613ce-2d1e-46c3-9db2-4f8ab53fc474 | 8 | public void Process(int id){
switch(id){
case 102:ActivateImageSpace();
break;
case 141:BasicSpaceReasoning(-5,0);//左
break;
case 142:BasicSpaceReasoning(5, 0);//右
break;
case 143:BasicSpaceReasoning(0, -5);//上
break;
case 144:BasicSpaceReasoning(0, 5);//下
break;
case 145:BasicSp... |
4204ae40-2b48-4f0c-8589-a990ca2e860d | 5 | @Override
public void action() {
ACLMessage msg = myAgent.receive(msgFilter);
if (msg != null) {
if (msg.getConversationId() == null) {
logger.log(Level.WARNING, (teacherSymbol + ": ConversationId == null : sender: "
+ msg.getSender().getLocalName(... |
267831c1-3fdb-47d3-b0d2-71350bf0258c | 6 | public void setAdminUnitMasterListWithZero(
List<AdminUnit> adminUnitMasterListWithZero, AdminUnit foundMaster) {
List<AdminUnit> res = new ArrayList<AdminUnit>();
if (adminUnitMasterListWithZero == null) {
adminUnitMasterListWithZero = new ArrayList<AdminUnit>();
}
// create new AdminUnitType
AdminU... |
aa4fd080-ab20-4763-bd98-9ee792ce0d18 | 7 | private static <E extends Comparable<? super E>> List<LisNode<E>> lis(List<LisNode<E>> n)
{
List<LisNode<E>> pileTops = new ArrayList<>();
// Sort into piles
for (LisNode<E> node : n)
{
int i = Collections.binarySearch(pileTops, node);
if (i < 0)
{
i = ~i;
}
if (i != 0)
{
node.... |
90db0f74-6c9c-4b34-befc-b81a006bdee3 | 9 | private void createRivers(Map map) {
final Specification spec = map.getSpecification();
final TileImprovementType riverType
= spec.getTileImprovementType("model.improvement.river");
final int number = getApproximateLandCount()
/ mapOptions.getInteger("model.option.riverNu... |
12aeec49-6292-4453-8a14-2cf3bb6005df | 2 | public static boolean isFullMask(int itemID)
{
for (int i=0; i<fullMask.length; i++)
if (fullMask[i] == itemID)
return true;
return false;
} |
8ff944ec-e425-48ac-a486-b65abac607db | 0 | public JobSchedulerBuilder withTriggerGroup( String triggerGroup )
{
this.triggerGroup = triggerGroup;
return this;
} |
50d59f8f-3822-4301-9bee-d9dbf6da21bd | 0 | public void update(String str)
{
System.out.println(str);
} |
eb254804-6fd5-4d75-a941-9d10e0f68743 | 4 | private void printCardsOnHand() {
o(String.format(" Cards on your Hand: "));
Map<Integer, List<CardInterface>> cards = new HashMap<Integer, List<CardInterface>>();
for (int i = 0; i < Settings.getNationcount(); i++) {
cards.put(i, new ArrayList<CardInterface>());
}
fo... |
ab856f68-d196-42f9-b69c-a42bac1fce89 | 8 | public Location[] adjacentLocations(){
// Make a new arraylist
Location[] locations = new Location[(r == 0 || r == 3) ? 5 : 8];
int count = 0;
// Add locations that are in the grid
for (int i = r - 1; i < r + 2; i++) {
if (-1 < i && i < 4){
for (int j = -1; j < 2; j++){
// Don't add the s... |
5980d8bd-422a-45f8-af9d-83ee6f1d8925 | 9 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation == 1) {
g.drawLine(0, 100, 80, 100);
g.drawLine(120, 100, 200, 100);
g.drawLine(120, 78, 120, 122);
g.drawLine(80, 78, 80, 122);
g.drawLine(80, 78, ... |
f9d6ec9c-d996-40ee-8850-e3b6702676a9 | 5 | public void addCity(final String cityName, final int surveyInterval) {
final String transformedCityName = City.transformCityName(cityName);
final int cityId;
try {
cityId = cityParser.retrieveCityId(transformedCityName);
final City city = new City(transformedCityName, ci... |
ee4cfbd9-ddab-400b-9488-6fc468266d07 | 6 | @Override
public String readLine() throws IOException {
final StringBuffer result = new StringBuffer();
try {
for (int value; true;) {
switch (value = this.readUnsignedByte()) {
case '\r':
final long cur = this.index();
if (this.readUnsignedByte() == '\n') return result.toString();
th... |
b5f2e8c6-725a-48c6-b644-0fbdf10673c5 | 9 | private static void distribute(final boolean[] higherPriorityCells, final DimensionInfo info, int toDistribute, final int[] widths) {
int stretches = 0;
for (int i = 0; i < info.getCellCount(); i++) {
if (higherPriorityCells[i]) {
stretches += info.getStretch(i);
}
}
{
final i... |
aec83323-5c01-48ac-843c-000f70d9c0d1 | 0 | @Override
public void onStringInput(String input) {
System.out.println("Your age is: "+ input);
} |
48218d6c-c6b5-4746-92be-a2eb65c10c33 | 3 | @SuppressWarnings("unchecked")
@Override
public B get(A a) {
B b = null;
try {
b = (B) getMethod.invoke(a, new Object[0]);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTra... |
ca983d83-d15e-4123-a980-c83b519730d8 | 8 | @Override
public OmahaHiLoWorker build()
{
if (super.getRounds() <= 0) {
throw new IllegalStateException("The number of rounds must be a strictly positive number");
} else if (super.getProfiles() == null || super.getProfiles().size() < 2) {
throw n... |
59264551-9835-4c23-84ef-be5c6d7fd13d | 4 | protected HashMap<String, Double> rankChild4StnByHybrid(_Stn stnObj,
_ParentDoc pDoc) {
HashMap<String, Double> childLikelihoodMap = new HashMap<String, Double>();
double smoothingMu = m_LM.m_smoothingMu;
for (_ChildDoc cDoc : pDoc.m_childDocs) {
double cDocLen = cDoc.getTotalDocLength();
_SparseFeature... |
3adaee89-1840-4346-aee4-2dd412722e20 | 3 | @Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other instanceof BookModel) {
BookModel otherBook = (BookModel) other;
boolean isSameClass = this.getClass().equals(otherBook.getClass());
return (this.isbn == otherBook.isbn) && isSameClass;
}
return false... |
0b6fe746-4872-4e72-b839-f31983ff9e24 | 0 | public static void main(String[] args) {
double above = 0.7, below = 0.4;
float fabove = 0.7f, fbelow = 0.4f;
System.out.println("Math.round(above): " + Math.round(above));
System.out.println("Math.round(below): " + Math.round(below));
System.out.println("Math.round(fabove): " + Math.round(fabove));
System.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.