method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7028135c-fade-43ea-846a-0c91dd031a34 | 6 | @Override
public void run() {
while(running){
try{
if(inStream.available() > 0){
gameTime = inStream.readDouble();
gamePeriod = inStream.readInt();
gameState = inStream.readInt();
playerArray = (int[][]) inStream.readObject();
for(int i=0;i<3;i++){
ballArray[i] = inS... |
674ff6fe-6fd7-4f84-8906-fda7b9fc48ed | 8 | @Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
System.out.println(action);
if (action == "W") {
keyState.W = true;
}
if (action == "released W") {
keyState.W = false;
}
if (action == "A") {
keyState.A = true;
}
if (action == "rel... |
5789e99d-72a6-41f6-bfbf-7303c9180f8d | 5 | private static boolean endsWith_cvc(final String word)
{
char[] c = word.toLowerCase().toCharArray();
if (c.length >= 3)
{
if (isConsonant(c[c.length - 3], c[c.length - 4]) && // c
!isConsonant(c[c.length - 2], c[c.length - 3]) && // v
isConsonant(... |
f9172e0c-1fe9-4c41-b01f-8c3e64bc6c86 | 0 | private UtilityClass() {
throw new AssertionError();
} |
2525b14d-30ae-4358-9ad4-b8e81b9ebeef | 1 | public Card getCard() {
Card c;
cardGetter = myCards.iterator(); // Start from beginning each time
int next = (int) (Math.random() * size()) + 1;
c = cardGetter.next();
for (int i = 1; i < next; i++) {
c = cardGetter.next();
}
cardGetter.remove(); // ... |
cca8538e-0051-4b70-8d3a-67cfef3e4507 | 1 | @Override
public void onNextTetrominoesChanged(List<Tetromino> tetrominoes) {
for (int i = 0; i < tetrominoes.size(); i++) {
next.get(i).setTetromino(tetrominoes.get(i));
}
} |
ada47424-4f4b-495e-ba5b-97aa2dd04c45 | 4 | public static String lettersToPractice(String letters, int[] times)
{
StringBuilder sb = new StringBuilder();
float avg = 0;
int[] r = new int[times.length];
for(int i = 0; i < times.length; i++)
{
if(i == 0) { r[i] = times[i]; avg += r[i]; }
else { r[i] = times[i] - times[i - 1]; avg += r[i]; }
... |
cab0937b-bd73-4052-b916-b646ba409099 | 5 | static public boolean isValidValueName(String name)
{
int i;
for(i = 0; i < name.length(); i++)
{
char c = name.charAt(i);
if(!(Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-'))
{
return false;
}
}
return true;
} |
b9d6d3cc-b94f-4725-9014-653f6d7e6edd | 6 | public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
cp.newUTF8("Deprecated");
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
cp.newUTF8("Synthetic");
}
c... |
6be7ddf7-5b38-4692-965d-e519a78e5875 | 3 | public static ParsableCommand getCommandFromLetter(String identifier) throws Exception{
if(_commandList != null){
for(int i=0; i<_commandList.length; i++){
if(_commandList[i].getIdentifier().equals(identifier)){
return _commandList[i];
}
... |
5188c4f6-b9d8-444c-a159-63c6679f42ad | 9 | public void update(float delta) {
int nBlocks=0;
processInput();
processCollisions();
// We update the ball and check how many blocks are left
for (Entity entity : world.getEntities()) {
entity.update(delta);
if (entity.getObjectID() == ObjectIDType.BALL) {
if (((Ball)entity).getState()==Ball.State.... |
277027ca-9aee-40ef-8ff8-2312b5d89fb2 | 8 | protected boolean createPath(Lane next)
{
fPath.add(next);
if(next.equals(fEnd))
{
return true;
}
//draw((Graphics2D)(next.getGlobals().getMap().getGraphics()),new Candidate(next));
Collection<Lane> candidates = next.getEnd().getOutputLanes();
List<Ca... |
a3991e95-47d0-4786-a451-8587c8097fe5 | 6 | public boolean userHasGamedSaved(User user) {
File file = new File("Users.txt");
Scanner scanner;
try {
scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String lineFromFile = scanner.nextLine();
if(lineFromFile.contains(user.getUsername())) {
lineFromFile = scanner.nextLine(... |
49244877-6bdb-4bcb-93a2-b095da298a6c | 7 | public void updateGame(double time) {
if (getHero().getPlayerLose()) {
updatesBeforeLoseMade++;
if (updatesBeforeLoseMade > UPDATES_BEFORE_LOSE_SCREEN) {
isRunning = false;
}
}
for (MovingObject unit : LevelDesign.getFrameDesigns().get(current... |
b3ebc3ca-2e90-41e2-bad8-c5e727673092 | 2 | private boolean jumpingEnemy(Move m) {
int dx = (m.getCol1() - m.getCol0()) / m.length();
int dy = (m.getRow1() - m.getRow0()) / m.length();
for (int i = 1; i < m.length(); i++) {
if (_contents[m.getRow0() + i * dy - 1][m.getCol0() + i * dx - 1].
side() == turn().... |
2278c997-0280-4fe4-8303-f2e13d6bd8a0 | 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 fe... |
f893ed82-6d0b-4f4e-b042-381cbe64960c | 1 | @Override
public String inferBinaryName(Location location, JavaFileObject file) {
if (file instanceof UrlJavaFileObject) {
UrlJavaFileObject urlFile = (UrlJavaFileObject) file;
return urlFile.getBinaryName();
} else {
return super.inferBinaryName(location, file);
... |
18e3b4ac-22c4-44df-b6b4-27dc9a2a97f9 | 5 | public static void readInput(int where, Object[] stringPath) {
String path = (String)stringPath[0];
File file = null;
FileReader fr = null;
BufferedReader br = null;
String text = "";
try {
file = new File (path);
fr = new FileReader (file);
br = new Buffer... |
1c3391a5-a2a5-4eb8-bd93-dc9d9dd7f2f4 | 2 | @Override
public boolean canDeleteSelection() {
if (mDeletableProxy != null && !mSelectedRows.isEmpty()) {
return mDeletableProxy.canDeleteSelection();
}
return false;
} |
f60bb0a8-f991-47fa-aea1-5ab23260ddee | 2 | public static LinkedList<String> getInputNatureList()
{
LinkedList<String> l = new LinkedList<String>();
try
{
BufferedReader in = new BufferedReader(new FileReader(
"nature-of-input.lst"));
String algo;
while ((algo = in.readLine()) != null)
l.add(algo);
in.close();
}
catch (IOExceptio... |
930bb278-abf4-494a-bfc9-d51e2d6ed820 | 0 | public static ImageIcon getImageIcon(String name){
return new ImageIcon(Resources.class.getResource(name));
} |
f545f54f-e562-43e0-934a-34871866dbcc | 4 | public void atualiza(double taxa){
if(cliente != null){
if(cliente.getTipoCliente() == TipoCliente.UNIVERSITARIO){
this.saldo += this.saldo * taxa * TipoCliente.UNIVERSITARIO.getMultiplicador();
}else
if(cliente.getTipoCliente() == TipoCliente.CORPORATIVO... |
e382f3a2-b1a9-40f9-8427-cc7d40b81455 | 8 | static void floodFill( int i,int j, char targetColor ){
Queue<Integer> posX = new LinkedList<Integer>();
Queue<Integer> posY = new LinkedList<Integer>();
posX.add(i);
posY.add(j);
visitados[i][j] = true;
while(!posX.isEmpty()){
int x = posX.poll();
int y = posY.poll();
for (int k = 0; k < dx.lengt... |
66016708-622b-4712-90bd-2949dcb720b7 | 3 | protected void checkLogFile() {
if (printWriter != null)
return;
try {
printWriter = new PrintWriter( new BufferedWriter(new FileWriter(logFilePath)));
}
catch (IOException e) {
System.err.println("Error creating log file " + logFilePath);
... |
8b8bacb6-2811-45bb-96a7-39b7e093f8bd | 9 | private boolean refreshJTable()
{
try
{
try
{
this.jtblProcessList.removeAllRows();
} catch (Exception localException1) {
}
for (int i = 0; i < this.alCurrentDisplayedProcesses.size(); i++)
{
if (this.filterEnabled_ProcessList)
{
this.addPr... |
637412da-9e74-45e2-acef-30fd21670367 | 4 | public int _flushKey(int key) throws RegistryErrorException
{
try
{
Integer ret = (Integer)flushKey.invoke(null, new Object[] {new Integer(key)});
if(ret != null)
return ret.intValue();
else
return -1;
}
catch (InvocationTargetException ex)
{
throw new Regis... |
7909d24b-3d6f-4f74-9268-b374eb9ad6e6 | 2 | private void initUi() {
JMenuBar menuBar = new JMenuBar();
JMenu factMenu = new JMenu("Facts");
JMenu ruleMenu = new JMenu("Rules");
menuBar.add(factMenu);
menuBar.add(ruleMenu);
//-------------
// ADD FACT
//-------------
JMenuItem ... |
6d93df6e-e6e2-44e7-9be5-47ad206d4dc9 | 0 | @Override
public String getGUITreeComponentID() {return this.id;} |
658d2c8c-b770-4401-8af0-5600636d970d | 7 | public static boolean eliminarSucursal (String ip) {
Document doc;
Element root;
List <Element> rootChildrens;
boolean found = false;
int posAEliminar = 0,posIzquierda = 0,posDerecha = 0;
SAXBuilder builder = new SAXBuild... |
07cb1d56-0056-4146-8394-d91b48590e75 | 1 | protected boolean centerCause(int x1, int x2, int y1, int y2, int r1, int r2){
double d = pow(x2 - x1, 2) + pow(y2 - y1, 2);
if (d <= pow(r1, 2)){
return true;
}
else {
return false;
}
} |
fc8cb9bd-547e-4064-a546-45dbcf460d5a | 2 | public static void selectDownText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
int currentPosition = textArea.getCaretPosition();
if (currentPosition == textArea.getText().length()) {
return;
}
// Update Preferred Caret Position
... |
d7dc6b36-5c92-472d-b130-fb1b65bf329f | 9 | public SemanticRec term(Attribute formalParam) {
SemanticRec factor;
SemanticRec ft;
SemanticRec term = null;
debug();
switch (lookAhead.getType()) {
case MP_IDENTIFIER:
case MP_FALSE:
case MP_TRUE:
case MP_STRING_LIT:
case MP_FLOAT_LIT: /... |
0801eca9-c942-425b-908f-c37aa1a1b4b0 | 9 | public Queue<String> enfermeroXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... |
0a5689a0-026a-465b-b8ad-5d0bd0feed75 | 5 | public IVPBoolean lessThan(IVPNumber num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){
... |
216f4e34-b3a9-456b-bb8b-6a0366a00650 | 0 | @Override
public String getDesc() {
return "PulseStrike";
} |
bbdcf2d9-1110-4a78-8cc5-2c7cbc5ed6c3 | 4 | public static int maxPathSum2(TreeNode root) {
if(root == null) return 0;
if(root.left == null && root.right == null) return root.val;
//helper[0] min, helper[1] leftMax, helper[2] rightMax
int[] helper = new int[3];
int max = 0;
helper[0] = Integer.MIN_VALUE;
... |
e3852c42-1bee-42cf-9d18-1259381d59c2 | 2 | private int calcBiggestFeasible (int currentQuantity, Set<Integer> productPackCapacitySet) {
int bf = 0;
int i;
for (i = currentQuantity; i >= 1; i--) {
if (productPackCapacitySet.contains(i)) {
bf = i;
return bf;
}
}
return bf;
} |
e7f32fec-7575-4371-bb5e-ab8687034937 | 2 | */
protected String withBookkeepingInfo() {
String projectName = "nil";
if (project != null) {
projectName = project.stringApiValue();
}
String cyclistName = "nil";
if (cyclist != null) {
cyclistName = cyclist.stringApiValue();
}
return "(with-bookkeeping-info (new-bookkeep... |
cbd818c6-2e1d-4c0e-83c7-15d1e136961a | 3 | private void AbstractMatterAction(Tile tile) {
if (selected.getClass().getSuperclass() == City.class) {
if (selected.tile == tile) {
createUnit(tile);
}
}
if (selected.getClass().getSuperclass() == Unit.class) {
move(tile);
}
} |
de39ba6e-b1e8-4d11-ac0e-f3d4cf0bf9bd | 2 | private String searchingFile(final String name) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(file));
try {
String line;
while ((line = br.readLine()) != null) {
StringTokenizer str = new StringTokenizer(line, ",");
if ... |
d2c3090e-2440-42e4-90f3-7aae71afb0c4 | 7 | public int equi ( int[] A ) {
// write your code here
int equilibrium = -1;
int arraySize = A.length;
int[] upwardCount = new int[arraySize];
int[] downwardCount = new int[arraySize];
for (int i = 0; i < arraySize; i++){
//case where we are on the first element
if (i == 0... |
dd50f95c-a886-4dfd-8ffa-c9ae5e07fd1c | 6 | public void createAndSaveLocs(){
File file = new File(this.getDataFolder(), "arenaLocs.yml");
try {
if(!this.getDataFolder().exists()){
this.getDataFolder().mkdir();
}
file.createNewFile();
FileConfiguration yaml = YamlConfiguration.loadConfiguration(file);
if(this.l != null && this.l.getSpawn() ... |
7b484d89-40cc-4223-93dd-ae97485e9750 | 3 | private boolean second_round_strategy() {
if (bowlId == 0) maxScoreSoFar = 0;
if (bowlId < chooseLimitTwo) {
maxScoreSoFar = Math.max( maxScoreSoFar, get_bowl_score(bowl) );
System.out.println("Not reached chooseLimit yet, updated maxScoreSoFar = " + maxScoreSoFar);
... |
c480af17-20c4-4589-88dd-1572be3bbb17 | 8 | @Override
public void updateTitle()
{
final List<Room> V=getAllTitledRooms();
final String owner=getOwnerName();
final int price=getPrice();
final boolean rental=rentalProperty();
final boolean gridLayout = gridLayout();
final int back=backTaxes();
String uniqueID="ROOMS_PROPERTY_"+this;
if(V.size()>0... |
15540cd3-04d6-4832-b148-e9fb6661bfac | 8 | private void splitHelper(String s, int pos, int seg) {
if (seg == 4 && pos == s.length()) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4; i++) {
if (i > 0)
sb.append(".");
sb.append(buff[i]);
}
r... |
9c6bafc1-73e7-4a98-87c8-8ace85895771 | 8 | @Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.drawOval(WIDTH / 2 - TABLE_DIAM... |
9ea17d30-662f-4fdd-b99e-658b6bdf1e4f | 4 | public static String rotateAlgorithm(String alg) {
List<Integer> FPos = new ArrayList<Integer>();
for (int i = 0; i < alg.length(); i++) {
if (alg.charAt(i) == 'F') {
FPos.add(i);
}
}
alg = alg.replace('R', 'F');
alg = alg.replace('B', 'R');
alg = alg.replace('L', 'B');
for (int i : FPos) {
a... |
4bad861e-6107-4bf5-a89a-a9e336f1879f | 4 | private static String replaceSubstitutionVariables(String pParsedStatementString, PromotionFile pPromotionFile)
throws ExLoader {
//Replace variables only if one exists and a property has not been set instructing not to substitute
if(pParsedStatementString.indexOf("$${") > 0){
if(!"true".equals(p... |
6db7cbad-1f89-4f54-b37e-838f2ed52bb3 | 0 | public static void main(String[] args) {
final int WIDTH = 800;
final int HEIGHT = 600;
final String TITLE = "Test frame 12345";
JFrame frame = new JFrame();
frame.setSize(WIDTH, HEIGHT);
frame.setTitle(TITLE);
frame.setResizable(false);
frame.setLocation... |
38a8c2ac-00de-4d55-a4f7-1275c80ca7d6 | 9 | public static Description findDuplicateComplexDescription(Description self) {
{ IntegerWrapper index = IntegerWrapper.wrapInteger(Proposition.propositionHashIndex(self.proposition, null, false));
List bucket = ((List)(Logic.$STRUCTURED_OBJECTS_INDEX$.lookup(index)));
Module homemodule = self.homeContext... |
c85fbc80-87bb-47ee-abb6-3bb50e60b557 | 9 | public static Cons clTranslateMethodParameters(MethodSlot method) {
{ boolean functionP = method.methodFunctionP;
boolean abstractP = method.abstractP;
Cons otree = Stella.NIL;
Stella_Object oparameter = null;
Stella_Object firstparametertype = null;
{ Symbol parameter = null;
... |
2cf29517-d873-4f9e-b41c-f8dae33ac093 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Hospede other = (Hospede) obj;
if (this.IdHospede != other.IdHospede && (this.IdHospede == null || !this.... |
96516d86-203a-41b4-bf69-949bf147adc9 | 2 | @Override
public String toString() {
return (isLof() ? "LOF=" + toStringVcfLof() + " " : "") //
+ (isNmd() ? "NMD=" + toStringVcfNmd() : "") //
;
} |
895449eb-9a3f-4786-819a-3109c84a4fdc | 1 | public void Initialize() {
try {
Class.forName(this.dbDriver);
}
catch (ClassNotFoundException ex) {
System.out.println("Impossible d'initialiser le driver.\n" + ex.getMessage());
}
} |
e7249ca7-4c37-490c-80fb-372660e34f2c | 9 | private ValCol negaMaxWithABPruning(int depth, int counter, int sign,
int alpha, int beta) {
if (isStopSignaled) {
return null;
}
if (boardCopy.gameOver() || depth == depthLimit) {
int util = (int) (Math.pow(discountFactor, depth) * sign * boardCopy.getAnalysis(counter));
return new ValCol(util, -1);/... |
71b7206d-6ca9-4b23-9a9c-60cc23ba0d77 | 8 | private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed
if (camposobrigatoriospreenchidos()) {
if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja Gravar esta operação e de que todas as informações estçao corretas?", "Deseja gravar?... |
988b8152-eaae-4bb4-905a-f1659385b840 | 7 | public static void main(String args[]) {
//**********************************************************************************************************************
//**********************************************************************************************************************
// <editor-fo... |
66c635a9-bac9-4840-9fc8-5f84524c86ba | 2 | public static int getCRuleID(String name)
{
for(int i = 0; i < numCRules; i++)
{
if(cRules[i].name().equalsIgnoreCase(name))
{
return i;
}
}
return -1;
} |
507c39f9-b436-4cd9-a933-324b5692e8c8 | 1 | public void tallennaTiedostoon(){
if (kasittelija.getFile() != null) {
kasittelija.muokkaaTiedostonTiettyjaRiveja(kerrattavat);
}
} |
363a6b77-54df-4ed9-a271-f3b2f29ef227 | 3 | public static Attributed readAttrs2(Reader source){
Scanner in = new Scanner(source);
Pattern COMMENT = Pattern.compile("#.*");
Pattern attrPat = Pattern.compile("(.*?)=(.*)$", Pattern.MULTILINE);
String comment;
AttributedImpl attrs = new AttributedImpl();
while(in.hasNext()){
if(in.hasNext(COMMENT)){
... |
7276b884-57ff-45cc-9d51-66e1e4c518bc | 1 | public void addCard(Card c) {
if (c == null)
throw new NullPointerException("Can't add a null card to a hand.");
hand.add(c);
} |
1e0494c7-2778-45c8-9a44-1ab378e6ae56 | 0 | public void setEventBranchList(final List<EventBranch> eventBranchList) {
this.eventBranchList = eventBranchList;
} |
e4308b75-9bcd-4a40-b682-7dbdac1369ba | 6 | public boolean detachNext(Linkable paramLinkable) {
boolean b = false;
Object localObject;
if ((paramLinkable instanceof Instruction))
{
localObject = (Instruction)paramLinkable;
if ((((Instruction)localObject).getPreviousInstruction() == null) && (this.CurrentProgram.getFirstInstruction() =... |
be0a4ae3-bb95-41c5-9137-0f9e75137806 | 4 | public void removeAttendantFromCourse(int courseId, int studentId) {
if(!isValidId(courseId) || !isValidId(studentId)) {
return;
}
Course course = courseDao.getCourse(courseId);
Student student = studentDao.getStudent(studentId);
if(course != null && student != null) {
course.getAttendants().rem... |
a95dcc48-0132-467a-bcce-572584faeaa8 | 1 | public List<String> num2words(String phoneNum) {
// List to store all words
List<String> wordList = new ArrayList<String>();
// Extract number, ignore whitespace and punctuation
String _phoneNum = extractPureNumbers(phoneNum);
// Get Phone Number Combinations
List<String> combinations = getNumCombination... |
bcdbba74-f7ab-4ceb-8a09-a80026a5cbd0 | 4 | private final void gotoBand(final Git gitSession) {
if (gitSession == null) {
return;
}
try {
final String branch = gitSession.getRepository().getBranch();
if (!branch.equals(this.BRANCH.value())) {
this.io.printMessage(
null,
"Not on working branch \"" + this.BRANCH.value()
+ "\"... |
6715d539-3979-46f1-b2fc-7e8bc300c217 | 8 | public static String preProcess(Reader reader) {
int columnStart = 6;
int columnEnd = 72;
try {
// FileInputStream propsStream = new FileInputStream("cb2xml.properties");
Properties props = new Properties();
// props.load(propsStream);
// pro... |
2db53ca0-7c73-4f70-b733-6ef4501a5004 | 1 | public void NotifyRunModeChanged(boolean isLocalRunMode) {
for (IRunModeChangedNotification rmc : runModeChangedNotificationListeners) {
rmc.onRunModeChanged(isLocalRunMode);
}
} |
eee6ea02-698d-47c5-85c1-51a2a881cd5c | 3 | public HashMap printCliche() throws Exception
{
ArrayList<Integer> answer = this.device.send(0x52, 3, new char[]{});
if (answer.size() == 0)
throw new Exception("Пустой ответ");
HashMap<String, Integer> result = new HashMap<String, Integer>();
if (answer.get(0) == Statu... |
fb31fb71-5dd8-4a52-a3dc-e8d4c6178d36 | 0 | public void setSuccess(final Boolean success) {
this.success = success;
} |
8feba7d3-1899-483a-93cc-307e484a6cfa | 1 | public static void toggleCommentText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
toggleCommentForSingleNode(currentNode, undoable);
if (!undoable.isEmpty()) {
undoable.setName("Toggle Comment for Node");
... |
fa5404ed-62e3-495f-9a3a-4594e221ce91 | 1 | public void testWithField_unknownField() {
MonthDay test = new MonthDay(9, 6);
try {
test.withField(DateTimeFieldType.hourOfDay(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
9c7148cc-46a6-442a-bf25-afe96f083f64 | 6 | public String getwinner(){
if(stateArrayList[0].size()>stateArrayList[1].size() && stateArrayList[0].size()>stateArrayList[2].size())
return "blue";
if(stateArrayList[1].size()>stateArrayList[0].size() && stateArrayList[1].size()>stateArrayList[2].size())
return "green";
... |
c9c4756d-3e8b-4cf1-831f-38eef7a24edd | 1 | private PreparedStatement buildUpdateStatement(Connection conn_loc, String tableName,
List colDescriptors, String whereField)
throws SQLException {
StringBuffer sql = new StringBuffer("UPDATE ");
(sql.append(tableName)).append(" SET ");
final Iterator i = colDescriptors.i... |
54348805-a04b-49af-a8aa-2448b0081df2 | 7 | public static void main(String args[]){
int op = 6;
//lea.useDelimiter(System.getProperty("line.separator"));
do{
try{
System.out.println("1- Agregar Cuenta");
System.out.println("2- Agregar Amigo");
System.out.println("3- Info... |
d8b7c828-61a1-4164-bf0f-e1793518d5f2 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Conta other = (Conta) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
ret... |
215a978a-b122-462d-bf53-d0ace8868335 | 0 | public static TypePraticien selectOne(EntityManager em, String code) throws PersistenceException {
TypePraticien unTypePraticien = null;
unTypePraticien = em.find(TypePraticien.class, code);
return unTypePraticien;
} |
088aa052-dd8d-4782-9cfb-db70d4937587 | 3 | @Override
public int compareTo(Object o) {
if (o instanceof Score) {
long otherScore = ((Score) o).getScore();
if (otherScore > _score)
return -1;
else if (otherScore < _score)
return 1;
else {
return -_date.comp... |
18546597-ba5f-449b-994e-b0d608b49d1d | 4 | public static ENCODE vauleOf(String value){
if(value.equalsIgnoreCase(ENCODE.Big5.getValue())){
return ENCODE.Big5;
} else if(value.equalsIgnoreCase(ENCODE.UTF8.getValue())){
return ENCODE.UTF8;
} else if(value.equalsIgnoreCase(ENCODE.MS950.getValue())){
return ENCODE.MS950;
} else if(value.equalsIgnor... |
38ff4da3-7f56-4056-91c1-102f312ddb14 | 5 | private float getRatioTop20() {
BigDecimal elapsedTimeTop20 = new BigDecimal(0);
BigDecimal elapsedTimeTotal = new BigDecimal(1);
Connection connection = ConnectionPoolUtils.getConnectionFromPool();
try {
PreparedStatement elapsedTop20Statement = connecti... |
c48deea1-e225-4695-9770-18dc8ca8c9d2 | 7 | private int merge(BufferedRandomAccessFile fin, DataOutputStream fout, long offset, long chunkSize, int[][] blocks) throws IOException {
long size1 = fin.length();
if (offset >= size1) {
return -1;
}
int chunkCount = 1;
while (offset + chunkCount * chunkSize < siz... |
fa88ad86-c947-484d-b622-fbc89035d697 | 3 | public void setDateFormatString(String dateFormatString) {
try {
dateFormatter.applyPattern(dateFormatString);
} catch (RuntimeException e) {
dateFormatter = (SimpleDateFormat) DateFormat
.getDateInstance(DateFormat.MEDIUM);
dateFormatter.setLenien... |
36f5e3f9-67d1-4f78-9355-527c8d21e580 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int[] v = readInts(line);
if (v[0] == 0 && v[1] ==... |
09794c23-f22d-4707-ad58-be2a48d482ed | 6 | @Override
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
Mission mission = null;
//如果获取输出对象有问题,不要往下运行了
OutputStream os = response.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
InputStream is = request.getInputStre... |
95aa88d3-f50c-4998-959c-666a4a72668d | 6 | private void merge( int[] array, int b1, int e1, int b2, int e2 ) {
int i = b1;
int j = b2;
int k = 0;
int[] tempArray = new int[ e2-b1+1 ];
while( i <= e1 && j <= e2 ) {
if( array[i] < array[j] ) {
tempArray[k++] = array[i++];
} else {
tempArray[k++] = array[j++];
}
}
while( i <... |
dc394f41-3878-45c5-a63f-e18af2ad6d10 | 6 | @Override
public void keyReleased(KeyEvent ke) {
if (ke.getKeyCode() == KeyEvent.VK_UP) {
palkki2.setNopeus(0);
} else if (ke.getKeyCode() == KeyEvent.VK_DOWN) {
palkki2.setNopeus(0);
}if(ke.getKeyCode() == KeyEvent.VK_W){
if(peli.getClass()==kPeli.getClas... |
b98f6de2-1375-4d75-8a7f-55e88f5051bf | 8 | public static void transferFiles(Cons files, Keyword outputLanguage) {
if (Stella.stringEqlP(Stella.rootSourceDirectory(), Stella.rootNativeDirectory())) {
return;
}
{ String flotsamfilename = "";
String systemSubDirectory = (Stella.stringEqlP(((String)(Stella.$CURRENTSYSTEMDEFINITIONSUBDIRECTOR... |
bf80db3f-7fd0-4610-b225-6629fe4c563d | 3 | public static Portal getPortal( String name ) {
for ( ArrayList<Portal> list : portals.values() ) {
for ( Portal p : list ) {
if ( p.getName().equalsIgnoreCase( name ) ) {
return p;
}
}
}
return null;
} |
b46ab29d-d491-469e-b0ab-8c6aa0095b7f | 0 | public boolean isAttacking() {
return attacking;
} |
b232ded1-4608-4776-a176-51fe9202fb9d | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Semaphore other = (Semaphore) obj;
if (id == null) {
if (other.id != null)
return false;
} else {
if (!id.equals(other.id))
ret... |
67cef016-6386-4a80-a683-c5d6f7f98aa7 | 6 | private void setAlpha(int delta){
int swing = 0;
if (hours >= 20 || hours < 6){
alpha = max;
}
else if (hours >= 6 && hours <= 8){
swing = -1;
}
else if (hours >= 18 && hours < 20){
swing = 1;
}
else{
alpha = min;
}
alpha += swing * rate * delta / 1000.0;
} |
eb625844-2b87-4ddf-9f0a-066e59fad919 | 6 | static boolean tagcompare(byte[] s1, byte[] s2, int n){
int c=0;
byte u1, u2;
while(c<n){
u1=s1[c];
u2=s2[c];
if('Z'>=u1&&u1>='A')
u1=(byte)(u1-'A'+'a');
if('Z'>=u2&&u2>='A')
u2=(byte)(u2-'A'+'a');
if(u1!=u2){
return false;
}
c++;
}
r... |
08f9d996-3d84-4111-a935-2b253159d943 | 7 | @Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource() == close)
{
player.Stop();
controller.removePlayer(player);
dead=true;
newWindow.dispose();
}
if(arg0.getSource() == static_Open || arg0.getSource() == addSong)
{
JFileChooser choo... |
3fd2a280-90e9-4c41-b092-98a4fbe1b2f9 | 8 | private void openExperiment() {
int returnVal = m_FileChooser.showOpenDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File expFile = m_FileChooser.getSelectedFile();
// add extension if necessary
if (m_FileChooser.getFileFilter() == m_ExpFilter) {
if... |
a11749b8-2a16-47d1-9690-363b6432bcb8 | 8 | static final Class252 method2300(IndexLoader class45, String string,
boolean bool, byte i) {
try {
anInt3877++;
int i_0_ = class45.getArchiveId(string);
if (i != -91)
return null;
if ((i_0_ ^ 0xffffffff) == 0)
return new Class252(0);
int[] is = class45.getActiveChildren(i_0_);
... |
349dfed4-2a25-4699-8bcd-fce031a4be49 | 7 | public static Spell getAirSpell(int i)
{
switch (i)
{
default:
case 0:
return new Airbending();
case 1:
return new AirbendingJump();
case 2:
return new AirbendingTornado();
case 3:
... |
c6afaed2-37dc-47e8-baa1-3c4dc9755b59 | 7 | public int getRomanValue(char c) {
switch (c) {
case 'I':
return 1;
case 'V':
return 5;
case 'X':
return 10;
case 'L':
return 50;
case 'C':
return 100;
case 'D':
return 500;
case 'M':
return 1000;
default:
return 0;
}
} |
6ae5139a-c633-4aca-96db-6e1c6218d9b7 | 9 | public static void Merge(int[] n, int start, int middle, int finish)
{
int i = start, j = middle + 1;
int m[] = new int [finish - start + 1];
boolean jDone = false, iDone = false;
for(int k = 0; k < m.length; k++)
{
if(!jDone && n[i] > n[j] || iDone)
{
m[k] = n[j];
j++;
if(j > finish)... |
54320ff1-a9a4-4f39-9927-e180b13d0c55 | 4 | public int stackSize() {
switch (typecode) {
case TC_VOID:
return 0;
case TC_ERROR:
default:
return 1;
case TC_DOUBLE:
case TC_LONG:
return 2;
}
} |
90925619-6a4a-488b-9338-0453704368b9 | 1 | public void initializeDB() {
try {
// Load the JDBC driver
Class.forName("org.postgresql.Driver");
System.out.println("Driver loaded");
// Establish a connection
String url = "jdbc:postgresql://ozguryazilim.bilkent.edu.tr/projectsme";
/* String user = "user12";
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.