method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b67b7e00-3101-421e-ba31-32a3ff7c2f35 | 9 | public static LogicalStracture splitStracture(String text){
LogicalStracture logicalStracture = new LogicalStracture();
ArrayList<String> e = new ArrayList<>();
String[] split = text.split("\\s+");
if(!(split[0].equals("("))){
e.add(text);
}else{
int count = 0;
int start=0, end=0;
for(int i = 0; ... |
24c38140-2de2-4eff-b52d-e33a3d01a1d4 | 2 | public double standardizedAverageCorrelationCoefficients(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.standardizedMeanRhoWithoutTotals;
} |
cc5c77f6-ce4a-4baf-8f0e-bc95dfaf5016 | 3 | @Override
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
return commands.equals(((Program) obj).com... |
0bff2846-a719-41c4-916d-f4af18d512cb | 8 | public double[] distributionForInstance(Instance instance) throws Exception {
//Definition of local variables
double[] probs = new double[m_NumClasses];
int sIndex;
double prob;
double condiMutualInfoSum;
// store instance's att values in an int array
int[] attIndex = new int[m_NumAttribut... |
174c75fe-7914-4062-82db-d2107148b745 | 6 | private float circleAround(float x, float y) {
/*
* use cross product of v and r
*/
Vector3d r = new Vector3d(flyingDot.p.x - x, flyingDot.p.y - y, 0);
float d = r.length();
//are we close ?
if (d > flyingDot.my_turn_radius * 3) return headTowards(x, y);
... |
a4a3a03b-abc9-4247-a050-b828859984f2 | 8 | public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
// Initialises the time left to play.
if(Settings.level == 1){timeLeft = 60;}
if(Settings.level == 2){timeLeft = 80;}
if(Settings.level == 3){timeLeft = 100;}
if(Settings.level == 4){timeLeft = 120;}
if(Settings.level == 5){timeLe... |
18a7d296-7070-4ed2-939d-2e2b5e44e58a | 6 | @Override
protected void enter() {
if (!ctx.players.local().inMotion() || ctx.movement.distance(ctx.movement.destination(), ctx.players.local()) < Random.nextInt(2, 5)) {
final GameObject door = ctx.objects.select().select(ObjectDefinition.name(ctx, "Door")).each(Interactive.doSetBounds(new int[]{0, 32, -240, 0, ... |
aae516ba-c43f-4457-8be8-a5b555e69955 | 4 | private void SendHTTPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SendHTTPButtonActionPerformed
String output = "";
String header = "";
String html = "";
int pos = -1;
try {
output = Attack.issueRequest(SQLInjectionAttackTextArea.getText(), jTextField2.getText(),... |
c3cdc6a4-e339-4938-a2ba-a47ca0cb63a5 | 3 | @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryDrag(InventoryDragEvent event) {
Player player = (Player) event.getWhoClicked();
// sprawdza czy to inventory tego pluginu
if(event.getInventory().getName().equalsIgnoreCase(this.plugin.dInvName)) {
... |
d425add9-611a-4928-b2a8-6bde64ed6d5c | 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... |
6a714599-3735-4578-ab50-7f20d0c2e9cf | 9 | private void faseEliminazioneGiocatore() {
statoDelGioco.setTipoFaseGiocoFamily(TipoFaseGiocoFamily.ELIMINAZIONE_GIOCATORI);
List<Giocatore>giocatoriDaEliminare=new ArrayList<Giocatore>();
for(int i=0;i<statoDelGioco.getGiocatori().size();i++){
if(statoDelGioco.getGiocatori().get(i).getDanari()<statoDelGioco.g... |
d78af2da-2762-4f3d-a2f9-491cb6c6cb7f | 2 | public E get(int index) {
if (index >= 0 && index < size) {
final E returnValue = (E) array[index];
return returnValue;
}
return null;
} |
65f11e37-2e54-4103-9134-cc077218b07f | 2 | public void visitJsrStmt(final JsrStmt stmt) {
print("jsr ");
if (stmt.sub() != null) {
print(stmt.sub().entry());
}
if (stmt.follow() != null) {
print(" ret to " + stmt.follow());
}
println(" caught by " + stmt.catchTargets());
} |
0f8dbd72-0239-4b69-b0a4-d7e9e7fc5d42 | 9 | private int numberInFamily(int pN){
int maxCount = 0;
int count = 0;
for(int p1 = 10; p1 < pN; p1*=10){
int digit1 = (pN%(p1*10)-pN%(p1)) / p1;
for(int p2 = 10;digit1 < 3 && p2 < p1; p2*=10){
int digit2 = (pN%(p2*10)-pN%(p2)) / p2;
for(int p3 = 10; digit1 == digit2 && p3 < p2; p3*=10){
int digi... |
ec728cb2-de42-4f16-8860-90380e0fafef | 1 | public Seance registerSeance(Seance seance) {
int index = seances.indexOf(seance);
if (index == -1) {
seance.setMovie(registerMovie(seance.getMovie()));
seance.setRoom(registerRoom(seance.getRoom()));
addSeance(seance);
return seance;
} else {
Seance foundedSeance = seances.get... |
e3386ab1-5ca7-4f59-a82d-befea7d1981d | 6 | @EventHandler
public void WitchMiningFatigue(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.getWitchConfig().getDouble("Witch.Mini... |
def55858-433c-4a29-bde1-32618f743975 | 2 | public Grid(int row, int column) {
rows = row;
columns = column;
cells = new Entity[rows*columns];
//Fill the grid with blank cells
int cellID = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.println("Cell ... |
1a8af6ff-4473-42c0-bbf0-ef2e37ebdadf | 2 | public boolean addBook(Book book){
String sql = "insert into book(id_book_catalogue,name,author1,"
+ "author2,author3,isbn,state) values(?,?,?,?,?,?,?)";
try{
int id_bc;
if(this.getIdBookCatalogue(book.getBookCatalogue()) == 0){
this.addBookCatalog... |
c2b5f186-9c6a-4f12-8ca7-269b6ddc13f5 | 5 | protected void handleConnection(Socket sock) throws IOException {
OutputStream out = new BufferedOutputStream(
sock.getOutputStream(), 4096);
InputStream in = new BufferedInputStream(sock.getInputStream(), 4096);
String connectionHeader;
do {
// create request and... |
bda5ba6d-92d5-493c-a2d6-4c15bd8cd121 | 6 | @Override
public Team[] balance(Player[] players) {
int playersByTeam = players.length / 2;
Team team1 = new Team(playersByTeam);
Team team2 = new Team(playersByTeam);
Arrays.sort(players);
int index = 0;
int indexT1 = 0;
int indexT2 = 0;
for (Player... |
c803273e-8701-4b26-ba75-8b408904f320 | 4 | public static Set<String> getAlreadyImplementedStepsFromFile(String fileAsString) {
// Here, we parse the steps file to get every step that is present in an annotation
Set<String> alreadyPresentsSteps = new HashSet<String>();
String[] lines = fileAsString.split("\n");
fo... |
59c0878a-ad97-4a2f-9f83-03fc3cb7c6be | 5 | public void addToWalkingQueue(int x, int y) {
int diffX = x - walkingQueue[wQueueWritePtr - 1].x, diffY = y - walkingQueue[wQueueWritePtr - 1].y;
int max = Math.max(Math.abs(diffX), Math.abs(diffY));
for (int i = 0; i < max; i++) {
if (diffX < 0)
diffX++;
else if (diffX > 0)
diffX--;
if (diffY < ... |
47181269-7717-4242-9bfc-2686da44bbc4 | 2 | private void reAssign(String identifier, TLValue value) {
if(variables.containsKey(identifier)) {
// The variable is declared in this scope
variables.put(identifier, value);
}
else if(parent != null) {
// The variable was not declared in this scope, so let
// the parent scope re-assi... |
c5b843bf-4ff1-410f-bcf5-380dedff8be8 | 3 | @Test
public void testMulti() throws InterruptedException {
Multi hello;
NodeBlock nb;
Multi res;
ByteBuffer bb;
int size;
Random ran = new Random();
for (int i = 0; i < 20; i++) {
byte[] buf = new byte[ran.nextInt(7200)];
ran.nextBytes(buf);
hello = new Multi(new Hello((byte) ran.nextInt(), ... |
cfb41981-e50e-4652-a37a-883b87c58a5e | 7 | public void go(){
// interpolation = true;
if (interpolation) {
// moveto
float normTime = (float) (System.currentTimeMillis() - starttime)
/ (float) duration;
x = (int) (startx + ((float) (destx - startx) * normTime));
y = (int) (starty + ((float) (desty - starty) * normTime));
// rotate
ang... |
76023ee6-ab49-48a6-a9da-4026ad4a4ea2 | 2 | public boolean validate(final String hex, String type) {
if(type.equalsIgnoreCase("email"))
matcher = EmailPattern.matcher(hex);
if(type.equalsIgnoreCase("username"))
matcher = UsernamePattern.matcher(hex);
return matcher.matches();
} |
aa339d3f-ade8-4edd-9a46-fb0cd3f3d9e6 | 5 | private void jbGoalKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbGoalKeyPressed
if (evt.getKeyCode() == KeyEvent.VK_G) {
jbGoalActionPerformed(null);
} else if (evt.getKeyCode() == KeyEvent.VK_M) {
jbHowToUseTheMapActionPerformed(null);
} else if (evt.getKe... |
9cbffe90-f3b0-400b-9e0f-2b6ca99d6f2c | 4 | public int loopDepth(final Block block) {
if (loopEdgeModCount != edgeModCount) {
buildLoopTree();
}
if ((block == srcBlock) || (block.blockType() != Block.NON_HEADER)) {
final LoopNode loop = (LoopNode) loopTree.getNode(block);
Assert.isTrue(loop != null, "no loop for " + block);
return loop.depth;
... |
3e967e94-212a-4724-900a-ae71383dd380 | 7 | public int run (CommandManager manager, Object... args) {
//Given that arguments are passed to the method
if(args == null || args.length == 0)
return -1;
//construct parameters.
String[] data = (String[]) args[0];
boolean verbose = args.length > 1 && args[1] instanceof Boolean ? (Boolean)args[1] : fa... |
58b3a10e-284a-42d7-b32f-5fecd200ab30 | 9 | public void openFile(File file) {
boolean enable = true;
this.edited = false;
this.hidePass = false;
this.makePass = true;
this.passLength = 8;
this.useLowerCase = true;
this.useUpperCase = false;
this.useNumber = true;
JAXBElement<Db> je = createXMLObject(file);
if (je != null) {
Db db = je.getV... |
b9ee379a-d1a4-475b-a241-1590d39cf0d8 | 4 | private static void talkToServer() throws IOException {
String option = null, message, response;
do {
/********************************************************
* CREATE A SOCKET, SET UP INPUT AND OUTPUT STREAMS, ACCEPT THE
* USER'S REQUEST, CALL UP THE APPROPRIATE METHOD (doSend OR
* doRead), CLOSE ... |
797f6978-ff13-4ecd-a9c1-c22f4d3de785 | 4 | private void sift(int l, int r){
int i, j, x;
i = l;
j = 2*i;
x = list.get(l);
while (j <= r) {
//Suche Minimum unter Kindern
if ((j < r) && (list.get(j+1)<list.get(j))){
j += 1;
}
//ggf. mit Eltern tauschen
if (list.get(j)< x) {
list.set(i, list.get(j));
list.set(j, x);
i... |
1a5bf996-e33d-4b07-b483-890b775f4dc2 | 9 | public static void main(String[] args) {
try {
Profile profile = new Profile();
JAXBContext context0 = JAXBContext.newInstance(Cv.class);
Marshaller m0 = context0.createMarshaller();
m0.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
Unmarshal... |
6acc6e68-156d-4eec-92d5-b0c14c67e2b5 | 4 | public void addComponent(GUIComponent component, int column, int row) {
super.addComponent(component);
if (column >= 0 && column < grid.getNumColumns() && row >=0 && row < grid.getNumRows()) {
cells[row][column].socket(component);
}
} |
20ecf0ac-cb19-4be2-9e44-c9b79244787d | 4 | public void updateCoupon(Coupon coupon) throws SQLException {
sql.query("UPDATE couponcodes SET usetimes='"+coupon.getUseTimes()+"' WHERE name='"+coupon.getName()+"'");
sql.query("UPDATE couponcodes SET usedplayers='"+plugin.convertHashToString2(coupon.getUsedPlayers())+"' WHERE name='"+coupon.getName()+"'");
sql... |
9545809a-b8fb-4abd-bb14-96d326ae6c57 | 6 | public static void main(String[] args) {
// Parse argument
FastqVariant fastqVariant = FastqVariant.FASTQ_ILLUMINA;
if( args.length > 0 ) {
if( args[0].equalsIgnoreCase("-phred33") ) fastqVariant = FastqVariant.FASTQ_SANGER;
else if( args[0].equalsIgnoreCase("-phred64") ) fastqVariant = FastqVariant.FASTQ_... |
7edd7b4e-8b8c-4256-9c4a-679eb0c9cd1b | 1 | public List<T> findByNamedQuery(String queryName,
Map<String, Object> attributes) {
Query query = em.createNamedQuery(queryName, entityClass);
for (String s : attributes.keySet()) {
query.setParameter(s, attributes.get(s));
}
return query.g... |
e2aefa5f-f83c-4424-bfbb-5458d8cd121b | 4 | public static void mettreAJourCarte() {
contenuPrincipal.centre.setVisible(false);
contenuPrincipal.centre.removeAll();
Iterator ite = lignes.entrySet().iterator();
while(ite.hasNext()) {
Map.Entry item = (Map.Entry)ite.next();
Ligne maLigne = (Ligne) item.getValue();
Vector<JLabel> labels = ma... |
5959bbf3-10e1-451b-ba44-fd1eb50de935 | 8 | private double localIEEEremainder(double f1, double f2) {
// return Math.IEEEremainder(f1, f2);
if (Double.isNaN(f1) || Double.isNaN(f2) || Double.isInfinite(f1)
|| f2 == 0) {
return Double.NaN;
}
if (Double.isInfinite(f1) == false && Double.isInfinite(f1) == true) {
return f1;
}
double d = 2 * ... |
5c0239ba-f007-4f9d-bd51-28cb7da27e02 | 9 | public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
float var4 = 1.0F;
float var5 = par3EntityPlayer.prevRotationPitch + (par3EntityPlayer.rotationPitch - par3EntityPlayer.prevRotationPitch) * var4;
float var6 = par3EntityPlayer.prevRo... |
aa08e596-9782-432f-81fc-956e814a98d9 | 2 | public ArrayList<BESong> searchSongs(String searchWord) throws Exception {
try {
if (m_songs == null) {
m_songs = ds.searchSongs(searchWord);
}
return m_songs;
} catch (SQLException ex) {
throw new Exception("Could not find the song...");
... |
17b30588-1d6f-405a-ac5d-ce2d0f0e6d84 | 8 | private void method393(int ai[], byte abyte0[], int i, int j, int k, int l, int i1,
int j1, int k1)
{
int l1 = -(l >> 2);
l = -(l & 3);
for(int i2 = -i1; i2 < 0; i2++)
{
for(int j2 = l1; j2 < 0; j2++)
{
if(abyte0[j++] != 0)
ai[k++] = i;
else
k++;
if(abyte0[j++] != 0)
ai[k++] = i;
else
k++... |
f1dc4de3-d9e1-4ddc-ac64-d23a8ea94692 | 8 | final public void Program_parameter_list() throws ParseException {
/*@bgen(jjtree) Program_parameter_list */
SimpleNode jjtn000 = new SimpleNode(JJTPROGRAM_PARAMETER_LIST);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
... |
25aebafd-9fc4-4c70-948b-5ed6d0dbcef6 | 4 | public void run(){
try {
// Java stupidity declaring objects for objects
out = new PrintWriter( client.getOutputStream(), true);
} catch(IOException e){
System.err.println("Failed to allocate resources to use Socket");
System.err.println(e);
Sy... |
89394eca-dab2-4411-be1d-11cadd97c5ed | 4 | public STTPoint getNextPoint() {
long timeSinceLastPull = System.currentTimeMillis() - this.lastDataPullTime.getTime();
if (timeSinceLastPull > this.pointPollingTimeMS) {
ArrayList<STTPoint> newData = this.wrapperReference.getWrappedData();
this.mostRecentPoints = newData;
this.lastDataPullTime = new Ti... |
5bd665fb-0baf-4609-9618-1fedf30876f3 | 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 Stock)) {
return false;
}
Stock other = (Stock) object;
if ((this.id == null && other.id != null) || (this.id !... |
a6dbd241-2ebb-435b-bf25-bd8e37273ff5 | 7 | private static void onBufferAllocated(Buffer buffer) {
/**
* StackTraceElement[] stackTrace = new Throwable().getStackTrace(); int
* initialIndex = 0;
*
* for (int i = 0; i < stackTrace.length; i++){ if
* (!stackTrace[i].getClassName().equals(BufferUtils.class.getNa... |
f04d7124-d2ee-40b2-902a-c2fd2bf3b527 | 7 | @Override
public void process(InputStream input, OutputStream outputStream) throws IOException
{
PrintWriter out = new PrintWriter(outputStream, true);
BufferedReader in = new BufferedReader(new InputStreamReader(
input));
String firstLine = in.readLine();
if (firstLine == null) {
return;
}
try... |
624eb5a6-a908-4ca4-9472-8a2858b7b44a | 5 | private void createSidesCombo(PrintRequestAttributeSet set) {
Sides[] sides = (Sides[]) mService.getSupportedAttributeValues(Sides.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (sides != null && sides.length > 0) {
HashSet<Sides> possible = new HashSet<>();
for (Sides one : sides) {
possible.add... |
7ef47531-2060-4f62-99be-397f75271670 | 8 | public String isPair(ArrayList<Card> aHand, ArrayList<Card> aTable) {
String returnString = "";
String[] cardRanks = new String[2];
// Build an array with the values of the player hand
for (int i=0; i < 2; i ++) {
cardRanks[i] = aHand.get(i).getRank();
}
// If you have a pocket pair
if (aHand.... |
612c6eac-50d8-4df3-b084-7fd016231db5 | 9 | @Override
public boolean perform(final Context context) {
// Example: /<command> pattern set[ <Player>] <Pattern>
if (context.arguments.size() < 3) return false;
OfflinePlayer target = Parser.parsePlayer(context, 2);
if (target == null && context.sender instanceof OfflinePlayer) tar... |
a4cba94d-59e8-4928-843b-6a871017aa59 | 0 | @Override
public String getName() {
return name;
} |
5752beb5-2dcc-40fb-a98f-552b9687ab6a | 4 | private final void checkForLocalChanges(final Git gitSession)
throws IOException, GitAPIException, InterruptedException {
this.io.startProgress("Checking repo for changes", -1);
boolean commit = false;
final Status status = gitSession.status().call();
stone.util.Debug.print("-----------\n" + "staged changes\... |
9dd702bc-4015-43f9-a9e8-ea3101b96fda | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TestInfo)) return false;
TestInfo testInfo = (TestInfo) o;
if (numberOfUsers != testInfo.numberOfUsers) return false;
if (!id.equals(testInfo.id)) return false;
if (!name.equa... |
08642419-5f20-4fd1-996e-457859608828 | 7 | private double[][] computePredictions(int index_to_change, boolean add) {
double[][] predictions = new double[m_models[0].length][m_models[0][0].length];
for (int i = 0; i < m_bagSize; ++i) {
if (m_timesChosen[i] > 0) {
for (int j = 0; j < m_models[0].length; ++j) {
for (int k = 0; k < m_models[0][j].... |
8853f66f-a9ce-4a4b-aa1b-05c2f83f5ff3 | 3 | @Post
public ExeReport createModel(User user) throws IOException {
if (user == null) {
return ExeReportHelper.getParamterError();
}
EntityManager em = emf.createEntityManager();
List<Long> ids = new LinkedList<Long>();
try {
em.getTransaction().begin();
em.persist(user);
em.getTransaction().c... |
39e2e9d2-3f00-4158-b013-d3201f1b50e0 | 6 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String add=ta1.getText();
String phone=t3.getText();
if(username.isEmpty())
{JOptionPane.showMessageDialog (this, "Please enter your Username");}
else... |
98a9ab39-345f-4dc6-99e8-91cf539d06d8 | 9 | public void move () {
char[][] gridCopy = game.getGrid();
if (enemySymbol == Grid.DEFAULT_CHAR)
setEnemySymbol(gridCopy);
if (haveVerticalLine(gridCopy, symbolForGame)) {
return;
}
else if (haveHorizontalLine(gridCopy, symbolForGame)) {
retur... |
184c7767-1ece-4987-a7e9-b34cde3cfcd4 | 0 | public String getZipCode() {
return zipCode.get();
} |
8c27fa8a-a27c-4b92-a202-5b7a4d74fb3f | 0 | public String getPartitaIva() {
return partitaIva;
} |
907b3c9b-5321-4f84-9430-f77be61e3648 | 8 | public static void main(String[] args) {
for (Player p : players) {
scores.put(p, 0);
}
for (int i = 0; i < players.length; i++) {
for (int j = i + 1; j < players.length; j++) {
if (VERBOSE) {
System.out.println(players[i] + " vs " + players[j]);
}
RPSGame g = new RPSGame(players[i], player... |
03cf2b19-62e6-436f-97fd-017caf03f573 | 9 | private void txtChatKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtChatKeyReleased
String msg = txtChat.getText();
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
if ("".equals(msg)) return;
int idx = msg.lastIndexOf(" ");
if (m_tabCount == 0) {
... |
42f88645-da93-4f63-9e70-4f0ec88bc255 | 1 | public static VersionPanel getVersionPanel() {
if (versionPanel == null) {
versionPanel = new VersionPanel();
}
return versionPanel;
} |
c183a3fa-34e1-4d21-b5f7-68889115ba76 | 4 | private int getBase(int n){
for (int i=2;i<=10;i++){
int temp = n;
while(temp>1){
if(temp%i != 0) break;
temp=temp/i;
}
if(temp == 1) return i;
}
return 0;
} |
25b7888d-9158-4578-876a-e2a2d5e7d9f8 | 2 | public int previousIndex() {
if (prev == null) {
return -1;
}
if (cache == null) {
cache = toArray();
}
return prev.index;
} |
7934e2ee-7c59-4cd3-87cf-34143afc0595 | 0 | public void mouseEntered(MouseEvent e) // not used
{
} |
676dc098-b435-461f-9820-a7fba6097b2a | 3 | @Override
public boolean saveSkinToDefaultDirectory(Skin skin) {
if (skin == null) {
IllegalArgumentException iae = new IllegalArgumentException("Invalid skin!");
Main.handleUnhandableProblem(iae);
}
boolean ret = true;
try {
skin.save(Constants.P... |
e27e9b6e-b6a6-47cd-a124-46349854468e | 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 OptionSemester)) {
return false;
}
OptionSemester other = (OptionSemester) object;
if ((this.id == null && othe... |
98fc51ed-58c6-4628-af78-5c8ca2873b20 | 7 | public String toString() {
try {
StringBuffer SB = new StringBuffer();
switch(type())
{
case STAYPUT:
return new String("Stay Put");
case WEST:
return new String("Moving West");
case EAST:
return new String("Moving East");
case NORTH:
re... |
03031b26-ea9a-481c-8a58-297e450da81d | 5 | @Override
public void addEdge(Vertex<T> source, Vertex<T> destination) {
if (!vertexes.containsKey(source)) {
throw new RuntimeException("There is no vertex in graph " + source);
}
if (!vertexes.containsKey(destination)) {
throw new RuntimeException("There is no ve... |
08dcc23f-5722-4172-97d6-6722b066d45d | 6 | public ArrayList<Map> getSaves() {
HashMap<String, Map> HMSaves = new HashMap<String, Map>();
ObjectInputStream ois;
Object objTemp = null;
File directory = new File("saves");
File[] list = directory.listFiles();
for (int i = 0; i < list.length; i++) {
if (list[i].getName().endsWith(".savj"))
try {
... |
95e39f4b-10da-4d08-9ebf-12ebe45ffd74 | 7 | private final static void startSongAnalysis(List<File> foundFiles, boolean hlEvaluation, boolean llEvaluation)
throws MasterException {
int cnt= 0;
try {
Iterator<File> iter= foundFiles.iterator();
while(iter.hasNext()) {
//create the list of tasks to do.
MasterMetadata.songTasks.add(new S... |
d6b65526-72f9-4b92-9dfa-8c5d6374b021 | 8 | public static int color(int what, int where, int how) {
// what
// 0 = basic
// 1 = button
// 2 = textArea
// 3 = checkBox
// where
// 0 = fill
// 1 = outline
// how
// 0 = passive
// 1 = over
// 2 = active
// 3 = selected
int color = 0x909090;
if (what == 0) color += 0x303000;
if (what ... |
4d4f6778-9a16-4074-acbd-75abda33df54 | 2 | public List<City> extractNodes(Document document){
List<City> result = new ArrayList<City>();
NodeList nodeList = document.getElementsByTagName("NODE_COORD_SECTION");
for(int i = 0; i < nodeList.getLength(); i++){
City city = new City();
Node node = nodeList.item(i);
Node index = node.getFirstChild();
... |
6478b3ca-c796-47b1-bcc3-141281e4ee56 | 7 | private void registerAllImages() {
name2Image = new Hashtable<String,Image>();
MediaTracker tracker = new MediaTracker(aComponent);
try {
java.net.URL _url = getClass().getResource(RESOURCE_PATH);
if ( _url == null ) {
throw new RuntimeException("ImageManager: URL/folder '"+
... |
1c431643-b07c-425c-aa15-c73042860e1d | 7 | public Object evaluate(Context c, HashMap map, DataFactory factory) {
IVPBoolean b = (IVPBoolean) ((DataObject)map.get(flowConditionID)).evaluate(c, map, factory);
Function f = (Function) map.get(c.getFunctionID());
if (c.getBoolean(b.getUniqueID())) {
for (int i = 0; i < children.size(); i += 1) {
DataObj... |
eec0767f-56b2-4802-ba4d-146cd811d026 | 3 | public void close(){
try {
if (statement != null) {
statement.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException e){
}
} |
bcaf00e7-afc2-4cc6-9add-667d3d70929f | 9 | private void persist(FinishedJobRecord r) {
StringBuilder sb = new StringBuilder("SELECT ");
sb.append(JOB_ID_COLUMN);
sb.append(" FROM ");
sb.append(FINISHED_JOBS_TABLE);
sb.append(" WHERE ");
sb.append(JOB_ID_COLUMN);
sb.append("='");
sb.append(r.job_num... |
579ed2ea-9d09-48ea-a937-361433f66cee | 8 | private void removeJob(ArrayList<String> players, String job, CommandSender sender) {
job = job.toLowerCase();
Iterator<String> it = players.iterator();
if(PlayerJobs.getJobsList().get(job) == null) {
sender.sendMessage(ChatColor.RED + _modText.getAdminCommand("exist", PlayerCache.... |
d83cf32b-6176-410a-bab6-e30f7a8b8f7c | 6 | public int getTriplet() {
int k = 0;
for (int i = 1; i < 1000; i++) {
for (int j = i + 1; j < 999; j++) {
k = (int) Math.sqrt(i * i + j * j);
if (i + j + k == 1000 && i < j && j < k) {
if (i * i + j * j == k * k) {
//System.out.println("i=" + i + " j=" + j + " k=" + k);
return i * j * k;... |
f4c88557-4f36-48c2-a768-e7565db9e25b | 1 | public void readFromFile(File file) throws FileNotFoundException, IOException{
BufferedReader reader = new BufferedReader(new FileReader(file));
String line;
while((line = reader.readLine())!=null){
String[] latlon = line.split(";");
this.points.add(new Position(new Double(latlon[0]), new Double(lat... |
c6954f7c-be05-40a1-b9fc-651a44ba0ded | 0 | private void initialize(){
new JFrame("Calculate Processing");
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
Dimension dimWindow = Toolkit.getDefaultToolkit().getScreenSize();
setSize(WINDOW_SIZE);
setLocation(dimWindow.width / 2 - getWidth() / 2, dimWindow.heigh... |
7f2e9207-cf9c-422b-8cdf-9c9a9b47ca1e | 1 | @Test(expected = MaxCapacityException.class)
public void maxCapacityTest() throws MaxCapacityException {
try {
Student testSt1 = familyService.findStudent(0);
Student testSt2 = familyService.findStudent(1);
DiningHall d1 = new DiningHall(1, BigDecimal.valueOf(4.00),
DiningHall.Type.MADRUGADORES);
... |
78de647d-930a-431d-b049-5bc1472de739 | 8 | public void Jouer() {
System.out.println("========================== Nouveau Tour ==========================");
afficherInfos();
for(Joueur j : this.joueurs){
int nbdoble=0;
j.avancer();
System.out.println("Tour de "... |
867eab16-10a8-43c3-9685-27d51d049920 | 3 | public Protocol(Class<? extends PacketHandler> handlerClass){
this.packets = registerPackets();
this.handlerClass = handlerClass;
for(Class<? extends Packet> type : packets.values()){
PacketInfo annotation = type.getAnnotation(PacketInfo.class);
packetInfos.put(type, ne... |
e9dd2a07-2976-4bc2-aa56-2384c728821f | 8 | private void setMimeTypes() {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) uri.toURL().openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/xml");
StringBuilder result = ... |
6e3dc14a-16cd-41bd-84a6-28749754f24a | 5 | public CutoffClause(Queue<Token> expression) {
if (expression.peek()!=null) {
boolean t = true;
while (t) {
t = false;
if (expression.peek()!=null) {
if (expression.peek().token == 3 || expression.peek().token == 10) {
... |
4045d318-7da7-42b9-a130-e6aafce67dab | 2 | public EmailTest() {
bigLocal = new String("a");
for(int i = 0; i < 70; i++)
bigLocal = bigLocal.concat("a");
bigDomain = new String("c");
for(int i = 0; i < 257; i++)
bigDomain = bigDomain.concat("c");
bigDomain = bigDomain.concat(".com");
} |
55be0978-6e0a-4aa9-95b9-6aa700486104 | 2 | private static List<GraphItem> createTestItems(){
List<GraphItem> result = new ArrayList<>();
for( int x = 0; x < 4; x++ ){
for( int y = 0; y < 4; y++ ){
ColoredRectangle rect = new ColoredRectangle( Color.GRAY );
FluentRectangularConnectionArray array = new FluentRectangularConnectionArray();
rec... |
2bb743ea-0ffb-4431-80d4-0c1f03ede7b9 | 3 | private JSONWriter end(char m, char c) throws JSONException {
if (this.mode != m) {
throw new JSONException(m == 'o' ? "Misplaced endObject." :
"Misplaced endArray.");
}
this.pop(m);
try {
this.writer.write(c);
} catch (IOException e) {
... |
a8d8e859-8225-488e-9d56-b67b6dcb792e | 4 | private boolean useRejuv(){
return Global.useRejuvenate && Methods.needToHeal() && ActionBar.getAdrenaline() == 1000 && ActionBar.getNode(0).canUse() &&
ActionBar.getNode(0).canUse();
} |
b1a9a249-4960-4a39-adb9-b43a1f7178dd | 1 | public HeapPriorityQueue( Comparator<E> compare ) {
if ( compare == null )
throw new NullPointerException();
heap = new gray.adts.heap.ArrayMinHeap<E>( compare );
} |
8531cd75-f453-4a23-bd41-3e3e7bf52f09 | 4 | @Test
public void testCalendarPanel()
{
try
{
JFrame newFrame = new JFrame("Calendar Test");
JPanel container = new JPanel();
FlowLayout panelLayout = new FlowLayout();
panelLayout.setHgap(0);
panelLayout.setVgap(0);
container.setLayout(panelLayout);
JScrollPane s = new JScrollPane(containe... |
ee17a6a6-cca3-4f2e-9a39-d0596dac0da1 | 6 | @EventHandler
public void GiantNausea(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.getGiantConfig().getDouble("Giant.Nausea.Dodg... |
ce7add4b-9ef7-450c-97a7-4f13f5f7e6cb | 7 | public static String posibilMoves() {
String list="";
for (int i=0; i<64; i++) {
switch (chessBoard[i/8][i%8]) {
case "P": list+=posibilP(i);
break;
case "T": list+=posibilT(i);
break;
case "C": list+=pos... |
749e5d42-5a7c-4763-9b2b-8a2428f1b022 | 0 | protected boolean hasPassed() {
return getCurrentFailure().equals(NO_FAILURE);
} |
921c9660-e415-47de-bd33-26af6b138927 | 5 | private int[] getValidPosition()
{
boolean bad = false;
int[] pos = new int[2];
//Zufaellige Position bestimmen
do
{
bad = false;
pos[0] = (int) (Math.random()*blaenge);
pos[1] = (int) (Math.random()*bbreite);
//Schnittpunkt mit den Linien pruefen
for(int i=0; i<Lines.size(); i++)
{
f... |
4453d0f2-e2ae-47a8-bd48-e5e8b6ec8834 | 4 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
deathState = buf.readByte();
if (deathState < 0)
throw new RuntimeException("Forbidden value on deathState = " + deathState + ", it doesn't respect the following condition : deathState < 0");
deathCou... |
e3f00a7a-4c80-4ebf-a62d-bf613ac3bd3a | 7 | @Override
public void update(long deltaMs) {
speed += maxAcceleration * accelerationRate * deltaMs;
if(speed > maxSpeed) {
speed = maxSpeed;
}
if(speed < 0) {
speed = 0;
}
float speedX = -(float)(speed * Math.cos(angleRad));
fl... |
1aa052d8-d15a-4051-8a7b-9e4fe22458ef | 2 | public void testGetField() {
TimeOfDay test = new TimeOfDay(COPTIC_PARIS);
assertSame(CopticChronology.getInstanceUTC().hourOfDay(), test.getField(0));
assertSame(CopticChronology.getInstanceUTC().minuteOfHour(), test.getField(1));
assertSame(CopticChronology.getInstanceUTC().secondOfMin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.