method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1db838df-786d-4ee9-8c46-81d30c46361f | 8 | protected void setStandardUniforms() {
if (m_model != null && m_modelLoc != -1) {
GL.matrix2uniform(m_model, m_modelLoc);
}
if (m_modelIT != null && m_modelITLoc != -1) {
GL.matrix2uniform(m_modelIT, m_modelITLoc);
}
if (m_view != null && m_viewLoc != -1) {
GL.matrix2uniform(m_view, m_viewLoc);
}
... |
989f3806-f229-4b2a-9868-fc5476eaf88f | 7 | public List<List<Chemin>> parcourirArbre(List<Chemin> listeChemins, Map<Integer, List<Chemin>> mapChemins, List<Chemin> cheminsUtilises, int profondeur, boolean isDeepest, int valDepart, List<List<Chemin>> listDeListDeChemin, int nombreSommets) {
//print("Entrer dans parcourir arbre : ", isDeepest);
List tempChemin... |
07b3cee2-6b3b-4cd8-ad08-e174dddc1896 | 9 | private boolean isValidDNI(String dni) {
if (!isValidStringData(dni)) {
return false;
} else if (dni.length() != 9) { /* Si longitud del DNI < 9 */
return false;
} else if (((dni.charAt(8) < 'A') /* Si el caracter final no es letra */... |
753062e9-e3c8-4710-b60e-bd57a2839857 | 0 | public Auction getLatestAuction(){ return auctionsCatalog.get(auctionsCatalog.size()-1); } |
f48ccf68-4eec-472c-a1e2-e65e1143d363 | 9 | public static int[][] cellularAutomataProcess(int[][] map, int threshold) {
// FIXME
int[][] oldMap = copyInt2(map);
for (int x = 1; x < map.length - 1; x++) {
for (int y = 1; y < map[0].length - 1; y++) {
int surroundSum = 0;
for (int i = -1; i < 2; i++) {
for (int j = -1... |
08952152-19cf-4047-a690-ada4b9293f81 | 7 | @Override
public void filter(ContainerRequestContext requestContext) throws IOException {
User loggedUser = authResource.getLoggedUser(servletRequest.getSession().getId());
Boolean rolesOnMethod = resourceInfo.getResourceMethod().isAnnotationPresent(RolesAllowed.class);
Boolean permitAllOnMethod = resourceInfo.... |
d9cc4a01-86ce-4958-9727-0796897c28d0 | 3 | public static EntityManager getManager() {
try{
if (emf==null){
emf = Persistence.createEntityManagerFactory("AgendamentoExamesPU");
em = emf.createEntityManager();
System.out.println("Criando o gerenciador de Entidade");
} else
... |
2ec7934b-5cee-4b14-8d66-5e17dcf7a4d1 | 6 | @EventHandler
public void onAsyncPlayerChat(AsyncPlayerChatEvent event){
String msg = event.getMessage().replaceAll("^[ ]*\\*", "*");
String[] messageArray = format(event.getPlayer(), msg, msg.startsWith("*")).split(" ");
String newMessage = "";
JsonMessage message = new JsonMessage("");
for (String x : m... |
dd441560-6c60-4fba-b30a-b7d7c27cc937 | 4 | public int send(ajpacket s) {
ajpacket msg;
// System.out.println(s.msg);
try {
out.writeObject(s);
if (trans) {
msg = (ajpacket) in.readObject();
if (cdata != null) {
cdata.recv(this, msg);
}
}
} catch (IOException e) {
return -1;
} catch (ClassNotFoundException e) {
return -1... |
00bf9b78-fb4d-4cca-89d8-29e7244d826e | 5 | public static void main(String[] args) {
boolean isPrime = true;
int count = 2;
for(int i = 0; i < 1000; i++){
while(true){
for(int j = 2; j < count; j++){
if(count%j == 0){
... |
933cd094-2719-4a04-91cc-066395694dc1 | 2 | public TreeNode buildTree(int[] preorder, int[] inorder) {
if(preorder.length == 0 && inorder.length == 0) return null;
TreeNode node = buildTreeRec(preorder, inorder, 0, preorder.length-1, 0, inorder.length-1);
return node;
} |
9ab06364-755f-4a93-a1b4-eb45c556ccf6 | 2 | public Number getNumber (String literal) {
int numberCount = this.numberList.size();
for(int i = 0;i<numberCount;i++) {
Number currentNumber = this.numberList.get(i);
String currentText = currentNumber.getLiteral();
boolean isMatchingExpression = literal.equals(currentText);
if (isMatchingExpression) ... |
f1e889a3-cd7f-474c-a3db-ff49307a3905 | 2 | public NoteDatabaseManager() {
try {
Class.forName(driver);
conn = (Connection) DriverManager
.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.pri... |
5c892593-d0eb-416a-9564-092664101f9c | 8 | @Test (timeout = 1000)
public void inviteChatTest() {
//start server processor
ServerProcess processor = new ServerProcess();
processor.start();
try {
//writer and reader for file
PrintWriter writer = new PrintWriter(new FileWriter("src/server/test.txt", false));
BufferedReader in = new BufferedRea... |
839aeef0-b50e-4caa-a0aa-2e752340085d | 6 | public SparkPopup setButtons(EnumButton buttonType) {
this.buttons = new JButton[5];
this.buttons[0] = new JButton("Cancel");
this.buttons[1] = new JButton("Ok");
this.buttons[2] = new JButton("Close");
this.buttons[3] = new JButton("Yes");
this.buttons[4] = new JButton("No");
switch(buttonType) {
c... |
337c467a-2ba9-4d03-bb31-090dedcac388 | 4 | public Ship(int totalContainers, AssetManager assetManager) {
int nrContainers = 0;
for (int z = 0; z < 100; z++) {
for (int y = 0; y < 15; y++) {
for (int x = 0; x < 19; x++) {
if (totalContainers > nrContainers) {
container[x][y][... |
51423484-12f2-4e19-8ee4-645b0d9559ac | 2 | public static void updateSubnet(Subnet sub){
SubnetData data = sub.getSubnet();
//Recover the subnet object (from the Rest Interface) attributes
String name = data.getName();
String n = data.getId();
String network = data.getNetwork_id();
String tenant = data.getTenant_id();
AllocationPools alPools ... |
0ec6bb92-9278-4132-b432-0ef6e5ce1aa5 | 9 | private void addRecipeActionPerformed(MouseEvent evt) {//GEN-FIRST:event_addAllActionPerformed
newRecipe = new Recipe();
if(!recipeTitle.getText().isEmpty()) {
newRecipe.setTitle(recipeTitle.getText());
}
else {
create = false;
}
if(curIngredient... |
c657b51d-06dd-4cf9-bc3e-11b8c8d96a33 | 8 | public static long[] getScaledFileSizesMB(File dir, long totalDesiredSize, String... fileNames) throws IOException {
if (!dir.exists() || !dir.isDirectory()) {
throw new IOException("The directory does not exist or is not a directory: " + dir.getAbsolutePath());
}
// Get the files
File[] files = new File... |
8fefdd37-4664-4d56-bb8b-7f612603804b | 7 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if (l1 == null) {
return l2;
}
if (l2 == null) {
return l1;
}
ListNode head = new ListNode(0);
ListNode cur = head;
int flag = 0;
while (l1 != null && l2 != null) {
int sum =... |
00874000-723a-4fbc-b5fc-4578cbb0da61 | 9 | protected void doPadding(byte[] output, int outputOffset)
{
int ptr = flush();
int bitLen = ptr << 3;
int th = t1;
int tl = t0 + bitLen;
tmpBuf[ptr] = (byte)0x80;
if (ptr == 0) {
t0 = (int)0xFFFFFE00;
t1 = (int)0xFFFFFFFF;
} else if (t0 == 0) {
t0 = (int)0xFFFFFE00 + bitLen;
t1 --;
} else {... |
90ed7134-0f60-4ae2-a91c-52de27641bc0 | 2 | public boolean remove(K key) {
if (!inited) {
init();
}
V remove = data.get(key);
if (synchronizer.remove(key, remove)) {
data.remove(key);
return true;
}
return false;
} |
6f342bb8-8921-4192-8d5c-c3c41a453908 | 9 | private boolean assignCisTransOnRing(Element stereoChemistryEl) throws StructureBuildingException {
if (stereoChemistryEl.getAttribute(LOCANT_ATR) != null) {
return false;
}
Element parentSubBracketOrRoot = stereoChemistryEl.getParent();
List<Fragment> possibleFragments = StructureBuildingMethods.findAlterna... |
33a9d057-47fe-497c-9ff2-d69075406c4e | 1 | public void visit_bastore(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
6f897e1a-c352-40d8-90ac-8ad00b6c62b7 | 9 | @Override
protected void visitVistaPackage(VistaPackage routinePackage) {
try {
if (! routinePackage.isUncategorized()) {
this.packageFanouts = new HashSet<EntryId>();
this.recorder = new FanoutRecorder(routinePackage.getPackageFanoutFilter());
super.visitVistaPackage(routinePackage);
if (t... |
7491af14-1f2b-43e5-b490-ab1cf28f1371 | 7 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
commands.remove(0);
if(commands.size()==0)
{
mob.tell(L("At where do what?"));
return false;
}
final String cmd=commands.get(0);
commands.remove(0);
Room room=CMLib.map().getRoom(cmd.toSt... |
9962a808-1ad3-4a3e-8b6b-ac28c2c88576 | 5 | protected void encodePayload() throws IOException {
if (key instanceof DSSPublicKey) {
properties.put("type", "RAW-DSS");
IKeyPairCodec coder = KeyPairCodecFactory.getInstance("dss");
payload = coder.encodePublicKey(key);
} else if (key instanceof GnuRSAPublicKey) {
prope... |
921efe54-699e-4dd0-a3bc-8995bbd7906d | 9 | private void incrementElements(int index, int variant) {
if (variant == 0) {
switch (index) {
case 0:
rightIndex++;
break;
case 1:
topIndex++;
break;
case 2:
topIndex++;
rightIndex++;
break;
case 3:
... |
73488507-1c87-48a4-b704-e23aad123efb | 1 | public String getStringValue(String name, String defaultValue) {
// a small hack to enable a test via Mojo without altering the configs
if ("enabled".equals(name)) {
return "true";
}
return StringUtils.defaultIfEmpty(xmlConfigReader.getValue(name), defaultValue);
} |
bad9ea42-893d-40b2-b8d0-88ae91d96976 | 7 | public Messages(HashMap<Number, Contact> numberMap) throws IOException, ParseException {
// search directory for messages
File home = new File(SMSViewerMain.DIRECTORY);
File[] contactFiles = home.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isFile() && pa... |
1713d071-3c35-4bb9-9af5-01920a4dbaa1 | 3 | public BigInteger getMinimumDifference_as_BigInteger(){
BigInteger diff = BigInteger.ZERO;
if(this.type==12){
ArrayMaths am = this.sort();
BigInteger[] sorted = am.getArray_as_BigInteger();
diff = sorted[1].subtract(sorted[0]);
BigInteger minDiff = diff;
... |
34813c59-6294-4087-9049-5bb7c6766300 | 4 | public static boolean isBlank(final String str) {
final int strLen = str == null ? 0 : str.length();
if (strLen == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (!Character.isWhitespace(str.charAt(i))) {
return false;
}
... |
2c740a2b-8987-4289-9b05-379a0fb1876d | 4 | private void updateChecksumAdj (ByteBuffer fontData) {
int checksum = calculateChecksum ("", fontData);
int checksumAdj = 0xb1b0afba - checksum;
// find the head table
int offset = 12 + (getNumTables () * 16);
// find the head table
for (Iterator i = tables.keySet ().it... |
d4d4099e-5ac6-4197-9613-ee17488ad3b5 | 5 | public TreeNode sortedListToBSTRec(ListNode head){
if(head == null) return null; // length 0 list
if(head.next == null) return new TreeNode(head.val); // length 1 list
if(head.next.next == null){ // length 2 list
TreeNode t = new TreeNode(head.val);
TreeNode t1 = new TreeNode(head.next.val);
t.right = ... |
a666739e-5f14-43cc-8541-af24ec912a23 | 7 | public String hamtaRoll(String personnummer){
String roll = "";
try{
// H�mta data om en persons roll.
connection = getConnection();
preparedStatement = connection.prepareStatement("SELECT Roll from rollinnehav WHERE Personnummer = ?");
preparedStatement.setString(1, personnummer);
resu... |
fa69afd7-5c29-49fa-a6f1-38aa6ca0ac85 | 3 | public String getVariableName(String xpathExpression){
if (xpathExpression.contains("/")){
String varMsg = xpathExpression.substring(0, xpathExpression.indexOf("/"));
if (varMsg.contains(".")){
return varMsg.substring(1, varMsg.indexOf("."));
}else{
return varMsg.substring(1);
}
}else{
if... |
5ae7e032-3dbf-414b-9c63-ae15e9df9ff2 | 6 | protected final void onButtonClick(Button var1) {
if(var1.id == 0) {
this.minecraft.setCurrentScreen(new OptionsScreen(this, this.minecraft.settings));
}
if(var1.id == 1) {
this.minecraft.setCurrentScreen(new GenerateLevelScreen(this));
}
if(this.minecraft.session != nu... |
773522dd-be2b-4dec-af06-571fb94fabfc | 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 Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.id == null && other.id != null) || (thi... |
02d7628e-f8b8-4e68-af4c-50cc61415694 | 1 | public Production[] getSelected() {
int[] rows = getSelectedRows();
Production[] selected = new Production[rows.length];
for (int i = 0; i < rows.length; i++)
selected[i] = (Production) data[rows[i]][0];
return selected;
} |
4d5f4904-2f36-4225-9ec8-ae72b057d201 | 7 | static private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0, 0L);
return 8;
}
switch(curChar)
{
... |
916c15f4-5bb8-4189-837d-070fae8bc399 | 8 | public boolean isSymmetricIter(TreeNode root) {
if(root == null) return true;
Stack<TreeNode> leftStack = new Stack<TreeNode>();
Stack<TreeNode> rightStack = new Stack<TreeNode>();
leftStack.push(root.left);
rightStack.push(root.right);
while (leftStack.size() > 0 && righ... |
2f3c7fa0-2e43-4448-8ceb-caedfd7490d3 | 7 | public void begin(Modus modus, Report report, boolean playoff) {
// alloc PlayingMatch instance
// calc nof spectators (therefore "playoff" param is needed)
if (home != null && away != null) {
endHomeScore = 0;
endAwayScore = 0;
playingMatch = new PlayingMatch(report, home, away, modus.isAdvHome());
/... |
a51f47fa-d81e-41f6-949d-ed1a29dff978 | 4 | public V modify(Map.Entry<String,String> oldEntry, Map.Entry<String,String> newEntry) throws EmptyNameException, DuplicateNameException{
if(!oldEntry.getKey().equals(newEntry.getKey())){
throw new RuntimeException("Inproper use: keys should have the same value (modify)");
}
String ke... |
d0623ace-4560-43e4-b101-dafbf124d235 | 8 | public final boolean isAssignableFrom( JClass derived ) {
// to avoid the confusion, always use "this" explicitly in this method.
// null can be assigned to any type.
if( derived instanceof JNullType ) return true;
if( this==derived ) return true;
... |
14e2a8e1-4ac2-4e01-abde-499c8845869b | 5 | private static String getMapperLogUrl(String mapTaskDetailsJsp, List<String> countersList) {
Document mapDetails = HtmlFetcher.getHtml(mapTaskDetailsJsp);
Element tr = null;
for(Element elem : mapDetails.getElementsByTag("tbody").first().children()) {
if(elem.child(2).text().equals("SUCCEEDED")) {
tr = ... |
8b1eace1-85d9-4a59-8852-8c98fc036111 | 7 | private void permuteHelper(int size) {
if (size == num.length) {
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < num.length; i++) {
list.add(ans[i]);
}
result.add(list);
return;
}
for (int i = 0;... |
a78a8ac5-0f4c-44ce-a885-76e903fccd80 | 1 | private void setOnderdelen(ArrayList<Onderdeel> onderdelen) throws DataException {
if (onderdelen.size() != 9) throw new DataException("De hoeveelheid vragen klopt niet.");
_onderdelen = onderdelen;
} |
e946c5bd-04dc-465d-85d6-d62970f93694 | 7 | public static boolean writeAssignmentCSV(RosterDB rosterDB, String absolutePath) {
// create output file
FileWriter outputStream = null;
try {
outputStream = new FileWriter(absolutePath);
outputStream.write("Name,Vorname");
for (int i = 0; i <= MainWindow.setupData.getEventLength (); i... |
7a7a0f45-7392-4494-9a7e-ffa571a1f101 | 6 | private boolean checkForConsistentData(File dataFile) {
try {
m_fileScan = new Scanner(dataFile);
} catch (FileNotFoundException e) {
}
m_entryCount=0;
m_attributeCount=countAttributes(dataFile);
m_delimiter=",";
while(m_fileScan.h... |
d1d6e6f5-fd65-48e9-80da-79ec519b26e3 | 5 | double findMedianCombine(int A[], int aStart, int aEnd, int B[], int bStart, int bEnd) {
int[] arr = new int[bEnd + aEnd - aStart - bStart + 2];
int i = 0;
while (aStart <= aEnd && bStart <= bEnd) {
if (A[aStart] < B[bStart]) {
arr[i] = A[aStart];
aSt... |
e9558937-510b-4a9c-b200-950d11bf6e63 | 2 | private boolean isValidEndEffectEvent(Event event) {
if (event.getOriginator() instanceof PrimaryPowerFailure) {
PrimaryPowerFailure powerFailure = (PrimaryPowerFailure) event.getOriginator();
if (powerFailure.equals(this))
return true;
}
return false;
} |
9f4eb057-e2ee-4018-a109-9bb423062019 | 4 | public void set(E o) {
if (lastReturned == head) {
throw new IllegalStateException();
}
checkForComodification();
if(o.getDoublyLinkedListFinger().getFinger(DoublyLinkedList.this) != null) {
throw new IllegalStateException("Cannot replace the current entry with an entry that is already in the li... |
3e2a6c1e-6df7-43e1-8601-9fb13bc90d58 | 3 | public void sendMessage(Player player, String message, int distance) {
List<Player> players = player.getWorld().getPlayers();
for (Iterator<Player> i = players.iterator(); i.hasNext();) {
Player p = i.next();
if (MathUtils.GetDistance(player.getLocation(), p.getLocation()) <= distance
|| distance == -1)... |
216889ec-ca7c-4b8b-9aab-4c7f7bccb1f8 | 6 | private String deleteSubString(String hosts, String host){
int i=0;
int hostlen=host.length();
int hostslen=hosts.length();
int j;
while(i<hostslen){
j=hosts.indexOf(',', i);
if(j==-1) break;
if(!host.equals(hosts.substring(i, j))){
i=j+1;
continue;
}
... |
dd38604c-ef1b-41d0-9077-51fee899bc72 | 1 | public void test_subtract() throws Exception {
DurationField fld = ISOChronology.getInstanceUTC().millis();
assertEquals(900, fld.subtract(1000L, 100));
assertEquals(900L, fld.subtract(1000L, 100L));
assertEquals((1000L - Integer.MAX_VALUE), fld.subtract(1000L, Integer.MAX_VALUE));
... |
62f3da42-e16a-454f-93e6-a8116ff3bdcb | 7 | public void checkSideCollision(Rectangle rleft, Rectangle rright, Rectangle leftfoot, Rectangle rightfoot) {
if (type != 5 && type != 2 && type != 0){
if (rleft.intersects(r)) {
robot.setCenterX(tileX + 102);
robot.setSpeedX(0);
}else if (leftfoot.intersects(r)) {
robot.setCenterX(tileX + 85);
... |
3dd1004c-74d7-481c-b323-0a6e43d0d5db | 6 | @EventHandler
void onClick(PlayerInteractEvent event){
try {
Block block = event.getClickedBlock();
if(block.getTypeId()==1) AutoSetUp.gift(event.getPlayer());
if (!((block != null) && (block.getType() == Material.IRON_BLOCK))) {
return;
}
if(event.getPlayer().g... |
ef85d178-f565-49bd-9d7e-c46424429bb3 | 9 | private void getTableContents() throws SQLException {
ResultSet nurses = Database.getInstance().executeQuery("SELECT * FROM nurse");
ArrayList<Object[]> rowList = new ArrayList<Object[]>();
while (nurses.next()) {
ArrayList<Object> cellList = new ArrayList<Object>();
for (int i = 0; i < columnClasses.lengt... |
6c1216a8-8fbd-4f79-aa08-a86ff02ac2fd | 0 | public String getNationality() {
return Nationality;
} |
cfd0eef6-367c-4789-98d5-d31f461b9a86 | 5 | private void output(int index, double value, String toFile)
{
/* skip single-valued attribute */
if(feature_max[index] == feature_min[index])
return;
if(value == feature_min[index])
value = lower;
else if(value == feature_max[index])
value = upper;
else
value = lower + (upper-lower) *
(valu... |
83c75004-aad7-4376-b354-cf3d8fe53e36 | 4 | private double testBinaryHeapDelMin(int[] inserts) {
System.out.println("Testing BinaryHeap with " + inserts.length + " delMins");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
binaryHeap = new BinaryHeap();
f... |
07d266ba-5164-4a07-a966-11c0cc818170 | 7 | public boolean equals(Object o) {
if ( !(o instanceof ISEAbstractState) ) return false;
ISEAbstractState s = (ISEAbstractState)o;
if ( depth != s.depth ) return false;
// check that the elements are the same
for ( int cntr = 0; cntr < elements.length; cntr++ ) {
if( e... |
2f009081-1009-4cbe-af99-7762b4bc86be | 2 | public Bitmap flipX()
{
int[] temp = new int[pixels.length];
for(int i = 0; i < width; i++)
{
for(int j = 0; j < height; j++)
{
temp[i + j * width] = pixels[(width - i - 1) + j * width];
//temp.setPixel(i, j, level.getPixel(level.getWidth() - i - 1, j));
}
}
pixels = temp;
return ... |
f7fc2f46-dab1-4ea6-b70a-79382051a0fa | 8 | public void runTest() {
// update Game
game.updateGame();
// show current statistic
setting = ("MATCH : " + game.getSetting().getMatchID());
setting += "\n" + ("TEAM A : " + game.getSetting().getNameTeamA());
setting += "\n" + ("TEAM B : " + game.getSetting().getNameTeamB... |
80505872-cbfb-450f-9bd2-907506d58b95 | 5 | private void increaseAdjacentSquareValue(int i, int j, Square[][] mineField) {
if (i < 0 || i > mineField.length - 1) return;
if (j < 0 || j > mineField[i].length - 1) return;
if (mineField[i][j].hasMine()) return;
mineField[i][j].setAdjacentMines(mineField[i][j].getAdjacentMines() + 1)... |
7e544423-3a7a-4d9d-a61d-e553881bf1d8 | 8 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
if((int)addReservationParkingSpot.getSelectedItem() == 0){addReservationMessage.setText("Check Parking Spot");}
else if((String) Hours.getSelectedI... |
73904f14-183d-418e-a2da-ea34337afe9e | 4 | private static String generateJar(File folder) throws IOException {
// Setup default tmp before anything else
if(temporaryFolder.equals("default")) {
if (System.getProperty("os.name").startsWith("Windows")) {
temporaryFolder = "C:/";
} else {
temporaryFolder = "/tmp";
}
}
// Test content
if(... |
4a3b3e7f-cc1e-4f26-a274-36124350b7fa | 0 | public SpeakerObjectResponse(final Boolean success, final String errorMessage, final Speaker speaker) {
super(success, errorMessage);
this.speaker = speaker;
} |
8cf95fd4-d091-4ae3-a484-1b8f387bb8d4 | 3 | private static void promptForNames(ArrayList<String> names, String title) {
boolean done = false; // condition for when input loop is complete
Scanner scanner = new Scanner(System.in); // scanner for reading user input
System.out.println(title);
// prompt for input until an 'NEXT' is pr... |
6dfff3bd-c7ba-4622-8e10-8a9750f51b1c | 2 | @SuppressWarnings("unchecked")
private <T extends Annotation> T getClassAnnotation(Class<T> annotation)
{
Annotation[] classAnnotations = getTestClass().getAnnotations();
for (Annotation classAnnotation : classAnnotations) {
if (classAnnotation.annotationType() == annotation) {
... |
3c69338c-b0c0-4964-bd5d-334bb239caeb | 0 | public GrilleTetris getGrid() {
return grid;
} |
7fe77abc-6950-4f0b-bf9f-d70499a195e5 | 3 | private void cbMoreThanNivaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbMoreThanNivaActionPerformed
//if we select greater than, then we probably want the nivå filter selected aswell.
if (!cbNivaEnable.isSelected() && cbMoreThanNiva.isSelected()) {
cbNivaEnable.setSel... |
b13109ac-650c-401e-bab1-d78058de4118 | 2 | @Override
public int compareTo(Association o) {
if(this.equals(o))
return 0;
else
{
double temp = this.distance-o.distance;
return temp>0 ? 1:-1;
}
} |
2b9f592c-7455-4c2f-bf5a-80f58aa25c11 | 8 | public String getActiveGameServer(){
synchronized(lock) {
if(gamesession != null){
return hostname;
}
if(servers != null && !servers.isEmpty()){
Iterator<String> itr = servers.iterator();
/*Recorremos la lista de servidores obtenida buscando quien esta manejando el juego en es... |
671ba0d6-1c3c-475a-8d7f-c7387e21138e | 6 | private boolean _ParseRightpart(Rule rule){
ArrayList<String> right_part = rule.GetRightPart();
for(String symbol : right_part)
{
if(m_grammar.IsTerminal(symbol)){
if(symbol.equals(Grammar.epsilon))
return true;
if(... |
f3875c5b-13e2-45c3-a658-12b3e77bf7bc | 8 | public String toString() {
StringBuffer result = new StringBuffer();
result.append("---- " + name + " ----\n");
if (dough != null) {
result.append(dough);
result.append("\n");
}
if (sauce != null) {
result.append(sauce);
result.append("\n");
}
if (cheese != null) {
result.append(cheese);
... |
d34e9a37-0541-4481-b3bd-d0eafa0e2029 | 5 | @Override
public void run(){
while(true){
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
int sumMeals = 0;
for( Thread t :philosophen){
sumMeals += ((Philosoph)t).g... |
744e2586-e3df-44e8-b2fd-77fc31165141 | 2 | public boolean exists(String where) {
String query = "SELECT * FROM '" + m_name + "' WHERE " + where;
ResultSet result = m_database.queryResult(query);
if (result == null) {
return false;
}
try {
boolean exists = result.next();
return ... |
9aecf5f4-2158-4a06-b29b-171f3cf727a9 | 5 | @SuppressWarnings("resource")
public SearchEngine(DataSource ds) {
while (true) {
try {
System.out
.println("Search record by: Patient info = 1, Prescribed date = 2, Alarming age = 3, Main menu = 0");
System.out.print("Enter option: ");
Scanner s = new Scanner(System.in);
int option = s.next... |
a26ad56c-fabc-4a58-9fe7-148a62dfb8d1 | 8 | public void getGUI(){
//JPanel p3;
GroupLayout groupLayout;
GroupLayout.ParallelGroup horizontalContentGroup_P;
GroupLayout.SequentialGroup verticalGroup_S,horizontalGroup_S;
//p3 = new JPanel();
this.setName(Q_ID+"");
//p3.setLayout(ne... |
067d4137-4cc5-4c87-9883-f58497c84753 | 1 | public Iterable<Integer> path(int v, int w)
{
if (!hasPath(v, w))
return null;
List<Integer> path = new LinkedList<Integer>();
return path;
} |
45901840-30a5-443f-a448-6de3cb417ba5 | 2 | private void setVariables(Object responses, int type){
// Set group names
if(!this.groupNamesSet){
this.groupNames = new String[this.nGroups];
for(int i=0; i<this.nGroups; i++){
this.groupNames[i] = "group " + (i+1);
}
}
// St... |
38b1556f-9c5a-4532-a654-1734b06dab42 | 1 | public final EsperParser.program_return program() throws RecognitionException {
EsperParser.program_return retval = new EsperParser.program_return();
retval.start = input.LT(1);
Object root_0 = null;
EsperParser.statements_return statements1 =null;
try {
// C:\\... |
2a531fff-01f7-4b0e-8a5b-c222f4f3aaa3 | 1 | public static void up() {
if(viewY - 100 > 0) {
viewY -= 1;
}
} |
2ecf9855-cb8b-48bb-bb7b-dc4bfb54c47d | 3 | @Override
public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException {
if (args[0].toLowerCase().equals("p")) {
game.getPlayer().hidden = true;
} else if (args[0].toLowerCase().equals("t")) {
target.hidden = true;
} else {
Entity e = game.getWorld().getEntity(a... |
c5cada31-a944-423e-a76c-f4ec7b2f4369 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
KeyValuePair other = (KeyValuePair) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
r... |
c365a72d-a4ed-47fb-9143-59e13c7ddfa8 | 5 | public static ArrayList<Machine> fillMachineMagCylinders(ArrayList<Machine> machines, ArrayList<MagnetCylinder> magnetCylinders) throws SQLException {
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("select m.name_machine, mc.teeth from Machine m " +
"INNER JOIN ... |
4ca9e2a4-b9a1-4dd4-be63-da6dfdb486d2 | 4 | private static List<String> listRoute(ObjectOutputStream toServer, ObjectInputStream fromServer) throws IOException, ClassNotFoundException {
log.debug("Start \"listRoute\" method");
GetAllRoutesRequestInfo req = new GetAllRoutesRequestInfo();
log.debug("Send GetAllRoutesRequestInfo to server");... |
63cb62a9-cb9c-41b6-ba78-b304bf080a76 | 1 | public void SetUp()
{
// Get questions
List<Question> allQuestions = DbAccess.getAllQuestions(false);
// creates values for size of list
QuestionCount = allQuestions.size();
Question s = new Question();
s = allQuestions.get(i);
List<Answer> sa... |
01c1fc5d-11ac-4608-9e8a-19f562f6eb0e | 3 | public void barajarFicha() {
int i = 0;
do {
//Genera un numero aleatorio entre 0 y 27
int n = (int) Math.floor(Math.random() * 28);
if (n < 28) {
if (this.probarRepeticion(n)) {
this.fichasBarajadas[i] = n;
i++;... |
6032d09d-cafd-4834-b792-3388e09cd45a | 8 | public void renderDisplay() {
initSettings() ;
final Colour BC = backColour == null ? Colour.DARK_GREY : backColour ;
GL11.glClearColor(BC.r, BC.g, BC.b, BC.a) ;
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT) ;
port.applyView() ;
lighting.bindLight(0) ;
... |
1fc0b640-4965-460e-90c3-94cfd43d8001 | 0 | @Test
public void test_json2xml() {
String json = "{\"Response\" : {\"@type\" : \"string\",\"CustID\" : 1300000428,\"CompID\" : 1100000324,\"Items\" : {\"Item\" : [ {\"Sku_ProductNo\" : \"sku_0004\",\"Wms_Code\" : 1700386977,\"Sku_Response\" : \"T\",\"Sku_Reason\" : null}, {\"Sku_ProductNo\" : \"0005\",\"Wms_Code\" ... |
e41336cd-6bdc-4bb7-83ec-9a096a0599b2 | 8 | public void nextPermutation(int[] nums) {
if (nums == null || nums.length == 0) {
return;
}
int i = nums.length - 1;
while (i >= 1 && nums[i] <= nums[i - 1]) {
i--;
}
if (i != 0) {
for (int j = nums.length - 1; j >= i; j--) {
if (nums[i - 1] < nums[j]) {
int k = nums[i - 1];
nums[i ... |
b8125c78-b079-4cc5-b94f-81b2fb760919 | 1 | public static int getLevel(int exp){
int level=0;
while(exp>0){
//基数为EXP_BASIC,每增加一级,累加EXP_ADD
exp-=(level*EXP_ADD+EXP_BASIC);
level++;
}
return level-1;
} |
0b1bdc86-e756-48b7-9652-dbc152c3704a | 7 | public boolean isLegalAttack(Square threatened)
{
if (mName.equals(Messages.getString("pawn"))) //$NON-NLS-1$
{
if (mBoard.getGame().isStaleLegalDests())
mBoard.getGame().genLegalDests();
if (mIsCaptured)
return false;
if (threatened.getCol() == mCurrentSquare.getCol())
return false;
else... |
c4697b6a-3d41-4be7-8811-1d3aebf68788 | 9 | public static void main(String[] args) throws Exception {
PropertyConfigurator.configure("log4j.properties");
String outputPath = getOutputPath();
String scenario = "financial";
String type = "relaxed";
for (String str : args) {
if (str.startsWith("-help")) {
printHelp();
return;
}
if (... |
d7e70ea0-305c-4711-ac13-1be6a2daeda7 | 2 | private void unfilterAverage(byte[] curLine, byte[] prevLine) {
final int bpp = this.bytesPerPixel;
int i;
for(i=1 ; i<=bpp ; ++i) {
curLine[i] += (byte)((prevLine[i] & 0xFF) >>> 1);
}
for(int n=curLine.length ; i<n ; ++i) {
curLine[i] += (byte)(((prevLin... |
c05d1773-22ab-4478-a3a4-7de62772133e | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
89a073c9-376a-4415-a688-9f93f27d2c68 | 5 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
if ("logout".equals(request.getParameter("action"))) {
logout(request, response);
return;
}
Profile existingProfile = (Profile)... |
aa5dde08-0e14-45a1-92c8-6e1de648f93e | 1 | public BufferedImage imageFit(JLabel label, String path){
BufferedImage bi = null;
try {
bi=new BufferedImage(label.getWidth(),label.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D g=bi.createGraphics();
Image img=ImageIO.read(new File(path)); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.