method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2517a2b1-6806-40f8-8abc-060f6882e278 | 1 | public static void main(String[] args) {
long start_time = System.currentTimeMillis();
CountingWords cw = new CountingWords();
LoadTexts texts = new LoadTexts();
Iterator<String> iter = texts.iterator();
Map<String, Integer> stat = cw.getStatistic(iter.next());
Set<String> res_list = cw.getWords(stat);
... |
093b7a20-6ddb-4491-85c5-5bd5bb994246 | 9 | public static void main(String[] argv) throws Exception {
KeyFactory factory = KeyFactoryImpl.getInstance();
KeyPair dsa = factory.generateDSA(512);
KeyPair rsa = factory.generateRSA(1024);
SecureRandom r = new SecureRandom();
String key = "374A2BD6D85F5FAA0B6FE06D2F4D8C240DAD83EA345EC1922553F40FEDCC3071DB... |
bf2e9eab-8028-44e1-913e-05da1aceea80 | 7 | public boolean puraTiedosto() throws FileNotFoundException, IOException, ClassNotFoundException {
FileInputStream fis = new FileInputStream(lahde);
BufferedInputStream bis = new BufferedInputStream(fis);
byte[] luetutKoodiTavut = new byte[purkuBlokkiKoko];
//FileInputStream fis2 = new FileInputStream(lahde.... |
5c90bf43-f860-41a2-8a5f-5dec051b9c36 | 4 | public static boolean testMagic(String pathName) throws IOException {
// Open the file
BufferedReader reader = new BufferedReader(new FileReader(pathName));
boolean isMagic = true;
int lastSum = -1;
// For each line in the file ...
String line;
while ((line = reader.readLine()) != null) {
// ... sum ... |
8fc63dc9-eacc-4bcd-9508-69b3995e433e | 8 | public static Name getName(String noteName) {
noteName = noteName.toUpperCase();
if (!(noteName.matches(NOTE_NAME_PATTERN))) {
throw new IllegalArgumentException("Invalid note name!");
}
switch (noteName) {
case "C":
return Name.C;
c... |
85282ff4-13a3-486c-994b-b7ab4c381c95 | 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... |
ba9a6245-5795-4863-a875-f77015bf0083 | 9 | public DailyAirtimeSettings(java.awt.Frame parent, boolean modal, boolean sun,
boolean mon, boolean tue, boolean wed, boolean thu, boolean fri, boolean sat) {
super(parent, modal);
this.setIconImage(new ImageIcon(getClass().getResource(
"ShowClockWindowLogo.png")).getImage())... |
e2e6fe60-a119-4f80-b546-f32d7e93f2e4 | 0 | private void createDummyTravelTrips() {
TravelTrip temp = new TravelTrip();
temp.setCountry("Pakistan");
temp.setCity("Lahore");
temp.setFromDate("19/06/2012");
temp.setToDate("27/06/2012");
temp.setBusiness(false);
//travelTripDao.register(temp);
trav... |
e9088026-0042-4a95-9551-7241483a13c6 | 5 | public ComparatorTreeNode(SingleTreeNode oldNode, SingleTreeNode newNode){
this.oldNode = oldNode;
this.newNode = newNode;
if (oldNode != null && newNode != null)
comparatorNodeTableModel = new ComparatorNodeTableModel(oldNode.getNodeTableModel(), newNode.getNodeTableModel());
... |
a9c9c637-8f3f-471f-9eff-595133eb29e7 | 3 | public static void isBoardLegal(String board, int dimension) {
if (Objects.isNull(board) || board.isEmpty() || board.length() % dimension != 0) {
throw new IllegalStateException("There is something wrong with your board");
}
} |
ecf49a15-9bba-40b1-9a11-5e906e0b98bf | 1 | public Tileset(){
try {
tileset = ImageIO.read(new File("F:\\DerWorkspace\\Zombie\\src\\Tileset.png"));
} catch (IOException e) {
e.printStackTrace();
}
tilesetLaden(tileset);
} |
85dd3698-8caf-4865-a92f-f614e47d585f | 2 | public int setTypeCompte(String typeCompte) {
if(typeCompte.equalsIgnoreCase("solde") || typeCompte.equalsIgnoreCase("abonnement")){
this.typeCompte = typeCompte.toLowerCase();
return 0;
}
else{
return -1;
}
} |
33dbe4ef-52a3-4372-bd3d-1d98647875b6 | 0 | public Boolean getSuccess() {
return success;
} |
660d0350-c281-4c1c-b014-803bf8aefe82 | 6 | public static int getMaxStones(int currRow, int currCol, int[][] inputArr) {
int max = 0;
try {
int v1 = inputArr[currRow-1][currCol - 1];
max = v1 > max ? v1 : max;
} catch (Exception e) {
}
try {
int v1 = inputArr[currRow-1][currCol];
max = v1 > max ? v1 : max;
} catch (Exception e) {
}
tr... |
03ca70c3-f6ff-4ec2-975c-20dd9dd61bd2 | 9 | public boolean isValidSwap(int x, int y, SwapDirection swapDirection) {
if(x < 0 || y < 0)
return false;
if(this.isPositionAvailable(x, y)) /* No square for swap here. */
return false;
int newX = x;
int newY = y;
new... |
7b4d0384-2ef2-494f-8b5d-896643b7e106 | 6 | protected void updateClassPath(File dir) throws Exception
{
URL[] urls = new URL[this.urlList.length];
for (int i = 0; i < this.urlList.length; i++) {
urls[i] = new File(dir, getJarName(this.urlList[i])).toURI().toURL();
}
if (classLoader == null) {
classLoader = new URLClassLoader(url... |
76b51218-e0f3-4408-b05d-792585081147 | 2 | public AbstractInsnNode[] find(String regex) {
try {
Matcher regexMatcher = Pattern.compile(processRegex(regex),
Pattern.MULTILINE).matcher(representation);
if (regexMatcher.find())
return makeResult(regexMatcher.start(), regexMatcher.end());
} catch (PatternSyntaxException ex) {
ex.printStackTrac... |
d5eadfbb-6eab-4f85-8507-2c4efda36bf1 | 5 | private void createAdvancedContent(String serie, String[] albums, int id) throws IOException {
Logger.getLogger(ReportGenerator.class.getName()).entering(ReportGenerator.class.getName(), "createAdvancedContent", new Object[] {serie, albums, id});
BufferedWriter comicFile;
comicFile = new Buffere... |
d7c6fbee-ed3b-4fbd-8a3a-9ecb4dc3b694 | 4 | public Object clone() {
//MERLIN MERLIN MERLIN MERLIN MERLIN//
TuringMachine a = new TuringMachine(this.tapes());
a.setEnvironmentFrame(this.getEnvironmentFrame());
HashMap<TMState, TMState> map = new HashMap<TMState, TMState>(); // Old states to new states.
for (Object o: states){
// ... |
30e2c58b-c8bf-4f42-87a0-e9f07e6fa959 | 3 | public boolean isLawful(){
switch(this){
case LAWFUL_GOOD:
case LAWFUL_NEUTRAL:
case LAWFUL_EVIL:
return true;
default:
return false;
}
} |
a4f98ebe-226b-4424-825b-36fea19da703 | 8 | public static boolean isBinarySearchTree(TreeNode rootNode) {
if(rootNode == null) {
return true;
}
TreeNode leftSubTree = rootNode.getLeft();
TreeNode rightSubTree = rootNode.getRight();
boolean leftResult = isBinarySearchTree(leftSubTree);
boolean rightRe... |
b07d146b-45a8-4aae-8711-5aa247d63644 | 2 | public int[] getHashBuckets(String key) {
return Filter.getHashBuckets(key, hashCount, buckets());
} |
fa6659b2-3e52-4ca5-bf73-25e46cc8b543 | 1 | private final void reliableExecution(PlanObject plan) throws FatalError,
RestartLater {
try {
plan.run();
} catch (JSONException e) {
Output.println(plan.getName()
+ " hat einen unbehandelbaren Fehler erzeugt.", 0);
}
} |
fcb5b0a6-fcd5-43fb-9710-73794dab1fbb | 7 | public static Map imageTagsFromFile(String fileName) {
Map imagesTags = new HashMap();
/* Set path to file */
String filepath = System.getProperty("user.dir");
filepath = filepath + "/src/statsemdistance/res/" + fileName;
BufferedReader br = null;
String line;
S... |
974362d5-1d10-488f-91a7-b558033cdfcb | 2 | public static void main(String[] args) {
/* program to print the pattern
1
12
123
1234
*/
for (int i=3;i<=10;i++)
{
for (int j=1;j<=i;j++)
System.out.print(j);
System.out.println("");
}
} |
378ba437-9dc7-4076-8967-26fed335aa7e | 0 | public void setVelocityY(float dy) {
this.dy = dy;
} |
ff029151-9365-4702-be97-8576ab73eed7 | 0 | public static void main(String[] args)
{
HashMap map = new HashMap();
map.put("a","zhangsan");
map.put("b","lisi");
map.put("c","wangwu");
map.put("a","zhaoliu");
System.out.println(map);
String value = (String)map.get("b");
System.out.println(value);
System.out.println("------------");
... |
99dca2a0-1a50-43b9-bada-6b295f420461 | 2 | public static Connection getConexion(){
try{
Class.forName("com.mysql.jdbc.Driver");
if(conex==null){
conex = DriverManager.getConnection(url,usuario,clave);
}else{
conex = null;
}
}catch(ClassNotFoundException | SQLException e)... |
a223b12a-4cb1-4155-8123-405c04ddcb6d | 0 | static void w(Lethal l) {
l.kill();
} |
fa779ca8-4b8c-459f-b23a-27d16ab163eb | 0 | public int getPoints() {
return points;
} |
9e411658-519e-492c-a7ae-65a654793299 | 8 | public static void findNumbersWithThreeDifferentDigits(int[] sourceNumbers) {
int digit1, digit2, digit3;
print("Все трехзначные числа, в десятичной записи которых нет одинаковых цифр: ");
for (int sourceNumber : sourceNumbers) {
digit1 = sourceNumber / 100;
digit2 = sour... |
3270b03c-e436-485d-bfc3-7c91de4b9c82 | 1 | private static Field getLabelField(final String name) {
try {
Field f = Label.class.getDeclaredField(name);
f.setAccessible(true);
return f;
} catch (NoSuchFieldException e) {
return null;
}
} |
ba411fbd-5f43-4399-9c58-3c72b638bdaa | 6 | private Record searchingFile(final String data, final String mark) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(file));
try {
String line;
while ((line = br.readLine()) != null) {
String recformat ="";
StringTokenizer ... |
59371398-8b7c-4cc7-9d2f-4d5cdb4f8c25 | 5 | public String getColumnName(int column) {
String name = "??";
switch (column) {
case 0:
name = "Source";
break;
case 1:
name = "Destination";
break;
case 2:
name = "FileModel name";
... |
01238a80-089a-4edc-935f-46c4bb29b452 | 3 | @Override
public void paintComponent (Graphics g) {
champion.getIcon().paintIcon (this, g, 1, 1);
if ((isHovered) && BORDER_HIGHLIGHTED != null)
g.drawImage (BORDER_HIGHLIGHTED, 0, 0, null);
else if (BORDER != null)
g.drawImage (BORDER, 0, 0, null);
} |
aa324753-eec5-4288-9651-8609c4b5beb7 | 7 | DrawFile createImage(Entity entity, FileFormatOption option) throws IOException {
final double dpiFactor = diagram.getDpiFactor(option);
if (entity.getType() == EntityType.NOTE) {
return createImageForNote(entity.getDisplay2(), entity.getSpecificBackColor(), option, entity.getParent());
}
if (entity.getType(... |
8222d655-3178-4068-b9ca-fc55bde1c084 | 4 | public String bottomUp() {
Cluster c = new Cluster();
double minDistance, daux = 0;
int c1 = 0, c2 = 0, numIteracionesQueFaltan = this.instances.numInstances();
int iteraciones = numIteracionesQueFaltan;
System.out.println("Iteracion 1 de " + iteraciones + ".");
ClusterList updatingClusterList = this.beg... |
e778e095-97d3-46a0-a21c-3fc052b33fd0 | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("landen", landService.findAll());
List<String> fouten = new ArrayList<>();
if(!(request.getParameterMap().isEmpty())){
Land land = null;
try{
long landNr = Long.p... |
0ccde472-d720-4a08-aa94-ce3b78bcfa89 | 0 | public static String GetTimeStamp() {
String TimeStamp = "";
Calendar now = Calendar.getInstance();
TimeStamp = FormatInt(Integer.toString(now.MONTH + 1))
+ FormatInt(Integer.toString(now.DAY_OF_MONTH + 1))
+ FormatInt(Integer.toString(now.HOUR_OF_DAY + 1))
+ FormatInt(Integer.toString(now.MINUTE + 1)... |
326dc0e4-c9fc-410b-bcdb-df6470d9bf15 | 2 | @Override
public boolean offer(RenderItem item) {
if (maxSize > 0 && renderList.size() >= maxSize) {
return false;
}
renderList.addLast(item);
return true;
} |
aabd15b5-25a8-45e4-b3c1-1698db1236a3 | 2 | public void addRow(Object... row) {
if (row.length != columnNames.size()) {
throw new IllegalArgumentException("row data != column count : " + row.length + "!=" + columnNames.size());
}
String[] s = new String[columnNames.size() + 1];
s[0] = Integer.toString(rows.size());
... |
11ffc141-18bb-4c3e-bbde-1ef19fff1ff8 | 7 | private void updateMinMax(float[] magnitudes) {
if(minimums == null || maximums == null)
initializeMinMax(magnitudes);
else if(minimums.length != magnitudes.length || maximums.length != magnitudes.length)
initializeMinMax(magnitudes);
else
for(int i = 0; i < magnitudes.length; ++i) {
if(-1*magnitudes... |
24af4c1e-e00c-4f07-a312-feda3edf277d | 5 | protected String nextLine() throws Exception {
if (inHandle==null) {
throw new Exception("Read Object Be Closed.");
}
if (!lastIsLine) {
if (!inHandle.hasNextLine()) {
throw new Exception("Read Error.");
}
if (!inHandle.nextLine().isEmpty()) {
throw new Exception("This mast be empty."... |
5aebeec4-a0ed-4a32-b828-37218c7b32ff | 6 | public final boolean getBoolean(int index) throws JSONException {
Object o = get(index);
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String)o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Boolean.TRUE) ||
... |
b646882d-715d-4fb9-be36-26b11a1a3354 | 0 | @Override
public void focusLost(FocusEvent e) {
textArea = (OutlinerCellRendererImpl) e.getComponent();
textArea.hasFocus = false;
} |
16d669af-27ff-4fa9-8346-279319d37ba6 | 0 | @Override
public void setYearsExperience(int yearsExperience) {
super.setYearsExperience(yearsExperience);
} |
68cdaebc-5268-48e0-9235-eb36504ec17b | 7 | protected boolean tryMove() {
boolean collided = false;
for(BB bb : level.collidables) {
if(bb.intersects(this.x + this.xa, this.y, width, height)) {
if(this.xa > 0) {
this.x = bb.getX() - width;
} else if(this.xa < 0) {
this.x = bb.getX() + bb.getWidth();
... |
29c80779-4e1f-4e65-8f06-03fad66ebe7d | 8 | public void setRenderer(int row, int column) {
if(column == 0) setHorizontalAlignment(SwingConstants.CENTER);
else if (column == 1) {
if(dataFormat==ASM_FORMAT) setHorizontalAlignment(SwingConstants.LEFT);
else setHorizontalAlignment(SwingConstants.RIGHT);
}
... |
34c9bb76-9634-42e2-9d15-a9bdc22ec9d4 | 6 | static public int convert(int id) {
switch (id) {
case CRIT_MELEE:
case CRIT_RANGE:
case CRIT_SPELL:
return CRIT;
case HASTE_MELEE:
case HASTE_SPELL:
case HASTE_RANGE:
return HASTE;
default:
... |
086170c3-7783-4e0c-9e28-3cafc90f20b0 | 1 | public void nextTurn()
{
if (wait == 0) {
++turn;
}
} |
60bd28c8-2094-476e-af30-d47f628c7786 | 5 | public boolean isCheckmated(Color color) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
Piece piece = getPiece(j, i);
if (piece instanceof King && piece.getColor() == color) {
return piece.getLegalMoves(new Coordinate(j, i), this).isEmpty() &&
this.findThreatenedSquares(color).c... |
fd2b094c-c6ab-4277-a99d-ecaf72f9fac5 | 9 | @Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
boolean enabled = false;
if (command.equals(MAKE_PASS)) {
if (this.makePassItem.isSelected()) {
enabled = true;
}
this.menu.setEnabled(enabled);
this.logic.setMakePass(enabled);
} else if (command.equa... |
ca13027b-1e2f-4580-b832-bb8347486953 | 0 | public void setIcfgFactory(BiDirICFGFactory factory) {
this.cfgFactory = factory;
} |
a676071d-2762-4a17-aa3a-07e82f652c93 | 5 | private void processFlameDrawing() {
drawingFlames = true;
try {
long l = System.currentTimeMillis();
int i = 0;
int j = 20;
while (aBoolean831) {
flameCycle++;
getFlameOffsets();
getFlameOffsets();
... |
5646b3f7-1581-4ebf-abfb-ea333715e091 | 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... |
fc1d1374-e251-4b8b-82c9-8b93aad7eebe | 6 | private void logCurrentState(final Instruction instr) {
if (log.isLoggable(Level.INFO)) {
log.info("Current instruction: " + instr + " (line " +
instr.getSourceLine() + ")");
log.info("PC: " + programCounter + "\tFP: " + framePointer +
"\tHP:" ... |
05e5ba1e-97c8-4d62-b23c-6db39d9fcf0d | 5 | public static void main(String args[])
{
//Display a welcome message.
System.out.println("Welcome to the Person Tester Application");
System.out.println();
//Create the Scanner object.
Scanner sc = new Scanner(System.in);
//Continue until choice isn't equal to "Y" ... |
9b80e5e9-c1c4-4140-af55-fbd04d9fcd08 | 1 | private boolean deleteEntry()
{
try {
rs.deleteRow();
return true;
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return false;
} |
aa43667a-f47b-4852-bd2b-41ec3c495d4f | 2 | private Matrix4f getParentMatrix() {
if (parent != null && parent.hasChanged()) {
parentMatrix = parent.getTransformation();
}
return parentMatrix;
} |
5ded1b3f-55e1-4c62-9a1e-0cd906c6d142 | 7 | public void displayResults(boolean showMismatches,PrintStream out) throws IOException
{
PrintfFormat fmt = new PrintfFormat("%s %3d %7.2f | %30s | %30s\n");
for (int i=0; i<pairs.length; i++) {
if (pairs[i]!=null) {
String label = pairs[i].isCorrect() ? "+" : "-";
... |
74144a62-0c0f-48f4-b754-3aad42a40f07 | 7 | public Operator(char operator)
{
switch(operator)
{
case 41: // ')'
stackPrecedence = -1;
inputPrecedence = 0;
break;
case 40: // '('
stackPrecedence = 0;
inputPrecedence = 7;
break;
case 43: // '+'
... |
5f12fc27-783b-498b-84fe-c0b4b06eaadb | 1 | @Override
public void relocate(){
if(isRunning()){
super.relocate();
}
} |
de1bd413-09a2-400e-93a6-9ea49df92f7d | 7 | public static void printControlFrame(ControlFrame self, PrintableStringWriter stream) {
if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PARALLEL_CONTROL_FRAME)) {
{ ParallelControlFrame self000 = ((ParallelControlFrame)(self));
stream.print("|PLL-CF|" + ControlFrame.debu... |
711c343e-2207-4345-8304-5890f81301e4 | 8 | private void countryClickedSetupMode(Country c) {
switch (setupMode) {
case 4:
if (c.getUnit() == null) {
this.addUnit(1, currentArmy(), c);
currentArmy().setFreeUnits(currentArmy().getFreeUnits() - 1);
incrementTurn();
numTerritoriesClaimed++;
if (numTerritoriesClaimed == 42) {
enterSet... |
38d4ee7f-c0e4-4ce0-8ca2-e10df20ac1c0 | 5 | public Pays(){
lesDeps = DAO.getLesDeps();
lesSpe = DAO.getLesSpe();
Collection<Medecin> lesMeds = DAO.getLesMeds();
for(Medecin unMed : lesMeds){
for(Departement unDep : lesDeps){
if(unDep.getNum().equals(unMed.getDep())){
unDep.a... |
6c8c6263-f2e5-4648-8cc6-a72d80434ebf | 9 | @Override
public void run() {
byte[] buff = new byte[1024 * 8];
BufferedInputStream bufferedInputStream = null;
BufferedOutputStream bufferedOutputStream = null;
System.err.println("request SERVER <- CLIENT: time:" + System.nanoTime());
try {
... |
6e5a3a0d-e7d1-40f5-96d9-8fe55d062be0 | 2 | public boolean isFirstNameChar(int token) {
return (isLetter(token) || token == '_' || token == ':');
} |
9f606666-b125-4a9e-8dbc-b08438a97b1e | 5 | public static List<String> getProtectedLines( String fileName ) {
List<String> protectedLines = new ArrayList<String>();
File exportFile = new File( fileName );
BufferedReader br = null;
try {
br = new BufferedReader( new FileReader( exportFile ) );
String line... |
6b3d1355-e178-4eb4-b8e1-6cd383a9df46 | 7 | static public Pkcs12 from(final InputStream input, final char[] password) {
notNull(input, "Input");
notNull(password, "Password");
try {
final KeyStore p12 = KeyStore.getInstance(KEY_STORE_TYPE, new BouncyCastleProvider());
p12.load(input, password);
for (Str... |
c51e9a70-8e90-4198-baed-2792fd140a27 | 1 | @FXML
private void noteListClicked(MouseEvent event) {
NoteEntity n = noteList.getSelectionModel().getSelectedItem();
if (n != null) {
//System.out.println("'click:" + n.getTitle());
}
} |
acc7bb44-5a77-401f-a9be-3637b86d88dd | 8 | public int searchAux(int[] A, int target, int low, int high) {
//divide into two parts
int mid = (low + high) / 2;
if (A[mid] == target) {
return mid;
}
if (low > high) {
return -1;
}
//find target in each part
if (A[low] <= A[mid... |
2f52b9e7-82c5-4669-a25f-b05922d40376 | 8 | private static boolean scanAdjNodes(int scanX, int scanY) {
// Variables that store coordinates of surrounding nodes
int xLower = scanX - 1;
int yLower = scanY - 1;
int xHigher = scanX + 1;
int yHigher = scanY + 1 ;
if (x == 0)
xLower = x;
else if (x == 26)
xHigher = x;
// Doesn't allow co... |
3732ab55-0057-4e66-9b7a-2ffacd80338a | 1 | @Override
public void save(YamlPermissionBase holder) throws DataSaveFailedException {
holder.save();
try {
yamlConfiguration.save(file);
} catch (IOException ex) {
throw new DataSaveFailedException(ex);
}
} |
b0ae5153-3701-424f-948b-6af86b91cc38 | 3 | private void guiSetupByState() {
b.removeAll();
switch(state) {
case 0: {
b.add(clazzString);
b.add(enterButton);
}
case 1: {
b.add(constructors);
b.add(enterButton);
}
case 2: {
b.add(paraScroll);
b.add(enterButton);
}
}
pack();
} |
ad06ed6d-560f-4aa6-be5b-3d244d6bcbe6 | 2 | public void testGetField_int() {
LocalDateTime test = new LocalDateTime(COPTIC_PARIS);
assertSame(COPTIC_UTC.year(), test.getField(0));
assertSame(COPTIC_UTC.monthOfYear(), test.getField(1));
assertSame(COPTIC_UTC.dayOfMonth(), test.getField(2));
assertSame(COPTIC_UTC.millisOfDay... |
c1205fd9-3614-4597-8c7e-15aa8751d7bf | 3 | public static void printmenucategoryConsole(String inCategory) {
Connection c = null;
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:Restuarant.db");
c.setAutoCommit(false);
System.out.println("Opened database successfully");
stmt = c.cre... |
df4fd74b-46cb-41c6-ae2d-357a0ec13613 | 0 | @Test
public void testAccumulate() {
CircleAccumulator test = new CircleAccumulator(new boolean[][]{ {false, false, true , true , true , false, false}, // Circle with
{false, true , false, false, false, true , false}, // Radius 3 and
{true , false, false, false, false, false, true }, // Center (3... |
e4891080-03f5-456e-8f29-9a8ad073ac9c | 6 | public boolean canShiftRight(){
if(loc1.getColumn() == board.getWidth()-1 || loc2.getColumn() == board.getWidth()-1|| loc3.getColumn() == board.getWidth()-1
|| loc4.getColumn() == board.getWidth()-1){
return false;
}
//gets all of the rightmost locations of the piece
ArrayList<Location> rightLocs = getRi... |
90cbaf68-437a-48e3-a160-54ba0bd982d0 | 2 | protected void createCells(int[][] squares) {
cells = new Cell[NCELLS][NCELLS];
for (int row = 0; row < NCELLS; row++) {
for (int col = 0; col < NCELLS; col++) {
cells[row][col] = new Cell(squares[row][col] == 1);
add(cells[row][col]);
}
}
} |
80568389-5359-4799-a6d1-5405b3a53166 | 4 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
if(rec != null && !rec.isVisible()){
lPane.remove(rec);
rec = null;
}
if (rec == null) {
rec = new FrmRecebimento(this);
Validacoes v = ... |
777e344f-b1a5-4da1-8177-18537c4a7481 | 3 | public List<Block> getBlocks() {
List<Block> blockList = new ArrayList<Block>();
World cuboidWorld = this.getWorld();
for (int x = this.x1; x <= this.x2; x++) {
for (int y = this.y1; y <= this.y2; y++) {
for (int z = this.z1; z <= this.z2; z++) {
blockList.add(cuboidWorld.getBlockAt(x, y, z));
}
... |
8a8fdbfe-0598-4c16-8531-3db67a1e6d00 | 7 | @Override
protected void connected(Socket socket) {
sock = socket;
try {
sock.setTcpNoDelay(true);
try {
sock.setTrafficClass(0x10);
} catch(SocketException e) {
System.out.println("Connection Error! >> " + e.getMessage());
}
... |
f4eed2d5-aa56-440e-93ea-9df531f03697 | 1 | public static final String toId(Enum<?> value) {
return value.name().toLowerCase().replace('_', ' ');
} |
011f62dc-4c36-486b-8388-8b6c17a888e9 | 7 | public void testValidEdge3() {
try {
TreeNode tree = new TreeNode("tree", 2);
TreeNode subtree = new TreeNode("spare-subtree");
tree.setBranch(new TreeNode[]{ subtree, new TreeNode("subtree")});
setTree(tree);
TreeNode realTree = ((Question1)answer);
... |
45aec501-6b68-427a-9a1f-30f3efcba43b | 3 | private ArrayList<Element> listeDesNoeudsFils(Element e, String name)
{
ArrayList< Element> listeDesNoeudFils= new ArrayList<Element>();
NodeList listeDeNoeudsXML= e.getChildNodes();
Node noeudXML= null;
for (int i=0;i<listeDeNoeudsXML.getLength();i++)
{
noeudXML= listeDeNoeudsXML.item(i);
if (noeudXM... |
b963c13e-53a1-48d5-a62f-155382d34e25 | 3 | public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
1f3afb66-c86c-469e-bbf1-ab910195811c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UserPO other = (UserPO)obj;
if (this.password == null) {
if (other.password != null)
return false;
} else if (!this.password.equals(othe... |
b182820f-9493-45ba-a843-7db56d0e16f9 | 2 | public static String dcnEncode(String string){
char[] replacements = null;
int i = 0;
int index = 0;
replacements = new char[]{0,5,36,96,124,126};
for(i=0;i<replacements.length;i++){
while((index = string.indexOf(replacements[i])) >=0 ){
string = str... |
37e69989-49d7-4839-88fe-0da3c9eb2ee2 | 0 | public T find(Object id) {
return getEntityManager().find(entityClass, id);
} |
8d632f6b-6f24-4a6c-998c-1efe92442c4c | 4 | public void refreshPanel() {
if (Sessie.getIngelogdeGebruiker().heeftPermissie(
PermissieHelper.permissies.get("BEHEERALLEVAKKEN"))) {
List<Vak> vakken = Dao.getInstance().getVakken();
vakLijst.clear();
for (Vak vak : vakken) {
vakLijst.addElement(vak);
}
} else if (Sessie.getIngelogdeGebruiker(... |
70900ddb-e87c-4177-a62b-61f5408de054 | 5 | private void updateFields(Object selectedItem) {
for (Team t : c.getTeams()) {
if (t.getName().equals(selectedItem.toString())) {
avgscore.setText(String.valueOf(t.getAverageScore()));
lowscore.setText(String.valueOf(t.getLowscore()));
highscore.setText(String.valueOf(t.getHighestScore()));
}
}
... |
82385b9e-584c-4a6b-9174-9ab885db41a6 | 6 | public static void addRecent(File file) {
String extension = PathUtils.getExtension(file.getName());
if (Platform.isMacintosh() || Platform.isWindows()) {
extension = extension.toLowerCase();
}
for (String allowed : FileType.getOpenableExtensions()) {
if (allowed.equals(extension)) {
if (file.canRead(... |
b405286b-2498-4682-8909-83f80dcebbcf | 0 | private boolean logging_enabled() {
synchronized (logging_enabled) {
return logging_enabled;
}
} |
e9dd3ba5-147f-4cce-9b81-6ca8cabf4f5f | 3 | public void buttonP()
{
if(bChina.contains(Main.mse))
{
Main.soundPlayer.menuKlick();
Main.startGame(GameData.createData("China", ""), true);
}
else if(bMiddleAge.contains(Main.mse))
{
Main.soundPlayer.menuKlick();
Main.startGame(GameData.createData("MiddleAge", ""), true);
}
else if(bModer... |
833c2f8d-5d2f-4b8a-9b71-0cc03e9ecd09 | 4 | protected void readVvAdd(float[][] a, BitInputStream source, int offset, int length)
throws VorbisFormatException, IOException {
int i,j;//k;//entry;
int chptr=0;
int ch=a.length;
if(ch==0) {
return;
}
int lim=(offset+length)/ch;
for(i=offset/ch;i<lim;){
... |
c92feb2e-4c48-422d-b795-6dd29daede7f | 8 | public List<Token> postProcess(List<Token> tokens) {
if (tokens.size() == 0) {
return tokens;
}
List<Token> newTokens = new ArrayList<Token>();
for (int i = 0; i < tokens.size(); i++) {
Token token = tokens.get(i);
String compoundInfo = this.compoundTable.get(token.getMorpheme().toString());
if ... |
82706d3d-3a88-44cd-8780-0dc06169986a | 3 | private void save_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_buttonActionPerformed
for (int i = 0; i < rubric_table.getColumnCount(); i++) {
try {
GradeAccess.enterGrade(studentID, courseID, actName,
rubric_table.getModel().getValueAt(i, 0).toString(),
Float... |
cdcbaa0b-8960-4a97-8657-b6e580e4d833 | 2 | public void roll(int pins) {
frames[currentIndex].addRoll(pins);
if (frames[currentIndex].isFull()) {
if (currentIndex != 0) {
frames[currentIndex - 1].setNextFrame(frames[currentIndex]);
}
currentIndex++;
}
} |
9104d6b2-e02b-41ee-a39d-122b0f6b529f | 7 | public static void hookdr_f77(int n, double x[], double f[], double g[],
double a[][], double udiag[],
double p[], double xpls[], double fpls[],
Uncmin_methods minclass,
double sx[], double stepmx[],
... |
de60a550-1e40-451b-b9f2-8cc76a7aa12f | 8 | private static void dfs(int i, int j, int cost, int time) {
if (!inBoard(i, j) || cost >= costs[i][j]) {
return;
}
costs[i][j] = cost;
if (board[i][j] == '*') {
return;
}
if (time == k) {
return;
}
dfs(i - 1, j, boar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.