method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b45d7071-50f2-4dd9-ab6b-23ec16895c3c | 8 | private boolean checkRawSensorData() {
if (rawSensorData.size() < sensorDataLength) {
// System.out.println("Check Failed: too short");
return false;
}
if (rawSensorData.get(0) != (byte) SENSOR_STREAM_HEADER) {
// System.out.println("Check Failed: not header");
... |
19c82594-e8f4-49b1-afbb-aab17805110a | 6 | public static Position intersection(Polygon polygon, Line firstLine, Line secondLine, int distanceOfView) {
CenterPosition centerPosition = locationCenter(firstLine, positionOfCenter(polygon));
Line lineA = firstLine;
if (!firstLine.isWheather() || firstLine.length() < distanceOfView * 2)
... |
faf62e67-c108-415a-b709-134a6a5e32d7 | 9 | private long go(String s) {
if(s.equals("101")) {
System.out.println("hello");
}
if(s.length()==0) return 0;
long min = 100000;
if(hp.containsKey(s)) {
return hp.get(s);
}
if(s.startsWith("0")){
return 1000;
}
if(s.length()==1 && s.equals("1") ){
return 1;
} else if(s.equals("0")){ret... |
d5fa1fe0-edf5-42c1-9526-cf97da6e6110 | 3 | public static String encodeParameters(PostParameter[] postParams) {
StringBuffer buf = new StringBuffer();
for (int j = 0; j < postParams.length; j++) {
if (j != 0) {
buf.append("&");
}
try {
buf.append(URLEncoder.encode(postParams[j].getName(), "UTF-8"))
.append("=")
.append(URLEncoder... |
b7153f88-489b-4b80-885f-b0c064b25fae | 5 | public void SSLClient(final java.util.List<String> lstUnMount)
throws UnknownHostException, IOException {
// System.setProperty("javax.net.ssl.trustStore",
// "./src/keys/clientkeys");
System.setProperty("javax.net.ssl.trustStore", "C:/clientkeys");
SocketFactory factory = SSLSocketFactory.getDefault();
... |
0262635a-a068-453f-a4c7-5cbaa20a9078 | 5 | @PostConstruct
private void Init() {
if (mService.getTimers() != null) {
for (Timer timer: mService.getTimers()) {
if (timer.getInfo() != null) {
if (timer.getInfo().equals("dummyTimer2.1") || timer.getInfo().equals("dummyTimer2.2")) {
timer.cancel();
}
}
... |
55048a43-99f5-46d7-97b7-d5f63cc666aa | 3 | public static void main(String[] args) throws InterruptedException {
System.out.println("Starting.");
ExecutorService executor = Executors.newCachedThreadPool();
Future<?> fu = executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
... |
27b35bb9-68c0-411b-8885-41dd246e236e | 5 | private void loadConnections() throws IOException {
Thread highways = new Thread(new FileLoaderThread("highways", points,
connections, highwaysQT, tst), "highways");
Thread expressways = new Thread(new FileLoaderThread("expressways", points,
connections, expresswaysQT, tst), "expressways");
... |
fbcc2c50-91c6-43be-ae7d-2319694e77c8 | 6 | public static String getDNSName(ByteBuffer aBuffer) throws IOException {
StringBuffer buf = new StringBuffer();
int next = -1;
int first = aBuffer.position();
int len = aBuffer.get();
while(len != 0) {
switch(len & 0xC0) {
case 0x00:
// Top two bytes 00.... |
e9e7d7fc-d073-4b5e-a2a7-a1dbe710b832 | 3 | public void addRecipe() {
if (!recipeURL.isEmpty()) {
Recipe recipe = recipeRetriverFacade.addRecipe(recipeURL);
for (Recipe recipetocheck : recipes) {
if (recipetocheck.getName().equals(recipe.getName())) {
return;
}
}
... |
fb9bf245-c8d5-4144-bac8-08d3aabd336f | 4 | public void stopServer() {
logger.fine("Stopping server...");
boolean wasRunning = false;
synchronized(CONNECTION_LOCK) {
wasRunning = isRunning;
if(isRunning) {
logger.finer("Sending disconnect packets to all clients");
for(Integer clientId : clients.keySet()) {
ClientInfo client = clients.get... |
60bffbc7-3d56-42d2-9906-120e42c684e2 | 6 | public void run() {
while (true) {
try {
logger.debug("Waiting for new message");
permits.acquire();
Message msg = queue.peek();
if (msg == null) {
// May be a new subscriber was added
continue;
}
if (msg == poison) {
logger.info("Received close signal, closing que... |
eda1c48f-252a-4a03-8022-c27d405589f1 | 9 | public List<List<Integer>> fourSum(int[] num, int target) {
List<List<Integer>> list = new ArrayList<List<Integer>>();
int length = num.length;
if (length < 4)
return list;
Arrays.sort(num);
int lastA = Integer.MIN_VALUE;
int las... |
25922ec6-2526-4f54-9c38-003f40cf7301 | 3 | @Override
public void ioCheckClicked(boolean ioPortsEnabled) {
if (ioPortsEnabled && usingRPi) {
sendToIO = ioPortsEnabled;
/* Initialse the GPIO ports only once */
if (gpio == null) {
gpio = GpioFactory.getInstance();
piInitialseGPIO();
}
}
} |
59a27e2e-1377-4612-9bb4-3b66f286474f | 3 | public long calculate(final int aValue) {
if (aValue < 0) {
throw new RuntimeException("Factorial for negative number cannot be calculated here");
}
if (aValue == 0) {
return 1;
}
long counter = 1;
long result = 1;
while (counter < aValue) ... |
84e9a814-2def-4fd1-b8c6-1a2f86270293 | 0 | @Override
public void setGUITreeComponentID(String id) {this.id = id;} |
ee635b45-97dd-42e8-9014-637835470d8f | 6 | @Override
public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) {
if (args.length == 0) {
return false;
}
final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]);
if (player == null) {
... |
f7e87bc4-b890-403d-8359-fbc0c09b778e | 5 | private int checkCard(String name) {
int t = names.indexOf(name);
if (t == -1) {
return 0;
}
if (amounts.get(t) < 0) {
return 1;
}
if (amounts.get(t) == 0) {
return 2;
}
if (!Card.isBasicLand(name) && amounts.get(t) > 4)... |
23350340-87a8-4b1f-a05b-3cdc3c6a0d69 | 4 | public String register(HttpServletRequest req, HttpServletResponse resp) {
// TODO Auto-generated method stub
try {
String queryString = req.getQueryString();
String name = queryString.split("&")[0];
String password = queryString.split("&")[1];
name = name.substring(9, name.length());
password = ... |
03fbf7f6-e881-4754-9e75-f474a870a9c2 | 2 | @Override
public boolean equals(Object obj) {
if (obj instanceof Move) {
Move otherMove = (Move)obj;
return this.start.equals(otherMove.start) &&
this.end.equals(otherMove.end);
}
return false;
} |
b587f828-71e1-4075-a2c4-1a1cbe810569 | 6 | public ResultSet pesquisaGerente(String NomeGerente) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_SELECT_TO... |
729b59d8-1021-418e-a1df-95cf1553bfec | 0 | @Override
public String getMessageText() {
String msg = "";
msg += participantList.getNameOfParticipant(getAuthorId()) + " ("+getTime()+"):\n";
msg += getMessage();
return msg;
} |
dc7a2159-5c7f-4ff4-943a-b4e82ce81fcc | 5 | public static void search(Map<String, byte[]> array, Map<String, byte[]> table, byte[][] tw) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidParameterSpecException, UnsupportedEncodingException{
... |
bb07b552-e0f8-46e0-a3ec-f2100baa2445 | 3 | @PostConstruct
public void initialiseFoldersTree() {
try {
root = new DefaultTreeNode(mailBox,null);
List<FolderDTO> folders = folderService.getFoldersForMailBox(mailBox);
for (FolderDTO folder : folders) {
DefaultTreeNode node = new DefaultTreeNode(folder, root);
if (folder.getFolderName().equals("... |
d6474da7-566d-420d-9838-f7694c873116 | 2 | @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (player.getWorld().getName() != Core._spawnWorld
&& !_fightingPlayers.contains(player)) {
World spawn = WorldUtils.GetWorld(Core._spawnWorld);
player.teleport(spawn.getS... |
fe5151d8-555f-427c-afca-326ce5f741d4 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BomClosureEntity)) return false;
if (!super.equals(o)) return false;
BomClosureEntity bomClosureEntity = (BomClosureEntity) o;
if (amount != bomClosureEntity.amount) return false;
... |
6c15ade4-6aad-42c8-ae2c-4d46f80459e1 | 7 | private static boolean isCompact(Point[] points) {
long[] d = new long[6];
int v = 0;
for (int i = 0; i < 4; i++) {
for (int j = i + 1; j < 4; j++) {
d[v++] = dist(points[i], points[j]);
}
}
Arrays.sort(d);
return d[0] != 0
... |
05cf72f2-283e-469e-b1c3-313779db52a2 | 8 | public ArrayList<String> topSort() {
// Empty list that will contain the sorted elements
LinkedList<Node> sortedList = new LinkedList<Node>();
// Set s of all nodes n with no incoming edges
LinkedList<Node> s = new LinkedList<Node>();
for (Node node : nodes) {
if (node.incoming.isEmpty()) {
s.add(no... |
ec0e9b03-2fd1-41f2-91d6-37471a1a6de1 | 2 | public static void createFolder(String realpath) {
File folder = new File(realpath);
if (!(folder.exists())) {
File parent = folder.getParentFile();
if (!(parent.exists()))
parent.mkdirs();
folder.mkdir();
}
} |
7bdfff68-73a3-4226-b761-4b22455e536b | 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 ht... |
77d51da4-46ca-429c-9a8c-3578bfd8da98 | 7 | private static void unescapeDoubleQuotes(ByteChunk bc) {
if (bc == null || bc.getLength() == 0 || bc.indexOf('"', 0) == -1) {
return;
}
int src = bc.getStart();
int end = bc.getEnd();
int dest = src;
byte[] buffer = bc.getBuffer();
while (src < end) {
if (buffer[src] == '\\' && src < end && buffe... |
8998a9d3-2ffe-411a-906d-6c6fbce22531 | 9 | public void displayMaxSharePrices() throws FileNotFoundException,
SharePriceReaderException {
/*
* Display error if sharePriceCsvFile does not exist
*/
if (sharePriceCsvFile == null) {
throw new SharePriceReaderException("FilePath is null");
} else if (!sharePriceCsvFile.exists()) {
throw new Share... |
e5a24192-8b88-46af-811e-ff1ee5ecba06 | 8 | public Map generateMap(int timeToWait) {
MapManager mapManager = new MapManager(width, height);
ArrayList<AgentParams> spawnEvents = (ArrayList<AgentParams>) agentComposition
.clone();
ArrayList<AgentParams> removeList = new ArrayList<AgentParams>();
int steps = 0;
while (mapManager.agentsLeft() || spawnE... |
30f9d4f1-e166-435e-981a-e121107b4b7b | 2 | public void startup() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
Utils.showMessage("Fout opgetreden, kan het thema van het programma niet starten.", "Fout!", ex.getMessage(), false);
}
dbManager = new Dbma... |
cea31aaa-d13c-4d60-89ce-189b0b6041b3 | 5 | public static double[] getHourLineAngles(double latitude, double longitude, int date) {
double[] angleArray = new double[13];
double minutesMeridianDelta = getMeridianDelta(longitude) / 15 * 60; //minutes
double EOTDelta = EOTCorrection(date); //minutes
double netDelta = (minutesMeridianDelta + EOTDelta) / 60; ... |
28cbf646-5c22-4734-91bc-8c1a745206b7 | 4 | private void loadEnemyPref() {
Scanner scanner = null;
try {
scanner = new Scanner(new FileInputStream("res" + File.separator + "enemyPref.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String currentLine;
String[] currentLineArray;
ArrayList<double[]> prefList = new ArrayList<... |
a46ec924-aeee-4fb3-93c7-41a6ad2cc236 | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long firstNum = sc.nextLong();
long secondNum = sc.nextLong();
// if the numbers are negative, we turn them into positive by multiplying with -1.
if (firstNum < 0) {
firstNum *= -1;
}
if (secondNum < 0) {
secondNum *= -1;... |
923425ae-3513-4cc9-89d6-cae37c498674 | 3 | public TDMatrixChainMultiplication(int p[])
{
n = p.length - 1;
m = new int[n + 1][n + 1]; // the 0'th row and column are not used
split = new int[n + 1][n + 1]; // the 0'th row and column are not used
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
{
if (i == j)
m[i][j] = 0;
else... |
308adfef-124b-46c5-8fac-ade5cace6839 | 5 | @Test
public void depthest02opponent3()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 4; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... |
c7cb4fc9-da1c-43dc-8cb3-aea31f8aa141 | 4 | public void initializeBuildOrder() {
File knowledgeBase = new File(knowledgeBasePath);
// If the file does not exist, create it and write 12 randomly generated
// build order to it
if (!knowledgeBase.isFile()) {
System.out.println("File Does not exist, creating...");
try {
generateInitialBuildOrders(... |
9aad60d1-cbb3-4e6d-9a62-1398390ba1a7 | 7 | @Override
public String getMessage() {
String msg = super.getMessage();
if (msg != null)
return msg;
msg = getProblem();
if (msg != null)
return msg;
Object response = getParameters().get(HTTP_RESPONSE);
if (response != null) {
msg ... |
d6d493eb-e4d0-40ce-ba71-17711bd6c00b | 0 | public String getUri() {
return uri;
} |
5867c47e-e1f1-4218-82ab-fca81805bdb0 | 0 | public Iterator<Item> iterator() {
return new ListIterator<Item>(first);
} |
7ac0e742-ab3f-4d96-8280-fb700be99b6d | 2 | public String getMusicForLevel(int levelNumber) {
return LEVEL_TRACKS.length >= levelNumber
|| LEVEL_TRACKS[levelNumber - 1] == null ?
DEFAULT_TRACK : LEVEL_TRACKS[levelNumber - 1];
} |
4e4bb64e-b6f3-4c35-b425-230ca0e5c5bb | 8 | @SuppressWarnings("unchecked")
private List<?> decorateList(ClassLoader loader, Field field) {
Class<?> clazz = (Class<?>) ((ParameterizedType) field.getGenericType())
.getActualTypeArguments()[0];
List<IContainer> containers = new ArrayList<IContainer>();
List<IElement> elements = new ArrayList<IElement>()... |
eb757528-ab6f-4288-9e9d-c578bf69ed2c | 5 | public long rankSum() {
// Sanity check
if (!geneSets.isRanked()) throw new RuntimeException("Cannot calculate rank: This is not a ranked gene set ('" + name + "')!");
if (rankSum >= 0) return rankSum;
rankSum = 0;
rankedGenesCount = 0;
maxRank = 0;
GeneSetsRanked geneSetsRanked = (GeneSetsRanked) geneSe... |
a0180046-3bca-4b65-b01c-663416526c38 | 7 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if((msg.targetMinor()==CMMsg.TYP_ENTER)
&&(msg.amISource((MOB)host))
&&(msg.source().isMonster())
&&(msg.target() instanceof Room)
&&(msg.tool() instanceof Exit)
&&(!canBreatheHere(msg.source(), (Room)msg.target()))
&&(canBreatheHere(ms... |
7b8b5d4a-1827-4690-8b5f-bc5c90fe8a23 | 2 | public void moveInformations(int info1, int info2)
{
if (info1 < informations.size() && info2 < informations.size()) {
String temp = informations.get(info1);
informations.set(info1, informations.get(info2));
informations.set(info2, temp);
}
notifyZElement();
... |
fcb3e922-289b-4e8f-a2ab-dc3bf51ca548 | 3 | public void onDisable()
{
try {
if (Misc.is(Constants.DatabaseType, new String[] { "sqlite", "h2", "h2sql", "h2db" })) {
Database.connectionPool().dispose();
}
System.out.println("[iConomy] Plugin disabled.");
} catch (Exception e) {
System.out.println("[iConomy] Plugin disabl... |
5c5de812-efd0-40d7-b9f0-c4b0caeda4a0 | 5 | public Button(final Game2048 game) {
super("Go");
setBorder(null);
setBackground(new Color(0, 0, 0, 0));
setFont(Game2048.FONT.deriveFont(20f));
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
... |
064ef3a7-7ff9-4715-b4a7-412dc36510ec | 1 | public Integer[] nextIntegerArray() throws Exception {
String[] line = reader.readLine().trim().split(" ");
Integer[] out = new Integer[line.length];
for (int i = 0; i < line.length; i++) {
out[i] = Integer.valueOf(line[i]);
}
return out;
... |
4b5cb0d3-3175-4395-89bb-84b5b445c399 | 0 | public Row(Combination<Colors> attempt, AnswerCombination answer) {
this.attempt = attempt;
this.answer = answer;
} |
a466d560-49fe-4cf0-a238-9acd70376936 | 4 | public Cache() {
try {
File[] files = new File(Constants.getCacheDirectory()).listFiles();
dataFile = findDataFile(files);
indexFiles = findIndexFiles(files);
java.util.Arrays.sort(indexFiles);
if (dataFile == null) {
throw new IOException("Unable to locate... |
7e14e3bd-7e5f-4295-9b74-276f032ad190 | 2 | public void run() {
while (!Thread.interrupted()) {
try {
Thread.sleep(SLEEP_PERIOD);
showTable();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
} |
b523b716-f014-4409-a39d-5150e9e409fc | 6 | public static String swapCase(String str) {
if (StringUtil.isEmpty(str)) {
return str;
}
char[] buffer = str.toCharArray();
boolean whitespace = true;
for (int i = 0; i < buffer.length; i++) {
char ch = buffer[i];
if (Character.isUpperCase(ch)) {
buffer[i] = Character.toLowerCase(ch);
white... |
acf1e379-f5a2-4a5d-81b3-addd221d5884 | 0 | public static void EasternLounge() {
currentRoomName = "Eastern Lounge";
currentRoom = 4;
RoomDescription = "You walk into the room and you catch a glimps of a man wearing a cowboy hat and dark clothing as he " +
"runs out of the room through the huge eastern doors. There is a slight smell of cheap aftershav... |
27cf0f35-e16b-432b-aadd-11b2a72cef5a | 9 | @Override
public void drawShape(Graphics graphics) {
// Applies the color initially.
graphics.setColor(super.getColor());
// Local variables declarations
int xi, yi, xn, yn, p;
int dx, dy, x, y, slopeSign;
// Initialisations.
xi = super.getXi();
xn =... |
6cd142a3-c7d7-4ce9-afde-bad8a3db314a | 1 | public void testToStandardHours() {
Weeks test = Weeks.weeks(2);
Hours expected = Hours.hours(2 * 7 * 24);
assertEquals(expected, test.toStandardHours());
try {
Weeks.MAX_VALUE.toStandardHours();
fail();
} catch (ArithmeticException ex) {
... |
8e4c628e-49c1-4719-9df4-82403bfbb494 | 3 | public static int getMouseButtonCode(MouseEvent e) {
switch (e.getButton()) {
case MouseEvent.BUTTON1:
return MOUSE_BUTTON_1;
case MouseEvent.BUTTON2:
return MOUSE_BUTTON_2;
case MouseEvent.BUTTON3:
return MOUSE_BUTTON_3;
... |
cc8f121a-c301-43b0-bbba-42177d57d5f8 | 7 | public static Cons javaTranslateMethodParameters(MethodSlot method) {
{ boolean skipfirstparameterP = !MethodSlot.javaMethodObjectIsFunctionP(method);
Cons translatedparameters = Stella.NIL;
{ Symbol pname = null;
Cons iter000 = method.methodParameterNames().theConsList;
StandardObject ... |
cd3703bb-b4a3-4789-a1c1-591eb4d8b2f4 | 6 | public String getPath(String lookup) {
if (lookup != null ) {
if (lookup.contains("__")) {
String[] tmp = lookup.split("__");
if (tmp.length > 1 && !tmp[1].trim().equals("")) {
return setSuffixMatch(tmp[1].trim());
} else {
... |
27f1ebb2-3bf3-4006-90ab-3533a7daf031 | 8 | @Override
public actionReturn doWork(Path filePath) {
CkRar rar = new CkRar();
if (Files.isDirectory(filePath)) {
File[] fileList = listFilesForFolder(filePath.toFile());
for (File file : fileList) {
if(getFileExtension(file).equals("rar")){
String fileString = file.toString();
if(rar.Open(file... |
c9a1547d-0790-4cc7-aa7a-5f7e88f1db8f | 5 | public static int[] plusOne(int[] digits) {
int[] high_digit = {1};
if(digits==null||digits.length==0) return high_digit;
// Note: The Solution object is instantiated only once and is reused by each test case.
for(int i=digits.length-1;i>=0;--i) {
digits[i]++;
if(digits[i]<=9... |
2218b928-a739-43df-bf34-7e43c3253855 | 5 | private void removeDropTransfer(Transfer transfer){
if (dropTypes.length == 1) {
dropTypes = new Transfer[0];
} else {
int index = -1;
for(int i = 0; i < dropTypes.length; i++) {
if (dropTypes[i] == transfer) {
index = i;
break;
}
}
if (index == -1) return;
Transfer[] newTypes = new Transfer... |
6d709170-8de4-4d30-8153-2548d16871da | 2 | private static byte[] readStream(AudioInputStream stream)
throws IOException {
byte[] data = new byte[stream.available()];
int bytesRead = 0;
int totalBytesRead = 0;
while ((bytesRead = stream.read(data, totalBytesRead, data.length
- totalBytesRead)) != -1
&& totalBytesRead < data.length) {
totalB... |
2b58c966-a55a-4d4d-82fa-6b1b998834c2 | 3 | public void InsertNotes(String note){
Player player=new Player();
if(Composer instanceof AtonalMMC&&num <11){
Composer.InsertNotes(note);
String pl=Composer.getInstruments()+" "+note;
player.play(pl);
num++;
}else if(num==11){
Composer.InsertNotes(note);
}else{
Composer.InsertNotes(note);
... |
b77add8c-4636-42d8-ab9a-e742c3195782 | 8 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Please input number of lines:");
int i = 0, j, k, n;
n = scan.nextInt();
for (k = 0; k <= n / 2; k++) {
for (i = 0; i < n - k; i++) {
System.out.print(" ");
}
for (j = 1; j < k; j++) {
Syste... |
91abe25c-3927-4c15-9e01-c120693eeee7 | 0 | boolean isStopped() {
final ReentrantLock l = lock;
l.lock();
try {
return stopped;
}
finally {
l.unlock();
}
} |
dab47de5-d016-4cc8-a4ba-547d53a26bf6 | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
/* For PointOpImage, srcRect = destRect. */
RenderedImage[] renderedSources =
source2Alpha == null ? new RenderedImage[3] :
... |
9e49ca8d-2e0c-4018-9a8d-98daa519acb4 | 3 | public ArrayList<Pair> serialise() throws MVDException
{
Pair.pairId = 1;
if ( origSize < 15 )
origSize = 15;
numParents = 0;
ArrayList<Pair> pairs = new ArrayList<Pair>( origSize );
printAcross( pairs, graph.start, allVersions );
if ( parents.size() != 0 )
throw new MVDToolException("Mismatche... |
0d9f4b3f-57dc-43e6-aca8-432762d4007c | 1 | private boolean jj_3R_82() {
if (jj_3R_94()) return true;
return false;
} |
d36d4d02-bf07-4fb7-b8eb-a4a83a59d1b0 | 3 | private static String nextViableLine(RandomAccessFile r) throws IOException {
String l;
while ((l = r.readLine()) != null && ((l = l.trim()).length() == 0 || l.startsWith("//"))) {
//Reading file done in loop condition!
}
return l;
} |
b580044a-95e7-4aa2-9034-3df4aa680921 | 2 | public static int readVersion( Handshakedata handshakedata ) {
String vers = handshakedata.getFieldValue( "Sec-WebSocket-Version" );
if( vers.length() > 0 ) {
int v;
try {
v = new Integer( vers.trim() );
return v;
} catch ( NumberFormatException e ) {
return -1;
}
}
return -1;
} |
fd0355fb-e33c-4e48-837a-4a7928d6d6bf | 0 | @Override
public void setGUITreeComponentID(String id) {this.id = id;} |
2c127cf0-10bc-4795-a4bb-393f66bcbdbc | 7 | private void checkCompletion()
{
if(state == CompletionState.IN_PROGRESS)return;
if(isComplete())
{
log.complete(q, state);
if(SkyQuest.isOnServer())
{
Player p = Bukkit.getServer().getPlayerExact(player);
if(p != null && q.isVisible())
{
if(state == CompletionState.COMPLETE)
p.se... |
fde4c753-53a4-4660-a51e-069aa6ff3965 | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
7160a960-142f-4af6-8287-e87d9f330bf0 | 9 | ServerMessage(int code, MessageHandler handler) {
m_handler = handler;
m_map.put(code, this);
} |
504bb3f6-7e11-4773-925f-2c046f3792e4 | 3 | public boolean equals(Datum other) {
if(this.dan == other.dan && this.mjesec == other.mjesec && this.godina == other.godina)
return true;
else
return false;
} |
b14e6f95-f111-40b4-ae1b-047511f577c2 | 5 | private void randomiseBlock() {
final boolean[] inUse = this.data.inUse;
final byte[] block = this.data.block;
final int lastShadow = this.last;
for (int i = 256; --i >= 0;)
inUse[i] = false;
int rNToGo = 0;
int rTPos = 0;
for (int i = 0, j = 1; i <=... |
0ad53112-b75e-47ec-93de-9217f4ce2c2e | 2 | public ArrayList<String[]> buscaNombreLogin(String login_nombre) {
String res = "error";
Statement statement;
ResultSet resultSet;
ArrayList<String[]> resultado = new ArrayList<>();
String[] nombre = new String[2];
try {
Connection con = DriverManager.getConn... |
7401a75c-7d17-42a1-a357-86f7183c3241 | 4 | private OSType getOSType()
{
String os_name = System.getProperty("os.name").toLowerCase();
if(os_name.contains("mac"))
{
return OSType.OS_MacOSX;
}
else if(os_name.contains("nix") || os_name.contains("nux"))
{
return OSType.OS_Unix;
}
else if(os_name.... |
eb24d0cd-71e6-4d2b-9269-0cb85c3d3aa0 | 3 | public void run()
{
for (int i=0; i<200 && running; i++) {
try
{
thread.sleep(50);
}
catch(Exception e){ e.printStackTrace(); }
toFront();
}
hide();
} |
c786ea59-5405-4a0a-b11a-53701e2f856e | 2 | public Image loadImage(String imageName) {
Image img = imageCache.get(imageName);
if (img == null) {
try {
ClassLoader loader = getClass().getClassLoader();
Class[] classes = { Image.class };
URL url = loader.getResource("images/" + imageName);
img = (Image) url.openConnection().getContent(class... |
43018ea1-d99e-4fb0-bf9d-4d413254728e | 5 | private static void maxHeapify(int[] array, int index, int heapSize) {
int left = index*2;
int right = index*2 + 1;
int largest = index ;
if(left < heapSize && array[left] > array[index])
largest = left;
if(right < heapSize && array[right] > array[largest])
largest = right; //if the array[index... |
9c8740ed-88da-4476-ad92-09776d3bbd50 | 3 | public void saat(int saat, int dk, int sn){
String saatText = "";
if(saat < 10)
saatText = "0";
saatText += saat + ":";
if(dk < 10)
saatText += "0";
saatText += dk + ":";
if(sn < 10)
saatText += "0";... |
b047f8e6-c651-44fd-8765-8a14f1ad4d0d | 2 | public HandlerImpl() {
for (int i = 0; i < wList.length; i++) {
whiteList.add(wList[i]);
}
for (String s:bList){
blackList.add(s);
}
} |
2935a1df-a8c3-4ca0-a64b-1020f8ec65f6 | 3 | @Override
public void writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream os) throws IOException {
PropertyFiltering annotation = findPropertyFiltering(annotations);
Collection<String>... |
437a76e3-050d-4638-8d3d-196560d29fba | 7 | public int deleteNode(Point pnt) {
Circle c = new Circle(pnt);
int k = -1;
for (int i = 0; i < pnts.length; i++) {
if (c.equals(pnts[i])) {
k = i;
}
}
if (k != -1) {
g.clearRect(pnts[k].pnt.x, pnts[k].pnt.y, pnts[k].rad, pnts[k]... |
e73ea558-29a3-4514-bbed-ee3ab9b00dc7 | 8 | @Override
public String getStat(String code)
{
if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
return CMLib.coffeeMaker().getGenItemStat(this,code);
switch(getCodeNum(code))
{
case 0:
return "" + powerCapacity();
case 1:
return "" + powerRemaining();
case 2:
return "" + getGeneratedAmountPe... |
f1ce4630-c53b-450c-8ef6-2a0b80126803 | 5 | public static void removePainters(final Paintable... painters) {
if (painters == null || getPaintHandler() == null) {
return;
}
for (final Paintable p : painters) {
if (p != null) {
if (p instanceof PaintTab) {
getMainPaint().remove((PaintTab) p);
} else {
getPaintHandler().remove(p);
... |
1fb10328-6c67-45d2-b3b1-28cb58b77263 | 2 | public void setRegistro(String json) {
DefaultHttpClient clienteHttp = new DefaultHttpClient();
HttpPut requisicaoPUT;
if (json.equals("")) {
String url = getHost() + ":" + getPorta() + "/" + getNomebanco();
requisicaoPUT = new HttpPut(URI.create(url));
System.out.println("PUT : " + url);
} else {
S... |
91512532-4975-4d9c-a1b0-27d6ca5f0909 | 7 | public PNGDecoder(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if(!checkSignature(buffer)) {
... |
efe51f46-8b4d-4463-9eee-aa9b6e60c6e5 | 6 | private void jarjestetaanTunnuksia() {
if (this.kategoria.equals(TunnusTilastoKategoriat.TUNNUS)) {
Collections.sort(liittyma.getTunnukset());
} else if (this.kategoria.equals(TunnusTilastoKategoriat.PELIT)) {
Collections.sort(liittyma.getTunnukset(), new TunnuksetPelienMukaanJar... |
78dabe3f-0491-45a4-94c1-1370e13e986a | 9 | public ItemStack getStackInSlot(int var1) {
ItemStack var2 = null;
Slot var3 = (Slot)this.inventorySlots.get(var1);
if(var3 != null && var3.getHasStack()) {
ItemStack var4 = var3.getStack();
var2 = var4.copy();
if(var1 == 0) {
this.func_28125_a(var4, 9, 45, true)... |
4114e025-c01a-418d-8030-45260e711d23 | 4 | String valueString() {
Object v = value();
if (v == null) {
throw new IllegalArgumentException("Missing output: " + token);
}
if (v.getClass() == Double.class) {
return String.format(Locale.US, fformat, v);
} else if (v instance... |
c6dc5b37-7fda-44a7-b5e1-368d0cb44371 | 8 | public List<Project> Search_file(String projectName, String fileName,
String format) {
String query1 = "SELECT distinct e.projID from project e WHERE e.projName='"
+ projectName + "'";
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("PersistenceUnit");
EntityManager manager = emf.cre... |
540b1d3b-46fb-42d7-96b8-007f21db9356 | 8 | public void ignite(MOB mob, Item I)
{
int durationOfBurn=5;
switch(I.material()&RawMaterial.MATERIAL_MASK)
{
case RawMaterial.MATERIAL_LEATHER:
durationOfBurn=20+I.phyStats().weight();
break;
case RawMaterial.MATERIAL_CLOTH:
case RawMaterial.MATERIAL_SYNTHETIC:
case RawMaterial.MATERIAL_PAPER:
d... |
c651a226-6b64-4529-9a90-821a3994375e | 6 | @EventHandler
public void ZombieHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Zombie.Hunger.D... |
9a2c026d-52ad-4691-8a2b-1abc2eb4e5c1 | 1 | private JTable getJTableField() {
// Nom des colonnes
String[] columnNames = {"Matière enseignée"};
// On s'occupe de la ComboBox
ArrayList<Field> fields = dataStore.getFields();
//System.out.println("tp : " + fields.size());
comboData = new String[fields.size() + 1];
comboData[0] = ""; // Pre... |
9f896b5f-fd6c-4b5e-b338-d350a17ea761 | 7 | public void removeVertex (int id){
int pos=-1;
for (int i=0; i<thisVert.size(); i++)
{
if (thisVert.get(i).GetId()==id)
{
//System.out.println("Removeu! o id ->" + id);
while (isArest(id))
{
for (int j=0;j<thisArest.size(); j++)
{
if ((thisArest.get(j).getTheFrom()==id) || (thisA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.