method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2c70fada-d434-470c-aeb6-f86ebf65ca24 | 3 | public BackGround(final JFrame frame, final String imageName ){
Container panel = frame.getContentPane();
try {
imageOrg = ImageIO.read(this.getClass().getResource("/Image/" + imageName));
image = imageOrg.getScaledInstance(panel.getWidth(), panel.getHeight(), Im... |
1222639b-d38d-40e5-aa5a-c4f219a863a6 | 9 | static void llenar(LinkedList<int[]> r, Pieza p, int vAbajo){
int v=vAbajo,x=vAbajo;
for(Pieza m=p;m!=null;m=m.piezas[(x+1)%4]){
r.add(new int[]{m.valor,v});
int i=0;
if(m.piezas[(v+1)%4]!=null)for(;i<4;i++)if(m.piezas[(v+1)%4].piezas[i]==m)break;
x=v;
v=(i+1)%4;
}
v=vAbajo;x=vAbajo;
for(Pieza ... |
ec189768-89dd-4111-af97-a81044622cbe | 6 | private void runStateMachine() {
while(!tokenFoundFlag){
if(exitSMFlag)
break;
switch(nextState){
case 1: // letter
letter();
break;
case 2:
symbol();
break;
case 3:
number();
break;
case 4:
otherChar();
break;
}
}
}// end of "runStateMachine" |
dc880ece-3d13-4964-89fe-64dbf9b11063 | 4 | private static void validate(String input) throws Exception {
if (input.length() > MAX_LENGTH)
throw new Exception("word can be no longer than 30 characters");
Set<Character> set = new HashSet<Character>();
for (int i = 0; i < input.length(); i++) {
set.add(input.charAt(i... |
fb24e808-b25c-4716-b6dc-7cf7ec5c49be | 0 | public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return code;
} |
bc6b3fcf-f6a0-419b-b375-0a7b45efb726 | 3 | public static boolean isInRange(float num, float max, float min, boolean showError)
{
final boolean bool = false;
if (num > max || num < min) if (showError)
{
final IllegalArgumentException as = new IllegalArgumentException("The Number Has to be more than " + max + " and less than " + min + "!");
as.print... |
8de26029-ed72-446d-98c6-78801c57814d | 4 | public void shootAt(Robot paramRobot, Point paramPoint) {
Debug.println("shootAt(" + paramPoint + ")");
this.RobotsWereShootingAt.addElement(paramRobot);
paramRobot.playSound("Robot-Angry");
if (!this.active)
{
Point localPoint1 = getPosition().getMapPoint();
localPoint1.translate(1, ... |
7e2585c7-c16a-40b4-88bb-95b7135005c8 | 3 | private static void launchLoginPage() {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop()
.browse(new URI(
"https://www.freesound.org/apiv2/oauth2/logout_and_authorize/?client_id=608002b12fb0074895d5&response_type=code&state=xyz"));
} catch (IOException e) {
e.printStackTrace... |
0eac11e8-62c5-4270-9091-83b95d5f5e77 | 6 | public static void drawPixels(int i, int j, int k, int l, int i1)
{
if(k < topX)
{
i1 -= topX - k;
k = topX;
}
if(j < topY)
{
i -= topY - j;
j = topY;
}
if(k + i1 > bottomX)
i1 = bottomX - k;
if(j + i > bottomY)
i = bottomY - j;
int k1 = width - i1;
int l1 = k + j * width;
for(i... |
09c9b6d3-989d-41f3-bdf5-5981602b187e | 1 | public void setId(int id) throws ErroValidacaoException {
if(id >0) {
this.id = id;
}
else {
throw new ErroValidacaoException("O id não pode ser menor que 0 !");
}
} |
a1191ba2-3ab8-487b-a103-06572080f32f | 1 | public static void validateMove() {
if (!validMove) {
System.out.println("Invalid Move! Try Again");
System.out.println();
} else {
moves = moves + 1;
points = points + 5;
AchievementRatio = points / moves;
}
} |
808cac27-86f0-4507-9839-1f07f1722259 | 9 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BoundaryBoxFilter)) return false;
BoundaryBoxFilter other = (BoundaryBoxFilter) o;
if (!this.fieldName.equals(other.fieldName)
|| this.includeLower != other.includeLower
|| this.incl... |
466de1a9-c2c3-40a9-a5f2-e30dc040bcae | 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... |
65996dfa-af2c-4ad6-b188-4b6451c8e1b2 | 4 | public int checkMouseCollision(Point clickedPoint) {
double d0 = points.get(0).getDistanceTo(clickedPoint);
if (d0 <= Constants.POINT_RADIUS) {
return 0;
}
double d1 = points.get(1).getDistanceTo(clickedPoint);
if (d1 <= Constants.POINT_RADIUS) {
return 1;
}
double d2 = points.get(2).getDistanceTo(c... |
fa325955-1caf-4aae-a1f0-4595f5248033 | 8 | public void update(double elapsed) {
this.elapsed += elapsed;
while (this.elapsed > MOVE_TIME_MILLS) {
this.elapsed -= MOVE_TIME_MILLS;
for (GameElement element : gameElements) {
element.colides(schlange);
}
schlange.move();
}
//check if there are c... |
a5c140fb-c582-44a0-bff1-1e1a1ebee0d1 | 8 | public void validateEventStructure(String eventName, List<MMTFieldValueHeader> fieldValueElements) throws MMTInitializationException {
if (this.getProtoConfig() == null) {
throw new MMTInitializationException("Initialization Exception: getProtoConfig() returns null. A valid MMTRemoteProtocolConfig m... |
3586a9c3-dd49-4a4e-869e-323fae9bce72 | 6 | public int[] rangeOfBST(TreeNode root) {
int []result = {root.val,root.val};
if(root.left !=null){
int []range = rangeOfBST(root.left);
if(range[0]<=range[1]&&range[1]<root.val){
result[0]=range[0];
}
else {
result[0] = 1;re... |
4412d14d-929d-490c-a6e6-cb0cc9b747d6 | 9 | @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
if (!(value instanceof TreeItem)) {
setText(value.toString());
setBackground(isSelected ? _enabledSelectedBackgrou... |
2901d76d-66c6-461c-9268-d4f0733efffc | 7 | public void createGlobalItem(GroundItem i) {
for (Player p : Server.playerHandler.players){
if(p != null) {
Client person = (Client)p;
if(person != null){
if(person.playerId != i.getItemController()) {
if (!person.getItems().tradeable(i.getItemId()) && person.playerId != i.getItemController())
... |
b8483f6f-768f-452c-8154-861551b4cd55 | 1 | public boolean tienePrevio(){
boolean resp = false;
if(previo != null)
resp = true;
return resp;
} |
002d15d0-1e9a-4409-b422-1bcf3e399156 | 4 | @Override
public void moveCursor(int x, int y)
{
if(x < 0)
x = 0;
if(x >= size().getColumns())
x = size().getColumns() - 1;
if(y < 0)
y = 0;
if(y >= size().getRows())
y = size().getRows() - 1;
textPosition.setColumn(x);
... |
3789024e-331b-43e7-884d-55c0865d4d38 | 9 | private static int index(char c) {
switch (c) {
case '*':
return 0;
case 'S':
return 1;
case 'I':
return 2;
case 'V':
return 3;
case 'X':
return 4;
case 'L':
... |
f24c898e-e92f-4bf9-bbfb-ce8c5736846e | 6 | public void paintComponent(Graphics g){
super.paintComponent(g);
g.clearRect(0, 0, getWidth(), getWidth());
int height = engine.area.length;
/* if(height * cellSize >= this.getHeight()){
height = (int) Math.floor(this.getHeight()/cellSize);
}*/
int width = engine.area[0].length;
/* if(width * ce... |
ade4f2b4-c918-41ff-9bb0-1529fec1c93c | 0 | public int getColumnCount() {
return 3;
} |
6e7613b9-c001-41e6-8c62-fd9713876c74 | 8 | public static void main(String[] args) {
Scanner myScan = new Scanner(System.in);
System.out.print("Veuillez entrez vos symptomes: ");
String descripMaladie = myScan.nextLine().toUpperCase();
String msgDocteur;
if (descripMaladie.contains("TOUSSE") && descripMaladie.contains("SANG")) {
msgDocteur = "Tube... |
67998b97-e53a-4014-a1fc-1e26400a5cce | 3 | public boolean hasFlag (Integer id, Variables flag) {
if (npcData.containsKey(id + ":flag")) {
String[] flags = npcData.get(id + ":flag").split(",");
for (Integer i = 0; flags.length > i; i++) {
if (flags[i].equals(flag.toString()))
return true;
... |
27c692e5-fdd8-40e4-904d-1355b1db4370 | 1 | public String toString()
{
if (nome != null)
return nome.toString();
return id + "";
} |
559f0b3f-a5f3-4ae0-b1ed-19d3f715472e | 8 | public void tick()
{
try {
player.tick();
} catch (InterruptedException e) {
e.printStackTrace();
}
sun.tick();
wife.idle();
par.tick();
sad.tick();
/*The Bottom Bounding boxes */
//stop1 = new Rectangle(122, 725, 256, 40);
stop2 = new Rectangle(350, 440, 256, 10);
stop3 = new Rectangle(... |
563b3a27-45e2-48e1-83c2-01a3ac25a997 | 9 | private void animate() {
if (startGameImage.contains(currentMouseX, currentMouseY)) {
animationIsRunning = true;
if (levelSelectAnimation != null) {
remove(levelSelectAnimation);
}
if (levelEditorAnimation != null) {
remove(levelEditorAnimation);
}
startGameAnimation = new RingAnimation(sta... |
c9ed8e6a-f87d-4302-96ba-90c421ee8023 | 7 | public boolean addFrame(BufferedImage im) {
if ((im == null) || !started) {
return false;
}
boolean ok = true;
try {
if (!sizeSet) {
// use first frame's size
setSize(im.getWid... |
12a8c5f9-a2e8-4fd2-8a4d-cc6ae712ce65 | 3 | public int buildAndStartNewPipelineFromGson(GsonNewPipelineRequest request) {
LatLong boundingBoxNW = new LatLong(request.NWlat, request.NWlong);
LatLong boundingBoxSE = new LatLong(request.SElat, request.SElong);
GeoParams geoParams = new GeoParams(request.resolutionX, request.resolutionY, boundingBoxNW, boun... |
14f6b0b3-5658-435e-a5f9-a451636c88e2 | 7 | public void pickupItems(int numberOfItems, float maxDistance) throws IOException {
int itemsPicked = 0;
long startDeadlockCheck = System.currentTimeMillis();
do {
float[] itemAgentIdAndDistance = this.getNearestItemToAgentEx(-2);
long currentlyElapsedTime = System.curr... |
fbeb5eae-0325-48c6-b176-952b94e39b3d | 6 | public boolean equals(Spire s) {
if ((s.getX() == this.x) && (s.getY() == this.y) && (s.getZ() == this.z) && (s.getXs() == this.xs) && (s.getYs() == this.y) && (s.getZs() == this.zs)) {
return true;
}
return false;
} |
503b726b-7427-4e87-aaa2-a2669feef687 | 0 | public boolean isAnimating() {
return animating;
} |
778475bc-76d1-49ba-9889-2b95c2f5753c | 1 | public static List<Word> parseWords(String sentence) {
List<Word> words = new ArrayList<>();
String[] strings = sentence.split("\\s+");
for (String string : strings) {
words.add(new Word(string));
}
return words;
} |
8abf9771-477a-409e-a2dd-982d9742a339 | 3 | protected void search(String fileName){
startOutput(fileName);
while(!cobweb.getUnsearchQueue().isEmpty()){
final WebPage wp = cobweb.peekUnsearchQueue();// 查找列隊
if (!cobweb.isSearched(wp.getUrl())) {
try {
leavesContentFileWriter.write(CrawlResultFormat.webPageHead(wp));
leavesContent... |
63bc274c-db90-48b6-8677-ddcf82088096 | 9 | private void locateNext() {
hasNext = true;
pos += value.length();
int i = -1;
int iOr = lowered.indexOf("or", pos);
int iAnd = lowered.indexOf("and", pos);
if (iOr != -1 && iAnd != -1)
i = iOr < iAnd ? iOr : iAnd;
else if (iOr != -1)
i = iOr;
else if (iAnd != -1)
i = iAnd;
... |
ef4b1541-b284-4e8a-8f21-bfc77a11e679 | 4 | public static TriCubicSpline[] oneDarray(int nP, int mP, int lP, int kP){
if(mP<3 || lP<3 || kP<3)throw new IllegalArgumentException("A minimum of three x three x three data points is needed");
TriCubicSpline[] a = new TriCubicSpline[nP];
for(int i=0; i<nP; i++){
a[i]=TriCubicSpline.ze... |
e6929368-aaff-4afc-ad71-9505cfba5330 | 5 | public static double NeedlemanWunsch(String mSeqA, String mSeqB) {
final int L1 = mSeqA.length();
final int L2 = mSeqB.length();
int[][] matrix = new int[L1 + 1][L2 + 1];
for (int i = 0; i < L1 + 1; i++)
matrix[i][0] = -1 * i;
for (int j = 0; j < L2 + 1; j++)
matrix[0][j] = -1 * j;
for (int i = 1; i <... |
4d15b809-fbca-4872-88ce-5140105bc256 | 0 | @Before
public void setUp() {
} |
a3bc6295-92b2-49eb-9dff-f436725b35ec | 1 | public static void printToConsole(String text) {
for (String line : text.split("\n")) {
log.info(line);
}
} |
b5577f01-63b5-4b6e-8e07-43c5ca047ae9 | 7 | public void followingItem(Item I)
{
if(I.container()!=null)
I.setContainer(null);
final Room R=CMLib.map().roomLocation(I);
if(R==null)
return;
if(R!=lastOwner.location())
lastOwner.location().moveItemTo(I,ItemPossessor.Expire.Never,ItemPossessor.Move.Followers);
if((inventory)&&(R.isInhabitant(la... |
06a01293-8ef1-42ed-9cb1-754c2b780f00 | 7 | private void AddbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbtnActionPerformed
int Fi = Table.getSelectedRow();
if (Fi < 0) {
String Mensaje = "Elija Un Producto Antes de Continuar,"
+ "o elija menos de dos productos";
JOptionPan... |
8664186c-a549-4c66-9545-558b3f4a9ab6 | 5 | private void checkShowWelcomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkShowWelcomeActionPerformed
File config = DFAMainWin.getConfigFile();
if(checkShowWelcome.isSelected()) {
if(config.exists()) {
//delete
if(!config.delete()) {
... |
1739830e-07e2-4041-a749-d33e6247f7d7 | 1 | public String worstQuestion()
{
if(questionStats.size() > 0)
{
QuestionStatistic min = Collections.min(questionStats);
return min.questionText + ", " + min.correctAnswers + " times.";
}
return "no statistics found!";
} |
542fa658-db31-4132-851d-315d574fcd05 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i =... |
366347f2-a8e2-4f05-8f73-07cd5f8ef758 | 8 | public final void write(DataOutputStream out) throws IOException {
_debug.fine("Anmeldelistentelegramm versenden: ", this);
out.writeShort(length);
out.writeBoolean(delta);
out.writeLong(transmitterId);
if(objectsToAdd == null) {
out.writeShort(0);
}
else {
out.writeShort(objectsToAdd.length);
fo... |
7bbf312c-a45e-4792-9775-03f5aa606f97 | 6 | public static void cleanDirectory(final File directory) throws IOException {
if (!directory.exists()) {
final String message = directory + " does not exist";
throw new IllegalArgumentException(message);
}
if (!directory.isDirectory()) {
final String message =... |
eb03e606-c7df-48d1-87bd-c158af677cf7 | 9 | public Sequence getSubsequence(Nucleotide aStartNucleotide,
Nucleotide anEndNucleotide) throws NonConsecutiveNucleotideException {
if (!this.containsNucleotide(aStartNucleotide)
|| !this.containsNucleotide(anEndNucleotide)) {
return null;
}
if(aStartNucleotide.compareTo(anEndNucleotide) == -1 ){
r... |
b8c33d97-d59a-430c-ba22-8ee6cd1a1f74 | 3 | public void init(int nplayers, int[] pref) {
this.preferences = pref.clone();
this.id = this.getIndex();
this.players = nplayers;
this.maxBowls[0] = this.players - this.id;
this.maxBowls[1] = this.id + 1;
//System.out.println("Player ID: " + this.id);
//System.out.println("Max bowls can be seen: Round 0: ... |
0aaab115-8f5e-4a86-879d-a7dafbc57bfa | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
2b3527a6-0db6-48b0-9a5d-ca25a6ca9cdd | 2 | @Override
public void Insertar(Object value) {
Session session = null;
try {
Ejecutivo ejecutivo = (Ejecutivo) value;
session = NewHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(ejecutivo);
... |
d059124c-bb28-41e5-be3c-5a0027fdbf06 | 8 | public boolean addSkillXP(int amount, int skill){
if (c.expLock) {
return false;
}
if (amount+c.playerXP[skill] < 0 || c.playerXP[skill] > 200000000) {
if(c.playerXP[skill] > 200000000) {
c.playerXP[skill] = 200000000;
}
return false;
}
amount *= Config.SERVER_EXP_BONUS;
int oldLevel = getLe... |
6988a7f2-8f37-48d3-96ed-722c91b8b03f | 5 | public static boolean pointIsWithinSectorAngleBoundries(Point2D.Double p, Point2D.Double origo,
double angle1, double angle2) {
// System.out.println("Point: "+p.getX()+"-"+p.getY());
// System.out.println("Heuristic origo: "+origo.getX()+"-"+origo.getY());
// System.out.println("Vector: "+angle1+ "===== sector:... |
f88cda2a-665c-46bc-bfcd-94eadf4cfdc6 | 0 | @Test
public void EnsureLeadingAndTrailingSlashIsRemoved() {
String path = "/x/y/";
String newpath = Path.trimSlashes(path);
assertEquals("x/y", newpath);
} |
c82af268-89e8-4817-9d9e-9572e1eeeaf7 | 0 | public int getCoordonneeY() {
return y;
} |
f2bbeda6-66e4-4f6e-875b-6c42ca01b3f1 | 7 | public void write(Writer out) throws IOException {
out.write(HEADER);
Object[] sumval = {result,
totalTime,
numTestTotal,
numTestPasses,
numTestFailures,
numCommandPasses,
numCommandFailures,
... |
37bda6e7-8cff-4271-b01f-2a9b69aa922b | 1 | public java.io.Serializable readAutomaton(Node parent, Document document) {
Set locatedStates = new java.util.HashSet();
Automaton root = createEmptyAutomaton(document);
if(parent == null) return root;
readBlocks(parent, root, locatedStates, document);
// Read the states and transitions.
readTransitio... |
6557a257-8207-46e6-8c41-adb7fdc266fb | 5 | private static void input(String[] args) throws Exception {
// argument checking
if (args.length > 0) {
if (args[0].equals("-h")) {
System.out.println("**HELP MENU**");
System.out.println("tf2mapgen <filename>");
System.out.println("output is s... |
f6a471b0-508c-4b42-9318-7a398691ebcf | 7 | public boolean hasCoupPossible() {
for (Case caseDame : tablier.getAllCase()) {
if((!tablier.isDameDansCaseBarre(joueurEnCour) && caseDame.getCouleurDame() == joueurEnCour)
|| caseDame.isCaseBarre())
for (DeSixFaces de : deSixFaces) {
if(!de.isUtilise())
if(isCoupPossible(caseDame,tablier.getCa... |
b2ecf61f-0c73-49fb-9ec6-3cbdc69f2d45 | 5 | @Override
public synchronized void writeCreditTransactionToFile(Transaction transaction) {
if (creditCounter % BATCH_SIZE == 0 && creditCounter > 0) {
String newCreditFileName = this.reportDao.getCurrentFileName(TransactionType.CREDIT.toString(),
creditFileName);
if (!newCreditFileName.equalsIgnoreCase(c... |
30102c50-610d-47e2-b17c-e15192aa1902 | 4 | public static void call(final String data) throws Exception {
// delimited by a comma
// text qualified by double quotes
// ignore first record
final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(data), ',', '\"');
final DataSet ds = pzparser.pa... |
395bd905-a010-4d54-852e-1941bca5a977 | 9 | @Override
public void run(String arg)
{
int numImages = WindowManager.getImageCount();
if( numImages == 0 )
{
IJ.error( "Geodesic reconstruction 3D",
"At least one image needs to be open to run Geodesic reconstruction in 3D" );
return;
}
String[] names = new String[ numImages ];
... |
aef6b823-427a-46ad-90fc-28a0c8357f53 | 3 | public static void castVote(VoteCast vote){
if(vote == VoteCast.A) A+=1;
else if(vote == VoteCast.B) B+=1;
else if(vote == VoteCast.R) R+=1;
updatePlayerReadout();
} |
b1e67bdb-1457-4f81-9b3e-1f287732cc3f | 2 | private void btnExcelExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcelExportActionPerformed
String input = Utils.showFileChooser("Opslaan", "Rooster");
if (!input.isEmpty()) {
boolean inverted = Utils.promptQuestion("Wilt u de tabel omgedraaid of precies zoals... |
e03628fe-e046-4e88-b8d1-50f419dd5d2f | 9 | public void personDetailsForm() {
super.personDetailsForm();
vatNumber = null;
contactName = null;
// Contact name
if (!contactNameField.getText().equals("")) {
contactName = contactNameField.getText();
contactNameLabel.setForeground(Color.black);
}
else {
errorMessage = errorMessage + "Contact... |
ad824341-456a-4e16-9af1-7110caf603e8 | 3 | public void removeTask(int taskEntID) {
Task toRemove = null;
synchronized (tasks) {
for (Task t : tasks) {
if (t.getEntityID() == taskEntID) {
System.out.println("TASK TO REMOVE FOUND");
toRemove = t;
}
... |
2974a337-9ec5-48f7-ac43-7bd37d4ab0e5 | 2 | public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject o = new JSONObject();
XMLTokener x = new XMLTokener(string);
while (x.more() && x.skipPast("<")) {
parse(x, o, null);
}
return o;
} |
30a1aac7-f98e-4d3a-8843-37d206e87eb7 | 0 | public Hashtable<String, K> getCodes() {
return codes;
} |
2d7e870d-16fe-47b6-858a-76ba97fdb4a0 | 4 | @Override
public void render()
{
double[] pos;
float[] color;
double size;
double angle;
int numVerts_ = 8;
GL11.glBegin(GL11.GL_TRIANGLES);
for(int i = 0; i < MAX_PARTICLES; i++)
{
color = getCRule(cID_[i]).getColor(r_[i], g_[i], b_[i], a_[i], age_[i], props_[i]);
size = getSRule(sID_[i]).getSi... |
42af71f8-eac2-4229-9e30-e79d8141b0b1 | 6 | private void sendPackage(String type, String... item) {
if ( (manager.getCurrentStage() != null && !manager.isStageItemsEmpty()) || type.equals(OVERLAY) ){
//printStage();
IsaacGamePackage isaacPackage = manager.createGamePackage(type, item);
try {
if (isGameActive()) {
queue.put(isaacPackage); // b... |
9b8667e9-8926-49cf-8e34-147332f578bc | 6 | public static void minmaxBonus(Manager[] a, Pair<? super Manager> result)
{
if (a == null || a.length == 0) return;
Manager min = a[0];
Manager max = a[0];
for (int i = 1; i < a.length; i++)
{
if (min.getBonus() > a[i].getBonus()) min = a[i];
if (max.getBonus() < a[i].... |
4568cb3a-80ea-415d-a5e9-f27ab38013ca | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NucleotideInteraction other = (NucleotideInteraction) obj;
if (firstNucleotide == null) {
if (other.firstNucleotide != null)
return false;... |
0a5961f4-92c2-4ae9-9410-a677dc2f33f2 | 8 | @Override
public boolean evaluate(RuleContext ruleContext)
{
BigDecimal lhs = new BigDecimal(mValues.get(0).asString(ruleContext));
BigDecimal lower = new BigDecimal(mValues.get(1).asString(ruleContext));
BigDecimal upper = new BigDecimal(mValues.get(2).asString(ruleContext));
boolean result = fals... |
eed052eb-5227-4e1d-917d-993659b889da | 5 | protected void renameProfile() {
boolean doit = true;
for(int i=profiles.size()-1; i>=0; i--) {
Profile p = profiles.get(i);
if(p.name.equals(txtProfile.getText())){
doit = false; //if we find a duplicate name, don't do it!
}
}
if(doit){
selProfile.name = txtProfile.getText();
profileListMdl.... |
e590239b-982b-4b08-8aff-4849786f1448 | 1 | @RequestMapping("/listarStock")
public ModelAndView listarStock() {
Stock stock = Stock.getInstance();
Map<String, Integer> mapStock = stock.obtenerStock();
Set<String> setStock = mapStock.keySet();
List<Producto> productList = new ArrayList<Producto>();
for (Iterator<String> iterator = setStock.... |
80c3733f-c226-41af-84c9-97ce7ed99641 | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
95d118e8-620b-41b0-8a1e-7eeb9e91d50d | 9 | public ArrayList<ArrayList<Integer>> subsetsWithDup(int[] num) {
ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
if (num == null)
return res;
if (num.length == 0) {
res.add(new ArrayList<Integer>());
return res;
}
Arrays.sort(num);
for (int ... |
651fe43e-8c3b-4b25-8803-99a931666c36 | 9 | private BigInteger[] getPrimesParallel(int keyBitSize) {
GenPrimeThread[] primeThreads = new GenPrimeThread[cores];
BigInteger[] primes = new BigInteger[cores];
BigInteger[] retPrime = new BigInteger[2];
for (int i = 0; i < cores; i++) {
primeThreads[i] = new GenPrimeThread... |
b87c7b38-dd1d-4062-994c-d6536fa82a98 | 5 | private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
if (!txtCaminhoBanco.getText().isEmpty() && (txtCaminhoBanco.getText().contains(":/") || txtCaminhoBanco.getText().contains(":\\"))) {
JTextField pwd = new JPasswordField(10);
JLabe... |
549676d3-2277-441d-9619-44beb41603ba | 7 | private double classificationConverter(String classification)
{
double convertedClassification;
if (classification.equals("Definitive"))
convertedClassification = 1.0;
else if (classification.equals("Dependent"))
convertedClassification = 2.0/3.0;
else if (cla... |
5effb2a1-b39f-4993-aeae-44bd937ff936 | 7 | public static int GetCurrentSecondHighActivatedNodeAL(){
//功能:
//得到当前激活强度次高的节点的激活强度
int low=0;
int GraphSize=CognitiveGraph.size();
Vector<Integer> useforsort = new Vector<Integer>();
for(int i=0;i<GraphSize;i++){
int ListSize=CognitiveGraph.get(i).ObjOrAttri.size();
for(int ii=0;ii<ListSize;ii++){
... |
0fa9f7d2-4d16-4bd7-873a-034024dae40a | 6 | public static ScoringStyle parseStyle(String styleString) {
if (styleString.contains("PERCENT_SCORE")) {
return PERCENT_SCORE;
} else if (styleString.contains("BULLET_DAMAGE")) {
return BULLET_DAMAGE;
} else if (styleString.contains("SURVIVAL_FIRSTS")) {
return SURVIVAL_FIRSTS;... |
a68381cd-99e2-48b6-a46b-4835476247ed | 8 | private StringBuilder hexToString(StringBuilder hh) {
// make sure we have a valid hex value to convert to string.
// can't decrypt an empty string.
if (hh != null && hh.length() == 0){
return new StringBuilder();
}
StringBuilder sb;
// special case, test fo... |
66a99e89-5db1-4080-b9be-8072e06dfe67 | 6 | public ReaderConfig(ResourceBundle resourceBundle) {
Enumeration<String> fileContext = resourceBundle.getKeys();
while (fileContext.hasMoreElements()) {
String element = (String) fileContext.nextElement();
if ("storiesNumber".equals(element)) {
storiesNumber = Integer.valueOf(resourceBundle
.getStri... |
c722a6dc-bf89-4c02-aa0a-7c93bc297dcc | 7 | public void moveleft(){
switch (polygonPaint) {
case 0:
line.moveLeft();
repaint();
break;
case 1:
curv.moveLeft();
repaint(... |
60f12eb0-6d8d-4a4e-a632-d51a152adeff | 8 | @Override
public T askChoice(boolean cancel) {
String playerName = control.getPlayer().getName();
System.out.println(playerName + ", " + promptMessage);
int choice = -1;
int cancelChoiceNb = control.getChoices().size() + 1;
int maxSize;
if (cancel) {
maxSize = cancelChoiceNb;
} else {
maxSize = co... |
36d5b8ec-d0b1-490c-a964-73a574b874a2 | 8 | public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... |
6384837f-cf6a-4a45-94cd-14ef1dc31a82 | 1 | @Test
void testA() {
if (true)
throw new RuntimeException("This test always failed");
} |
a93ee3e2-204d-4582-8645-103847793150 | 1 | public void generateNodes(int number)
{
for(int i=0;i<number;i++)
{
Node n = new Node(i);
this.nodes.add(n);
}
} |
8f32b9e9-7bd7-434d-9124-1865859dfd99 | 7 | public int [][] loadTrainData (String fileName) {
System.out.println ("Load Train Data Start!");
wordMapping = new HashMap <String,Integer> ();
BufferedReader reader = null;
int trainData [][] = null;
try {
File file = new File (fileName);
reade... |
5cb775b5-22e7-40c8-a774-aa1704580be4 | 9 | public static void main (String [] args) {
double salarioatual,salarionovo;
char salario ;
Scanner teclado = new Scanner(System.in);
System.out.print("Informe o seu salario para saber qual foi o aumento:");
salarioatual = teclado.nextInt();
if (salarioatual >0 && salarioatual <=1499){
salarionovo = ... |
eef50261-6ce5-424c-a9a3-833026d6cfd1 | 5 | public MenuItem getDisplayMenu() {
if (displayMenu == null) {
displayMenu = new Menu("Display");
// Create listener for Display menu items.
ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
MenuItem item = (MenuItem) e.getSource();
if ("Error".equals(... |
7d719ecc-6a76-4a41-87a9-dd001c9b9182 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idPeriferico != null ? idPeriferico.hashCode() : 0);
return hash;
} |
2656c172-a4cb-4c8f-a2e0-5d376ddbf316 | 8 | private void unpackBigPacket(DemultiplexerStreaminformations stream) throws InterruptedException {
// Nutzdatenpakete (das können mehrere sein) und der Paketindex(des großen Pakets) stehen nun zur Verfügung.
// Genau an dieser Stelle greift der Thread auf eine Queue zu, die ihn schlafen legt, wenn KEIN Paket vorha... |
d32c5ccf-9af8-4d11-936f-2faf7d216694 | 3 | public static String right(String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return EMPTY;
}
if (str.length() <= len) {
return str;
}
return str.substring(str.length() - len);
} |
04c6f26b-158f-4cf3-9008-f787c9c796cd | 4 | private static void setIsPrime() {
for(int i = 2; i < isPrime.length; i++)
isPrime[i] = true;
for(int i = 2; i < isPrime.length; i++)
if( isPrime[i] )
for(int j = 2; j*i < isPrime.length; j++)
isPrime[i*j] = false;
} |
5c9c1983-fe65-4b7c-8481-225a6e718433 | 7 | public void render(){
//BS
bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
//END BS
Graphics g = bs.getDrawGraphics();
if(gameState == GameState.MENU) g.drawImage(menuImage, 0, 0, getWidth(), getHeight(), null);
else g.drawImage(level.getDojoImage(), 0, 0, getWidth... |
da82ed7f-6eed-42a5-a026-0fd4a88c593d | 4 | private void process(Transferable t) {
final DataFlavor df = DataFlavor.stringFlavor;
if (t.isDataFlavorSupported(df)) {
try {
BufferedReader r = new BufferedReader(df.getReaderForText(t));
String line;
while ((line = r.readLine()) != null) {
... |
4d07f57c-07b0-46de-a6f2-41afa8076977 | 2 | public static void main(String[] args) {
TestAtom A = new TestAtom();
Movable player = new Movable();
ArrayList<VerbSignature> signatures = A.getVerbs(player).verbs;
for(VerbSignature v : signatures)
{
System.out.println("Verb: "+v.verbName);
for(VerbParameter p : v.parameters)
{
System.out.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.