method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cfc1717c-930e-4257-99cb-c4d276062cfc | 4 | private void readFromFile(Reader reader) {
BufferedReader buffReader = new BufferedReader(reader);
if (buffReader != null) {
try {
String tempLine;
tempLine = buffReader.readLine();
while (tempLine != null) {
readFromLine(tempLine);
... |
77bc2c76-2b65-462f-bf2e-caab348abea9 | 4 | private AggregationCondition.Type translateAggregationType(
String aggregationStr) throws AggregationTypeInvalidException {
if (aggregationStr.toLowerCase().equals("avg")) {
return AggregationCondition.Type.average;
} else if (aggregationStr.toLowerCase().equals("sum")) {
... |
7f1ee3de-2d23-43f3-8450-1fdf093d7d2d | 7 | double evaluateInstanceLeaveOneOut(Instance instance, double [] instA)
throws Exception {
DecisionTableHashKey thekey;
double [] tempDist;
double [] normDist;
thekey = new DecisionTableHashKey(instA);
// if this one is not in the table
if ((tempDist = (double [])m_entries.get(thekey)) == nu... |
6fa15854-aceb-4f31-ac36-aa877a385bb6 | 0 | @Test
public void testSave() {
Blog blog = new Blog();
blog.setBlogContentLable("uhasdjrfnwoenfhuebnui");
blog.setBlogContent("uhasdjrfnwoenfhuebnuidhasfoeahondashfsosenfoewhfioenroenf");
blog.setCreatedDate(new Date());
blogModelDao.save(blog);
} |
5f74f64c-9096-4e72-8a0c-614d6db43f06 | 7 | public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
Res... |
6dbc2d04-0b01-408d-86c0-e2a4e29ff75f | 3 | @Override
public boolean vorbedingungErfuellt(ServerKontext kontext, Spieler spieler,
Befehlszeile befehlszeile)
{
// Wenn eine Katze oder eine Maus gefüttert werden könnte
Raum raum = kontext.getAktuellenRaumZu(spieler);
return ((raum.hasKatze() && !raum.getKatze().isSatt()) || raum
.hasMaus()) && spiel... |
5dcad470-09ce-4be8-807e-9ab26a0ef08c | 5 | private void setMachineFailed(boolean b, int numFailedMachines)
{
Machine mach;
/************/
String status = null;
if (record_ == true) {
if (b)
status = "FAILED";
else
status = "WORKING";
}
/************/
... |
adc8daab-b3bf-452d-b89a-66a2bc6a13ed | 3 | public void updateAllFrames() {
if(game.isGameOver()){
notifyGameOver();
return;
}
GameFrame toFront = null;
for(Map.Entry<Player, GameFrame> e : allGameFrames.entrySet()){
GameFrame frame = e.getValue();
if(e.getKey().getName().equals(game.getCurrentPlayer().getName())){
toFront = frame;
... |
1ee42272-51f8-4a31-befb-8b1ffb9493b2 | 2 | public byte[] hex2byte(String hex) throws IllegalArgumentException {
if (hex.length() % 2 != 0) {
throw new IllegalArgumentException();
}
char[] arr = hex.toCharArray();
byte[] b = new byte[hex.length() / 2];
for (int i = 0, j = 0, l = hex.length(); i < l; i++, j++) {
String swap = "" + arr[i++] + ... |
aa274926-bfa2-405a-b98d-e802b258aebf | 6 | public void drawPalette(int spanInPixels, int heightInPixels,
TerrainTypes desiredTerrain, Vector<Boolean> desiredFeatures) {
TerrainTypes[] allTypes = TerrainTypes.values();
int numCells = allTypes.length;
int internalMarginInPixels = (spanInPixels - numCells * hexW... |
20c75c12-63d8-47a5-94f6-da5b077dc387 | 5 | @EventHandler(priority = EventPriority.NORMAL)
public void onCreatureSpawn(final CreatureSpawnEvent event) {
if (plugin.getConfig().getBoolean("ENABLE_BLACKLIST")) {
World world = event.getLocation().getWorld();
if (!new File(plugin.getDataFolder() + File.separator + "mobblist",
world.getName() + ".txt").... |
2c836d6e-277c-43a8-8f7c-0bde274a1dcd | 8 | public void start() {
int i = 0;
for (; i < 8; i++) {
pieces[i] = new Pawn();
pieces[i].color = Color.WHITE;
pieces[i].alive = true;
pieces[i].position.y = 2;
pieces[i].position.x = i + 1;
}
for (; i < 16; i++) {
pieces[i] = new Pawn();
pieces[i].color = Color.BLACK;
pieces[i].alive = t... |
8f035efb-c494-474d-a654-8c39933760a9 | 8 | public double [] distributionForInstance(Instance instance) throws Exception {
if (m_Train.numInstances() == 0) {
throw new Exception("No training instances!");
}
if ((m_WindowSize > 0) && (m_Train.numInstances() > m_WindowSize)) {
m_kNNValid = false;
boolean deletedInstance=false;
... |
f899a806-adec-4d33-9033-933390d50aad | 8 | public static void main(String[] args) {
Context context = null;
ConnectionFactory factory = null;
Connection connection = null;
String factoryName = "ConnectionFactory";
String destName = null;
Destination dest = null;
Session session = null;
MessageConsu... |
baa0218a-35e6-4ed9-8bb3-4fa8f4930ebe | 2 | @GET
public Response facebookAuthorization(@QueryParam("code") String code) {
if (code != null) {
facebookManager.setAccessCode(code);
return Response.ok(Response.Status.OK).build();
} else {
try {
return Response.temporaryRedirect(
new URI(facebookManager.getAuthorizationUrl())).build();
} c... |
1a0b332a-9f2d-424f-9ffa-3cfd12168b3c | 5 | public final void spawnMist(final MapleMist mist, final int duration, boolean poison, boolean fake) {
spawnAndAddRangedMapObject(mist, new DelayedPacketCreation() {
@Override
public void sendPackets(MapleClient c) {
c.getSession().write(MaplePacketCreator.spawnMist(mist)... |
413b23fa-0249-49d1-8e7d-6d28c9d825b4 | 0 | public void setDao(SampleDao dao) {
this.dao = dao;
} |
5cfeb45b-8343-488a-bbd3-01ea948792dd | 0 | @Override
public void restoreTemporaryToDefault(){tmp = new Color(def.getRGB());} |
48967d94-5b65-43bb-8609-6e5bd3a5ee30 | 1 | @Override
public T extract() throws NoSuchElementException {
T returnValue = peek();
map.remove(returnValue);
PQElement<T> z = heap.remove(heap.size() - 1);
if (!heap.isEmpty()) {
set(0, z);
rotateDow... |
984fd8a5-f0d9-42d6-8a73-d6c5c19461b9 | 7 | private void incrementRcvdMessages(String src_name) {
if(rcvdCount.get(src_name) == null)
rcvdCount.put(src_name, 1);
else
rcvdCount.put(src_name, rcvdCount.get(src_name)+1);
if(messagesToCount > 0 && scheduledToCountSend == false){
if((countMessagesOf == null... |
7f64abbf-175e-4dca-b818-adf9b3a9e647 | 6 | @Override
public void run() {
if (files != null) {
int i = 0;
stopScanning = false;
Set<String> filesInDirectory = getListOfFilesInDirectory(pathToDirectory);
DirectoryScannedEvent event = null;
for (Entry<String, String> entry : files.entrySet()) {
i++;
if (!stopScanning) {
event = null;... |
622f0eea-f9cf-4917-84da-dd5d19008ec9 | 3 | public Vector<String> relativeFilesWithSourceDir() {
java.util.Vector<String> fileNames = new java.util.Vector<String>();
Vector<String> dirs = relativeDirsWithSourceDir();
for(String dir : dirs){
for(File file : new File(dir).listFiles())
if(file.isDirectory() == f... |
b97242c1-b1de-4dd8-8275-a5f19aa50bf1 | 2 | @Override
protected void process_activate_write (long msgs_read_)
{
// Remember the peers's message sequence number.
peers_msgs_read = msgs_read_;
if (!out_active && state == State.active) {
out_active = true;
sink.write_activated (this);
}
} |
c747fe82-af24-4ce3-9ab6-93d520aec6df | 6 | public boolean isValidSudoku(char[][] board) {
boolean [][] rows = new boolean[9][9];
boolean [][] cols = new boolean[9][9];
boolean [][] cells = new boolean[9][9];
for(int i = 0; i < 9; ++i){
for(int j = 0; j < 9; ++j){
if(board[i][j] == '.') continue;
... |
4965181b-8145-4072-80e6-83153684bdbb | 0 | public Add(Expression left, Expression right) {
this.left = left;
this.right = right;
} |
afb63b1e-33ba-4ad7-adbc-9a504fec2cee | 3 | public void setPProgramas(PProgramas node)
{
if(this._pProgramas_ != null)
{
this._pProgramas_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.... |
ba5570b5-f2cb-4a18-b8bb-ed5278c26dcf | 4 | public void colision (int ancho, int alto){
//no dejo que gold salga por la derecha
if (this.getPosX() + this.getAncho() >= ancho) {
this.setPosX(ancho - this.getAncho());
}
//no dejo que gold salga por izquierda
else if (this.getPosX() <= 0) {
this.setPo... |
6d3394ad-5c6b-4665-8a85-60e23a57a731 | 5 | public static void main(String[] args) throws InterruptedException {
if (args.length != 1)
throw new IllegalArgumentException("" +
"Incorect parameters count. Expected count is 1 that is assumed as threads count," +
"but current is " + args.length);
f... |
6c2daad6-c025-4247-8596-88e46b892113 | 2 | public Boolean canManage(Player player) {
if(isAdmin(player) || player.hasPermission(manage)) {
return true;
}
return false;
} |
682c8bde-4f9a-4448-ad0f-97b37ef43a6f | 2 | public static ModelCompiler create(String sysprop) {
if ("javac".equals(sysprop)) {
return new Javac();
} else if ("external".equals(sysprop)) {
return new External();
} else {
return new Memory();
}
} |
292c496e-f233-4d06-9925-e4e97b4d7444 | 4 | public String toString() {
String status = "Jobs waiting for execution: " + waitingJobs.size()
+ "\n" + "Jobs running: " + runningJobs.size() + "\n"
+ "Finished jobs: " + finishedJobs.size() + "\n"
+ "Failed jobs (resubmitted): " + failedJobs.size() + "\n";
long totaltime = 0;
for (JobMetaData job : f... |
c375ad6d-c6c2-42a7-a433-6277417a38f3 | 2 | @RequestMapping(method =RequestMethod.POST, produces = "application/json")
public ResponseEntity<?> create(@ModelAttribute("video") Video video,
@RequestParam(required=false) String searchFor,
@RequestParam(required=false, defaultValue=DEFAULT_PAGE_DISPLAYED_TO_USER) int page,
Locale locale)... |
31600fcd-505d-4f57-bb1a-7d8e49ab725c | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptionProperties")
public JAXBElement<EncryptionPropertiesType> createEncryptionProperties(EncryptionPropertiesType value) {
return new JAXBElement<EncryptionPropertiesType>(_EncryptionProperties_QNAME, EncryptionPropertiesType.cla... |
15b71c03-7993-4656-aa7e-6ee512a9b76a | 2 | private void loadRooms() {
// TODO Auto-generated method stub
// rooms=room1{key1:value;key2:value...},room1{key1:value;key2:value...}
lobby.setStatus("Loading Rooms");
String[] results = new String[MAX_GAMES_TO_LOAD];
String response = sendMessageToServer(GameSocketServer.GET_ALL_GAMES,
",load=" + MAX_GA... |
5c9d66c9-0486-4b01-b0ca-bb1b2e52a5fe | 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... |
8ee042c0-d641-4d94-8e0a-7687781b2bbc | 2 | public EigenValueDialog(
JFrame owner,
String title,
double[] eigenValues )
{
// create dialog
super(owner, title, true);
// create data
int m = eigenValues.length;
acceptanceList = new boolean[m];
for ( int i = 0; i < m; ++i )
acceptanceList[i] = true;
// create dialog content
JPanel mainPn = new JPane... |
9f4d3b1e-fd9e-4229-a997-76315b28d4b4 | 1 | Component getGameComponent() {
if (frame != null) {
return frame;
} else {
return this;
}
} |
760beaff-3e6a-46d6-86f4-c50dacc13358 | 3 | public void setEQ(float[] eq0)
{
this.eq = eq0;
if (eq==null)
{
eq = new float[32];
for (int i=0; i<32; i++)
eq[i] = 1.0f;
}
if (eq.length<32)
{
throw new IllegalArgumentException("eq0");
}
} |
5316658e-886f-4d04-8241-1b5f8ba69f27 | 8 | private void drawLineGraph() {
int[][] data = new int[players.length][];
int maxValue = 0;
int latestRound = 0;
for (int i = 0; i < players.length; i++) {
data[i] = players[i].getStats(currentStats);
if (data[i].length > latestRound)
latestRound = data[i].length;
for (int j = 0; j < data[i].length;... |
d5229ce7-cc17-4629-a5cc-8cf581069bc2 | 1 | public void testConstructor_ObjectStringEx3() throws Throwable {
try {
new LocalDateTime("T10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {}
} |
4a6ce302-6a00-4f8b-8249-b802d060e324 | 7 | public void handle(Input input, Robot robot) {
float moveForce = 50;
// jumpForce applique pour faire sauter le personnage
if (input.isKeyDown(get_key()) && robot.getEnergie() > 0
&& !robot.getPlusEnergie()) {
robot.setEnMouvement(true);
robot.applyForce(moveForce, 0);
}
if (!input.isKeyDown(Input.... |
34a2e562-89f2-4dd0-a6e4-693b038e6797 | 2 | public int getMaximumDifference_as_int(){
int diff = 0;
if(this.type==6 || this.type==7){
int max = this.getMaximum_as_int();
int min = this.getMinimum_as_int();
diff = max - min;
}
else{
throw new IllegalArgumentException("Maximum differen... |
490aab0a-f834-4d5b-91e3-35f073670fe3 | 3 | public Coord directionCercle(){
switch((444 + this.rotation) % 4){ // rotation ne doit pas aller en dessous de -444
case 0 : return DROITE;
case 1 : return BAS;
case 2 : return GAUCHE;
default : return HAUT;
}
} |
bfa35670-ccb8-4293-bbdc-e15579740b86 | 0 | public void setClient(String client) {
this.client = client;
} |
c685bc4b-d224-4c4a-955c-95d192dbbe87 | 9 | public String getNorthSouthTexture(BlockType type){
// TODO: Make these use official Minecraft texture file names
switch (type){
case STONE:
return "stone.png";
case GRASS_BLOCK:
// TODO: Make grass properly use different colors
return "grass_side.png";
case DIRT:
return "dirt.png";
case COBBLES... |
d5877606-068f-4813-8fce-4f145835f1e7 | 0 | @Test
public void testGetTurnDir() {
System.out.println("getTurnDir");
Turn instance = new Turn(Turn.direction.LEFT, 6);
Turn.direction expResult = Turn.direction.LEFT;
Turn.direction result = instance.getTurnDir();
assertEquals(expResult, result);
} |
41b01a92-d54a-48b2-bd76-cba2601b20ba | 9 | public void qSort(int[] array, int begin, int end){
// if(begin == end)return;
int temp = array[begin];
int left = begin;
int right = end;
while(left < right){
while(left < right && temp <= array[right])
right--;
if(left < right)
array[left] = array[right];
while(left < right && array[left] < ... |
eb75101a-72ff-4424-b359-5d8c5fa1e82d | 3 | private boolean leerFichero () {
boolean resultado;
final JFileChooser fc = new JFileChooser();
try {
int returnVal = fc.showOpenDialog(MainVentana.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getS... |
59447e98-34d5-43ad-bf71-109db474f73d | 2 | public void copyJump(Jump jump) {
if (this.jump != null)
throw new AssertError("overriding with moveJump()");
if (jump != null) {
this.jump = new Jump(jump);
this.jump.prev = this;
}
} |
c38d4888-9085-43a7-b4ee-26dc8be4c4c9 | 2 | @Override
public void onMouseButtonPress(int buttonID)
{
for(GuiButton button : buttons)
{
if(button.isMouseOver())
{
Sound.button_hit.play();
button.onClick();
}
}
} |
06eeb7b1-33e8-4d9d-8fb7-a43dce003e1b | 5 | private void merge(Comparable[] tempArray, int lower, int middle, int upper){
int i = lower, j = middle +1;
for (int k = lower; k <= upper; k++){
aux[k] = tempArray[k];
}
for(int k = lower; k <= upper ; k++){
if (i > middle) {tempArray[k] = aux[j++];}
else if (j > upper) {tempArray[k] = a... |
869d7935-d533-4009-b9f4-6904d9e4f705 | 2 | public int find(int lcs[], int startindex, int endindex, int value) {
for (int i = startindex; i < endindex; i++) {
if (lcs[i] == value) {
return i;
}
}
return -1;
} |
f8b77152-fcaf-45c7-9d86-6f1d8f3b5258 | 2 | public void setDocumentAsParsed(int docId)
{
try
{
connect();
String strStatement = "UPDATE document SET dIsParsed=1 WHERE dID=" + docId;
_statement.executeUpdate(strStatement);
_logger.debug("Setting document parsed in DB: " + docId);
}
catch (ClassNotFoundException e)
{
_logger.fatal(e.getMe... |
ece711b9-9507-4d60-b7cd-5c1bac187ae1 | 8 | void applySymmetry() {
if (!needToApplySymmetry || !iHaveUnitCell) {
initializeSymmetry();
return;
}
atomSetCollection.setCoordinatesAreFractional(iHaveFractionalCoordinates);
atomSetCollection.setNotionalUnitCell(notionalUnitCell);
atomSetCollection.setAtomSetSpaceGroupName(spaceGroup);... |
7a5ac19f-ad8d-4dec-bdf2-a32a92925a84 | 0 | public Action getAction() {
return this.action;
} |
5a05ef49-e38b-438e-b495-194a39f559eb | 6 | private void doWork()
{
double fps = getFramesPerSecond();
if (fps < FPS_STOP)
{
tick();
realFPS++;
return;
}
else if (fps == FPS_STOP)
{
return;
}
long time = System.nanoTime();
long elapsedTime = time - lastTime;
int timeForOneFrame = (int) (Time.NANOSECONDS_PER_SECOND / fps);
if... |
76319690-8137-4f75-b0a1-f63f049d474d | 1 | public JSONArray getJSONArray(int index) throws JSONException {
Object o = get(index);
if (o instanceof JSONArray) {
return (JSONArray)o;
}
throw new JSONException("JSONArray[" + index +
"] is not a JSONArray.");
} |
b9f40244-f0e3-458a-bf63-ce4367be3e60 | 5 | public static void main(final String args[]) {
LoggingUtility.setLoggingLevel(LoggingUtility.LoggingLevel.LEVEL_CORE);
final Option<String> option1 = new Option<String>("Hello, world!");
if (option1.isInstanceOf(String.class))
LoggingUtility.info("Option 1 has object of String clas... |
d0071df6-c4f5-4834-9358-e1ec0c2202b5 | 0 | public void reset()
{
userInput = null;
i = -1;
} |
b433ed7f-b3f2-4b12-8feb-5ba0c90868c5 | 2 | private Repository parseRepository(String lastLine, BufferedReader reader) throws IOException {
String line = lastLine;
Matcher matcher = mPlainTextRepositoryItemPattern.matcher(line);
if (matcher.find()) {
mRepositoryBuilder.url(matcher.group(1));
mRepositoryBuilder.name... |
720e6ea8-de20-4208-bc83-b22fda7aa16e | 6 | public static TargetDataLine getLine() {
AudioFormat af = new AudioFormat(16000, 16, 1, true, false);
final String inputTypeString = "MICROPHONE"; // or COMPACT_DISC or MICROPHONE etc ...
final Port.Info myInputType = new Port.Info((Port.class), inputTypeString, true);
final DataLine.Info targetDataLineInfo ... |
406105b5-0693-47dd-86fe-a3c34b3c178b | 8 | @Override
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir + "base40.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) {
File imageFile = new File(Structure.baseDir + ... |
82c2d2dd-70fc-4bbb-8766-c8aa2c980028 | 6 | public boolean applies () {
if (os == null)
return true;
if (os.name != null && os.name != OS.getCurrentPlatform())
return false;
if (os.version != null) {
try {
if (!Pattern.compile(os.version).matcher(OS.VERSION).matches()) {
... |
0945dfc1-6cdc-4afb-8316-653b3af95fcd | 2 | public static byte[] getSignedBytes(byte first)
{
try
{
byte[] data = NetworkInterface.getByInetAddress(InetAddress.getLocalHost()).getHardwareAddress();
byte[] result = new byte[data.length + 1];
result[0] = first;
for (int i = 0; i < data.length; i++)
{
result[i + 1] = data[i];
}
return... |
843a6526-913e-4aea-bd7c-1c81cc23101c | 2 | public void setHunger(double hung) {
if (hung < 0)
hunger = 0;
else if (hung > 1)
hunger = 1;
else
hunger = hung;
} |
58feb909-8502-42b3-8bf1-603567fe1608 | 6 | public void connectToZeppelin() {
isSearching = true;
ComPortController ComPortController = MainController.getComPortController();
ArrayList<CommPortIdentifier> ports = ComPortController.getAllSerialPorts();
if(ports.size() > 0) {
// MESSAGE: Found XX serial ports.
... |
76ac491c-fa06-4b13-8e53-c8da0ecd9fc8 | 6 | public static String[] load(String id) throws FileNotFoundException {
String[] dataline = new String[11];
if (id.startsWith("0")) {
File member = new File("src/member.txt");
Scanner file = new Scanner(member);
while (file.hasNextLine()) {
String in = file.nextLine();
dataline = in.split(C);
if... |
be771d25-2cde-4372-befa-f773a5069f5e | 8 | public static String formatName(String name) {
if (name.length() > 0) {
char nameChars[] = name.toCharArray();
for (int i = 0; i < nameChars.length; i++) {
if (nameChars[i] == '_') {
nameChars[i] = ' ';
if (i + 1 < nameChars.length && nameChars[i + 1] >= 'a' && nameChars[i + 1] <= 'z') {
nam... |
57852687-e88d-4e57-8a5e-b83d5e4864ed | 1 | @Test
public void runTestFieldSensitivity1() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_FieldSensitivity1.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} |
25513a3e-3805-4c2b-9ad1-a31dd6c69c28 | 4 | private int longestPathFrom(Tree node) {
if (node.l == null && node.r == null) {
return 0;
}
if (node.l == null) {
return longestPathFrom(node.r) + 1;
}
if (node.r == null) {
return longestPathFrom(node.l) + 1;
}
return Math.max(longestPathFrom(node.l), longestPathFrom(node.r)) + 1;
} |
f3c3c81d-89e6-4002-9f3a-df7332c02cb1 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
d162bed8-d209-47a4-acb6-ab1d1ecafea5 | 5 | public static void countLeft2(ArrayList<Integer> list, TreeNode node, String s){
if(node == null ) return;
StringBuilder sb = new StringBuilder();
sb.append(s);
while(node != null){
sb.append(String.valueOf(node.val));
if(node.right == null && node.left == null){
list.add(I... |
9cd82e15-6c13-49bb-b38a-2bdb20c8dd78 | 7 | public static boolean verifyItunesLibrary(String libraryFilename, StatusUpdateLogger logger) throws IOException
{
if (logger == null)
{
logger = new NullStatusUpdateLogger();
}
//libraryFilename is verified as existing, and being readable by fileIsItunesLibrary()
... |
f331249f-b3d7-4c54-957a-63786d77cb3e | 4 | public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("front: " + front + " back: " + back + "\n");
sb.append("front [ ");
for (int i = front; i < dataArray.length && dataArray[i] != null; i++) {
sb.append(dataArray[i] + " ");
}
if (front > back) {
for (int j = 0; j <= back; j+... |
c19d3361-7d9d-4bbd-8a6d-e53af394350c | 7 | public static String getTimespanString(long diffInSeconds) {
long diff[] = new long[] { 0, 0, 0, 0 };
/* sec */diff[3] = (diffInSeconds >= 60 ? diffInSeconds % 60 : diffInSeconds);
/* min */diff[2] = (diffInSeconds = (diffInSeconds / 60)) >= 60 ? diffInSeconds % 60 : diffInSeconds;
... |
717eb9cd-9cb8-4f0e-b143-e0b7f5c783fd | 6 | void markrek (int i, int j, int c)
{ if (F[i][j].mark() || F[i][j].color()!=c) return;
F[i][j].mark(true);
if (i>0) markrek(i-1,j,c);
if (j>0) markrek(i,j-1,c);
if (i<S-1) markrek(i+1,j,c);
if (j<S-1) markrek(i,j+1,c);
} |
20704dc3-2796-4af6-9bde-35956550ddc7 | 3 | @Override
public List<Performer> searchPerformerByName(String name) {
final List<Performer> ret = new ArrayList<Performer>();
// Constracut an URL for request
final HashMap<String, String> params = this.createDefaultHashMap();
params.put("keywords", name);
final String url = this.conn.prepareURL(... |
88db7146-1ab0-47f3-ba93-75fd651e31d7 | 7 | @Override
public MOB deity()
{
if(deities().hasMoreElements())
return deities().nextElement();
if((deityStandIn==null)
||(deityStandIn.amDestroyed())
||(deityStandIn.amDead())
||(deityStandIn.location()==null)
||(deityStandIn.location().isInhabitant(deityStandIn)))
{
if(deityStandIn!=null)
dei... |
b58c5bf3-7e2c-4cf3-bec8-72ed64712cf5 | 6 | public static String saveFile(byte[] content, String description,
String extension)
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter(description,
extension));
String path = "";
try
{
if (fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTIO... |
1ecc5086-3c03-41c5-9ee3-74850d9bd9ac | 4 | private ArrayList<Integer> query2(String name) {
try{
openDatabase();
}catch(Exception e){}
String query = "SELECT StudentID FROM t8005t2 .takes WHERE ID IN (SELECT ID FROM t8005t2 .modules WHERE name = '"
+ name + "')";
ArrayList<Integer> students = new ArrayList<Integer>();
try {
stmt = ... |
ead85d8d-d025-4e4b-8c92-32aaa8bf9e83 | 9 | public static void main(String[] args) {
int menu = 0;
ListaProduto lp = new ListaProduto();
Scanner tec = new Scanner(System.in);
System.out.println("zomboCom 3.0!");
do{
System.out.println("\nSelecione:");
System.out.println("0 - Hora de dar Tchau!");
System.out.println("1 - Adicionar um produt... |
831a1061-a98e-439b-a1da-6a305cf90a23 | 5 | private boolean jj_3R_9() {
if (jj_3R_8()) return true;
if (jj_scan_token(TERMAL_OPERATOR)) return true;
if (jj_3R_7()) return true;
if (jj_scan_token(CHOOSE_OPERATOR)) return true;
if (jj_3R_7()) return true;
return false;
} |
d68b0205-5fa2-40d6-b3e9-bdd29d1a37a9 | 5 | public void addParams(String str) throws UnsupportedEncodingException {
if (str != null && !str.equals("")) {
String[] parameters = str.split("&");
for (String subStr : parameters) {
String[] param = subStr.split("=");
if (param.length == 2) {
if (this.params.get(param[0]) == null) {
this.pa... |
3061299c-8b66-4de8-b64e-546fc677456a | 4 | public APacket getNewPacketOfID(int id) {
try {
return PList.get(id).getConstructor().newInstance();
}
catch(InstantiationException e) {
e.printStackTrace();
//Log.getInstance().logError("PacketRegistrie", "Could not Instantiate " + PList.get(id) + " probably missing public default Constructor");
thro... |
9f54853a-f772-4cd2-865d-c67c5f724171 | 5 | private boolean round0(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
//System.out.printf("magic is %d", magic);
if(counter<=magic){
System.out.println("we won't pick the bowl");
System.out.printf("the counter is %d\n", counter);
if... |
3d27ea18-4596-46f8-9a00-44837ea6a149 | 8 | public void convert(XMLStreamReader in, ParseState ps, Writer out) throws XMLStreamException, IOException {
CSVChunkWriter cw = new CSVChunkWriter(out);
while (in.hasNext()) {
int type = in.next();
switch(type) {
case XMLStreamConstants.START_ELEMENT:
ps.enter(in.getLocalName());
for (int i=0;... |
c49d24a6-e48c-467b-b13c-95b3158a0596 | 4 | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if (nextElementIsResult) {
nextElementIsResult = false;
if (localName.equals("a")) {
results.add(attributes.getValue("href"));
}
}
if (localName.equals("div") && "search_item pod".equals(at... |
49693af7-9266-4ce5-b3f3-8438cd7caff7 | 0 | private void removeIconFromTrayBar() {
SystemTray tray = SystemTray.getSystemTray();
tray.remove(trayView.getTrayIcon());
} |
2e83472f-16a0-48e7-b27d-9c3e99a8d95f | 1 | @Override
public boolean canAttack(Board board, Field currentField, Field occupiedField) {
return this.validSetupForAttack(currentField, occupiedField) && board.clearPathBetween(currentField, occupiedField);
} |
14daf6d3-e18f-4015-acba-2597029871ea | 8 | public MapMode getMapMode() {
final String name = propNameField.getText().trim();
String value = null;
String pattern = null;
if (propValueList.getModel().getSize() == 0) {
if (newValueTextField.getText().length() == 0)
return null;
value = newValu... |
1fe7e8f5-eb08-441e-bf18-4f9ad9999ada | 9 | public Object solution (JSONArray args) {
// input / output
String first = (String) args.get(0);
String second = (String) args.get(1);
long n = 0;
for (int i = 0; i < first.length(); i++) {
char a = first.charAt(i);
char b = second.charAt(i);
... |
a7d27f74-e1fb-4db3-b0a9-aa03eba112a0 | 9 | public void paint(Graphics g) {
Image offscreen = null;
Graphics offgc;
offscreen = createImage(getWidth(),getHeight());
offgc = offscreen.getGraphics();
int tileSize=32;
int playerPosX=(GameModel.getLocalPlayer().getPosX()/tileSize);
int playerPosY=(GameModel.getLocalPlayer().getPosY()/tileSize);
... |
45ad408c-6200-4c5c-99d1-8fd9d1b9917e | 2 | private void get() {
for (Integer key : table.keySet()) {
Short value = fht.get(key);
if (value!=table.get(key)) {
System.err.println("Error retrieving: " + key);
}
}
} |
c427f6c3-cd3d-40f5-9443-6a9eddc16234 | 5 | public OracleTeleport(int questId, String name, String descr)
{
super(questId, name, descr);
for (int posters : RIFT_POSTERS)
{
addStartNpc(posters);
addTalkId(posters);
}
for (int teleporters : TELEPORTERS)
{
addStartNpc(teleporters);
addTalkId(teleporters);
}
for (int priests : T... |
8293cd03-d4ed-4325-acc8-fc4ad65fe948 | 0 | public void setTipo(String tipo) {
this.tipo = tipo;
} |
0bce8b66-d9a6-488e-8cf0-ed24bf17dd0f | 0 | public String getClientName() {
return this.clientName;
} |
87a7ff63-9302-4483-ad83-608055f77ab7 | 6 | static final public String numberToString(Number n)
throws JSONException {
if (n == null) {
throw new JSONException("Null pointer");
}
testValidity(n);
// Shave off trailing zeros and decimal point, if possible.
String s = n.toString();
if (s.indexOf('.'... |
8c6a6dd9-9771-4a25-91ba-a65472683c1a | 5 | @SuppressWarnings("CallToThreadDumpStack")
private void pegaCaminhoArquivoXML() {
try {
File xml = new File("config.xml");
boolean x = false;
while (x != true) {
if (xml.isFile() && xml.exists()) {
txtCaminhoArquivoXML.setBackground(new ... |
bc6dc5bc-ad46-413b-a6e0-9e120fd45d56 | 9 | @EventHandler(ignoreCancelled=true)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
String playerName = player.getName();
if (Configuration.data.contains(playerName)) {
Block block = event.getBlock();
String message = block.getType().name();
String blockname = m... |
332aeb8c-16e1-4915-96b1-8aff700a6107 | 2 | private void delCheckBox(JFrame ct){
Component[] cs = ct.getContentPane().getComponents();//遍历内容控制面版
for(Component item : cs){
if(item instanceof JCheckBox){
ct.remove(item);
}
}
//重绘界面
ct.validate();
ct.repaint();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.