method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
77c92a66-92bd-4c6d-b734-aa8d8902d434 | 1 | public static void main(String[] a) throws InterruptedException {
final TransferQueue<String> transferQueue = new LinkedTransferQueue<String>();
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
public void run() {
... |
3acc8ffe-79c1-4c55-af2d-201ce62d4818 | 6 | @Override
public void setAudioFormat( AudioFormat audioFormat )
{
int soundFormat = 0;
if( audioFormat.getChannels() == 1 )
{
if( audioFormat.getSampleSizeInBits() == 8 )
{
soundFormat = AL10.AL_FORMAT_MONO8;
}
else if( audi... |
237b8cf7-96c9-4006-88aa-f2a518f6a09a | 9 | @Override
public synchronized Message process(ClientState state, Message request)
{
String xmlString;
Message response = null;
// Get Model instance
Model model = Model.getInstance();
Node child = request.contents.getFirstChild();
// get clientId of User -- not used
//String clientId = new String(reques... |
e76e864a-b660-4c3b-8452-e3ce51eeedd9 | 0 | public ImageDto(String sender, BufferedImage image){
_sender = sender;
_image = new ImageRGB(image);
} |
aa9adb75-6fb0-427d-8478-797d820e286b | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
StudentDao dao=new StudentDao();
ArrayList< Student> l=new ArrayList< Student>();
try {
for(Object em:(ArrayList)dao.getAllStude... |
5bc12b2c-16b0-44c5-8979-83fa505a7662 | 6 | public static void getTechnicalGrowthRateData(IndicatorParam param) {
System.out.println("getTechnicalGrowthRateData");
IndicatorData data = new IndicatorData();
try {
data.indicatorType = param.indicatorType;
System.out.println(param.keyWord);
Hits hits = LuceneHelper.search(param.keyWord);
Map<St... |
fa367b07-2d7d-4bc7-9d94-ec0c780525de | 0 | public String getName() {
return name;
} |
05469099-0f84-4693-8bb4-21e79c73e974 | 3 | @Override
public Object getChild(Object node, int index)
{
File[] children = ((FileWrapper) node).getF().listFiles();
ArrayList<File> childs = new ArrayList<File>();
for (File f : children)
{
if (this.showFiles)
{
childs.add(f);
... |
8d805ad3-020a-4903-880d-02f1db9ea456 | 4 | private void checkMapBounds(){
// The X and Y-coordinate in the middle of the character
int playerX = engine.getPlayer().getX() + (engine.getPlayer().getWidth()/2);
int playerY = engine.getPlayer().getY() + (engine.getPlayer().getHeight()/2);
ArrayList<Map> maps = engine.getWorld().getMaps();
Map currentMap =... |
0dbc5ffd-4443-48ea-bfab-c9e1f1861ad6 | 0 | public Element(int id, int value){
this.id = id;
this.value = value;
} |
24e11b5a-cd7b-4388-bcff-847f9510a90a | 2 | public void ejecutarExcel(File archivo) throws IOException{
System.out.println("Abriendo excel...");
try {
if(archivo.canExecute()){
Desktop.getDesktop().open(archivo);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
... |
9ea365dc-9720-4e43-a8b5-918b146f08ed | 6 | public void doFrameEnterHighscore() {
char key = getLastKeyChar();
clearLastKey();
if (key==KeyBackspace && playername.length()>0)
playername = playername.substring(0,playername.length()-1);
if (key==KeyEnter) {
highscores = Highscore.insert(highscores,
new Highscore(score,playername));
clearLastK... |
6c14ed93-ff0b-4f0d-ad12-4026df2f5026 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String version = this.plugin.getDescription().getVersion();
if (title.split(" v").length == 2) {
final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
0e431e80-9b74-41ed-b5ed-04eaa6c84b43 | 3 | @Override
public boolean halt() {
if(previousGBest != null){
double currentGradient = (currentGBest - previousGBest) / currentGBest;
if(currentGradient < 0){
currentGradient = currentGradient * -1;
}
if(currentGradient <= gradient){
return true;
}else{
return false;
}
}else{
return... |
ea77e104-a5c4-4ced-b69b-94bdd8730c69 | 0 | public static Answer fromJson(String json) {
return gson.fromJson(json, Answer.class);
} |
c60812ae-07e4-41b9-8daf-0ae29ab6ec5b | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Nature other = (Nature) obj;
if (defense != other.defense)
return false;
if (specialDefense != other.specialDefense)
return false;
retu... |
41d123e7-5fde-444e-b14b-10871b882ef3 | 0 | private void initTextArea(){
question = new JTextArea();
question.setSize(100, 50);
question.setLineWrap(true);
question.setEditable(false);
scrollPaneQuestion = new JScrollPane(question);
frame.add(scrollPaneQuestion);
} |
e4f72619-7af7-4e59-9422-6d2fe8ae8195 | 3 | private void addComponents(Component[][] components) {
for (Component[] componentRow : components) {
for (int i=0; i<componentRow.length; i++) {
String constraint = "";
if (i==componentRow.length-1) {
constraint = "wrap";
}
add(componentRow[i], constraint);
}
}
} |
e06fd179-2256-45a1-a0a2-b1547cd0cf88 | 3 | public String getPhrase(int n) {
if(n==0){
return "Zero";
}
// convert into two xxx
int first = n % 1000;
int second = (n - n % 1000) / 1000;
String result="";
if (second!=0){
result = convertXXX(second)+ " Thousand";
if(first!=0){
result+=" ";
}
}
result+=convertXXX(first);
return ... |
14cbb5ae-3b42-468f-bd76-0a77203d0e54 | 2 | private static int countOnes(String s){
int c = 0;
for(char ch : s.toCharArray()){
c+=ch=='1'?1:0;
}
return c;
} |
3f744de5-75a6-4075-9e06-12998ae37079 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
CorrelatedMessage<RequestType> other = (CorrelatedMessage<RequestType>) obj;
if (correlationID == null) {
if ... |
279b1256-8d29-4cbc-91be-72375b2a4244 | 3 | private final static boolean isLeap(long y) {
boolean leap = false;
if ((y % 4) == 0) {
leap = true;
if ((y % 100) == 0) {
leap = false;
if ((y % 1000) == 0) {
leap = true;
}
}
}
return leap;
} |
6ee2b36e-bf1f-4e9b-8a66-61a6b18e72eb | 6 | public EndScore(LD ld, World[][] worlds){
countdown = new CountDown(5);
this.ld = ld;
int scoreInt = 0;
for(int x = 0; x < Values.WORLDS_X; x++){
for(int y = 0; y < Values.WORLDS_Y; y++){
if(worlds[x][y] == null) continue;
if(worlds[x][y].failed()){
scoreInt -= 10;
}
else if(worlds[x][y]... |
4cecdb93-4da6-45e3-a5c3-cc37d3a8c513 | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
//Global farm info/statistics command
if(cmd.getName().equalsIgnoreCase("autofarminfo") && args.length == 0){
switch(args.length){
case 0:
sender.sendMessage(ChatColor.GREEN+"Total Farms: "+mainClass.sta... |
6351d5cd-522b-4bd6-9262-3a9474290c34 | 4 | @Override
public void takeInfo(InfoPacket info) throws Exception {
super.takeSuperInfo(info);
Iterator<Pair<?>> it = info.namedValues.iterator();
Pair<?> pair = null;
Label label = null;
while(it.hasNext()){
pair = it.next();
label = pair.getLabel();
switch(label){
case RPMs:
RPM = (Double) p... |
f8396667-0776-42e2-9435-40a5e8b9fe96 | 8 | protected Class determineClass(String name) throws Exception {
Class result;
if (name.equals(Boolean.TYPE.getName()))
result = Boolean.TYPE;
else
if (name.equals(Byte.TYPE.getName()))
result = Byte.TYPE;
else
if (name.equals(Character.TYPE.getName()))
... |
4a89c5c1-eddc-433b-8fcd-b6bbeb141e8e | 7 | public static void printMaxSumIncreasingSubsequence(Integer[] arr) {
int[] liss = new int[arr.length]; //holds the longest LIS length ending at i.
liss[0] = 1;
int maxSum = 1;
for (int i = 0; i < liss.length; i++) {
liss[i] = arr[i];
}
for (int i = 1; i < liss.length; i++) {
liss[i] = 1;
for (in... |
12813a4c-273d-4b55-8c7c-1e31e84ca65b | 1 | private static BufferedImage resizeImage(BufferedImage originalImage, Dimension newImgSize) {
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
BufferedImage resizedImage = new BufferedImage(newImgSize.width, newImgSize.height, type);
Graphics2D g = resizedImage.createG... |
30404ee3-373e-4575-9cc9-a9aff57b2822 | 6 | public void takeStep(Graphics2D graphics) {
long now = System.nanoTime();
double delta = this.getLastUpdateTime() > 0 ? (now - this.getLastUpdateTime()) / 1000000000L : 0;
if(delta > 1) {
delta = 0;
}
this.setLastUpdateTime(now);
DeltaState state = this.getEventQueue().takeState(delta);
for(GameCompo... |
262f7f0d-2f35-4dd5-9a5a-544f56f88e2e | 1 | public void testDividedBy_int() {
Hours test = Hours.hours(12);
assertEquals(6, test.dividedBy(2).getHours());
assertEquals(12, test.getHours());
assertEquals(4, test.dividedBy(3).getHours());
assertEquals(3, test.dividedBy(4).getHours());
assertEquals(2, test.dividedBy(5... |
947137fa-22bc-435f-9b99-ac7675b95186 | 2 | public ServerProperties(String propFile){
configFile = new Properties();
try {
configFile.load(new FileInputStream(new File(propFile)));
} catch (Exception e) {
System.out.println("Prop file error: "+e.getMessage());
error = true;
}
if( !error ){
// DB
DB_URL = configFile.getProperty("D... |
1c825690-912a-4a1a-8355-461a6cb7687d | 9 | @Override
public void validate(Object obj, Errors errors) {
Book pi = (Book) obj;
if (pi == null) {
errors.rejectValue("pages", "error.not-specified", null, "Value required.");
return;
}
if (pi.getPages() != null && pi.getPages() > maxPages)
{
... |
2b76be49-2d20-42a0-b374-34b0f6015a31 | 5 | public int getequal2(String id ,String newpassword) throws Exception{
try{
@SuppressWarnings("resource")
ObjectInputStream osi = new ObjectInputStream(new FileInputStream("membercollection.txt"));///óϾ , Ͼ׳ϴ° ҽ߰
this.setMemberCount(osi.readInt());
collectionm.clear();
for( int i= 0; i< this.getMemberC... |
bfbd0fe4-8524-490d-b57f-817cbbb39cc2 | 7 | private ArrayList <Attribute> getAttrFromTable(TableData td)
{
Attribute[] in=new Attribute[td.getAttrCount()*2];
Iterator<AttInfo> iter=td.iterator();
while(iter.hasNext())
{
AttInfo att=iter.next();
String name=att.getName();
if(name.substring(name.length()-3, name.length()).equals("out"))
{
... |
ab5c5095-5306-404e-9457-534e89b1aded | 4 | public int jump2(int[] A) {
int len = A.length;
int [] DP = new int[len];
DP[0] = 0;
for (int i = 1; i < len; ++i){
int min = 1 << 30;
for(int j = i-1; j>=0; --j){
if (j + A[j] >= i){
min = Math.min(min, DP[j]+1);
... |
1966c024-cea1-4c62-ac1d-01f2f5067a80 | 5 | @Override
public Set<Long> getAdjacent(long vId) {
// traverse through all incident edges and make unique add all vertices
// except the own one
Set<Long> vIds = new HashSet<>();
// get all incident Edges to the given Vertice. All adjacent are subset
// of the incidents
Set<Long> incident = getIncident(vId... |
dc6098dd-cf72-4c24-aef1-68c0cd427e01 | 8 | public void addEntityWithID(int entityID, Entity e)
{
if(entities.contains(e))
entities.remove(e);
if(e instanceof EntityPlayer && !players.contains(e))
{
for(int i = 0;i<loadedPlayers.size();i++)
{
if(((EntityPlayer) e).username.equals(loadedPla... |
0b9c72fd-8240-4e2c-bbc1-9e5dff0b5449 | 4 | private void calcTargets(int location, int numSteps, boolean[] visited) {
// Initialized a new LinkedList list of adjacents cells for this location
LinkedList<Integer> adjacentCells = new LinkedList<Integer>();
// Adds unvisited cells to a new adjacency list
for (Integer i : getAdjList(location)) {
if ... |
f47f92e9-d6a1-40d9-bf83-06023a2f4d80 | 7 | public void SetWhiteBalance(WhiteBalance newbalance) {
for (int i = 0; i < this.IP.length; i++) {
Parent.WriteLogtoConsole(Parent.Camera.GetIP()[i] + ": Setting WhiteBalance to " + newbalance);
this.ImageWhiteBalance = newbalance;
float GainR, GainB, GainG, GainGB;
... |
4b038d43-f2c2-4190-ad50-73d2f46836a5 | 6 | public void run() {
final int matid = mat.getId();
final String worldName = world.getName();
ArrayList<QueuedBlock> blocks = new ArrayList<QueuedBlock>();
final Vector min = Vector.getMinimum(ll.toVector(), rl.toVector());
final Vector max = Vector.getMaximum(ll.toVector(), rl.to... |
fe27ea15-67f3-4271-8f65-bd7ef5c15e82 | 7 | @SuppressWarnings("rawtypes")
public void saveForecast() {
String result = null;
String weatherDescription = null;
try {
result = urlReader.readUrl("http://api.openweathermap.org/data/2.5/forecast/daily?lat=" + config.getWeather_lat() + "&lon=" + config.getWeather_lon() + "&cnt=" + config.getWeather_fu... |
4ae0cc7a-129a-408b-b3b7-257e89de0f55 | 5 | private void Comparar()
{
String Usuario = txtUsuario.getText();
if(txtClave.getText().equals(String.valueOf(jPContrasena.getPassword())))
{
JOptionPane.showMessageDialog(this, "BIENVENIDO " + Usuario);
iniciarCarga();
iniciarSplash();
if (... |
e1126b56-1a35-4852-a187-176ee70a9499 | 5 | int[] kmpTable(String needle) {
if (needle.length() == 0)
return null;
if (needle.length() == 1) {
int[] T = new int[1];
T[0] = -1;
return T;
}
int[] T = new int[needle.length()];
int pos = 2; // the current position we are computing in T
int cnd = 0; // current candidate substring
T[0] = -1... |
d9e4e8e9-b623-489b-b0d5-b46dc9253a31 | 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... |
a0d336de-7aa7-48c5-8c87-c2ed90b876d0 | 8 | public String getContentType() {
if (!isFile()) {
throw new IllegalStateException("not a file");
}
String contentType;
String extensions = file.getName();
int index = extensions.lastIndexOf(".");
if (-1 == index) {
// no extension
conte... |
2e01d6b6-0327-4524-8c6b-7598e9cd408e | 7 | @Override
public void update(Observable arg0, Object arg1) {
int digit = model.getDigitAt(row, col);
SudokuPart constraint = model.getCurrentConstraint();
if (constraint != null && constraint.getRow() == row
&& constraint.getCol() == col) {
setBackground(Color.GREEN);
} else {
SudokuPart popped = mod... |
dc86bec8-1538-4ce3-93e1-355e102f882e | 7 | public static double process_postfix(String postfix, HashMap<String,
Integer> map) {
Stack<Double> stack = new Stack<Double>();
String opers = "+-*/";
String[] tokens = postfix.split(" ");
for (String token : tokens) {
if (opers.indexOf(token.charAt(0)) == -1) {
... |
934a98b3-5ae7-4ac2-9261-872f95017238 | 3 | public static void main(String[] args) {
// Catch the exact type:
try {
throw new Sneeze();
} catch (Sneeze s) {
System.out.println("Caught Sneeze");
} catch (Annoyance a) {
System.out.println("Caught Annoyance");
}
// Catch the base type:
try {
throw new Sneeze();
} catch (Annoyance a) {
... |
a5592c4c-7cb5-4b81-a845-8ee62d32c7d7 | 3 | public Packet sendAndGetResponse(final Packet packet, ClientHandler client) throws TimeoutException {
client.queuePacketForWrite(packet);
final Packet[] response = new Packet[1];
final Thread currentThread = Thread.currentThread();
final Class<? extends Packet> responseType = protocol.... |
b296c06d-6808-452d-ad61-20bdd2eb88b4 | 6 | private int calculateFilledPointsInDir(int startX, int startY, int dirX, int dirY, int index) {
int count = 0;
int tmpX = startX;
int tmpY = startY;
for (int i = 1; i < 5; ++i) {
tmpX += dirX;
tmpY += dirY;
if (tmpX < 0 || tmpX >= gameRes.getFieldSize(... |
8236376c-72fc-48fd-8655-df94c58ca4a5 | 2 | public List<Road> RechercherRoad(String depart , String arrive){
Road R = new Road();
List<Road> list = new ArrayList<>();
try {
String req = "select * from road where CityD="+depart+" and CityR="+arrive+"" ;
Statemen... |
6c289e5f-0d16-4b7a-a7c5-cc6487b7f18c | 5 | public static void main(final String[] args) {
final List<Long> list = new ArrayList<Long>();
list.add(1L);
list.add(1L);
for (int i = 0; i < Integer.MAX_VALUE; i++) {
final long l = (list.get(list.size() - 1) + list.get(list.size() - 2));
if (l >= 4000000)
break;
list.add(l);
}
for(final Ite... |
604af923-c452-416e-be86-2beebfe8de72 | 5 | public void update() {
Connection conn = null;
PreparedStatement pstmt = null;
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/rock";
conn = DriverManager.getConnection(url,"root","123456");
String sql = "update emp2 set sal=999 where ename = ?";
pstmt = c... |
3e8247cc-9c51-4d13-b27a-0d14bc62a458 | 4 | private void miImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miImportActionPerformed
// Check for changes, if so ask for confirm
if (story.isSomethingChanged()) {
// Show save confirm window
int n = JOptionPane.showConfirmDialog(null,
... |
5e335ba7-0c50-457b-ba16-706fc0d242bf | 2 | public void init(String language) {
locale = supportedLanguages.get(language);
try {
InputStream is = ClassLoader.getSystemResourceAsStream("language_"+locale.toString()+".properties");
// System.out.println("url.getPath(): " + url.getPath());
//File f = new File("language_"+locale.toString()+".prop... |
32416d55-fb50-47f7-816c-d89f8eb5773d | 8 | private static String paramVFromURL(URL url) throws HostNoGV, NoQuery, NoYouTubeParamV, DocIdInvalid {
/** YouTube */
String queryURL;
int startDocId, endDocId;
if ((url.getHost() == null) ||
(url.getHost().indexOf("youtube.com") == -1)) {
throw new HostNoGV();
... |
e701b919-f63d-440a-9ecf-b5369dd1e07f | 8 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length == 0) {
if (player == null) {
sender.sendMessage("This command can only be run by a... |
35a07247-e5e1-43ca-87f8-94ccec8b9827 | 9 | static void checkFrameValue(final Object value) {
if (value == Opcodes.TOP || value == Opcodes.INTEGER
|| value == Opcodes.FLOAT || value == Opcodes.LONG
|| value == Opcodes.DOUBLE || value == Opcodes.NULL
|| value == Opcodes.UNINITIALIZED_THIS) {
return;
}
if (value instanceof String) {
checkIn... |
bc7bb357-611f-4847-a853-dc63d2b513d0 | 3 | public void play()
throws JavaLayerException
{
try
{
System.out.println("playing "+fFilename+"...");
InputStream in = null;
if (remote == true) in = getURLInputStream();
else in = getInputStream();
AudioDevice dev = getAudioDevice();
Player player = new Player(in, dev);
player.play();
}
... |
16a277ab-e77d-452d-9ce2-35329f3c02ae | 2 | public static void exit() {
quitToMenu();
//cleanly exits if on windows or mac
if(GetOS.isWindows() || GetOS.isMac()) {
System.exit(0);
}
//not so clean, but that is because linux is superior
else {
System.exit(0);
}
} |
99056df6-7d86-4f2e-8939-aa32011cf5ca | 1 | @Test
public void exceptionThrownIfSubmittedOnIsNullWithinFormData() {
when(budgetFormData.getSubmittedOn()).thenReturn(null);
try {
budget.buildBudget(budgetFormData);
fail("SubmittedOn is null.");
} catch (Exception e) {
System.out.println("SubmittedOn... |
aba2eb4b-1e8c-495c-9b9d-a65dab131c85 | 1 | private static void init() {
// We can't do this in the static initializer because USE1_2 might
// not have the desired value.
CallGraph.preLive = new HashSet();
CallGraph.preLive.add("java.lang.Boolean");
CallGraph.preLive.add("java.lang.Class");
CallGraph.preLive.add("java.lang.ClassLoader");
CallGrap... |
23b48d0c-a10d-465e-a757-3b2dbf9f51d0 | 8 | static String getShortUnitText(double v, String u) {
double va = Math.abs(v);
if (va < 1e-13)
return null;
if (va < 1e-9)
return shortFormat.format(v*1e12) + "p" + u;
if (va < 1e-6)
return shortFormat.format(v*1e9) + "n" + u;
if (va < 1e-3)
return shortFormat.format(v*1e6) + CirSim.muString + u... |
8b51cb3b-2c88-41c7-9975-14d3092401e5 | 6 | private void redispatchMouseEvent(MouseEvent e, boolean repaint) {
Point glassPanePoint = e.getPoint();
Container container = contentPane;
Point containerPoint = SwingUtilities.convertPoint(telePointer,
glassPanePoint, contentPane);
if (containerPoint.y < 0) { // we're not in the content pane
// if (cont... |
76b09d67-5ce5-43cd-859a-044131b356d4 | 4 | public static Member_details readarray()
{
Member_details newuser1 = null;
{
try {
RandomAccessFile raf = new RandomAccessFile(filename, "rw");
raflength = (int)((raf.length())/167);
for(int i=0; i<raflength; i++)
{
raf.seek(1... |
9f661575-d08b-4420-964e-4d2bdd89458b | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Constante other = (Constante) obj;
if (Double.doubleToLongBits(value) != Double
.doubleToLongBits(other.value))
return false;
return tru... |
ee27f4cc-c2ee-4282-bc11-c7979e92c9db | 7 | private void setNodeLabelFromAttributes(DrawableNode treeNode) {
if (treeNode.getAnnotationValue("Scientific name")!=null) {
treeNode.setLabel(treeNode.getAnnotationValue("Scientific name") );
return;
}
if (treeNode.getAnnotationValue("Common name")!=null) {
treeNode.setLabel(treeNode.getAnnotationValue... |
98f76fa1-6081-4bec-8c2e-2c4f8a03e469 | 2 | private int getMaxScore(ArrayList<Integer> scoresSeen, int start, int len) {
int max = 0;
for (int i=start; i<len+start; i++) {
if (max < scoresSeen.get(i)) {
max = scoresSeen.get(i);
}
}
return max;
} |
58844fe5-bdf1-45eb-a7f6-8c97c0922a06 | 4 | public WiiIsoFilesystem(FileBase _file) throws IOException
{
if (masterkey == null)
{
try
{
FileBase keyfile = new ExternalFile("key.bin", "r");
masterkey = keyfile.getContents();
keyfile.close();
}
catch... |
1f58d533-6d7f-41e1-9bda-5c259f27b487 | 7 | public void ge_if(TextArea area,SimpleNode node,String prefix)throws SemanticErr{
int child_num = node.jjtGetNumChildren();
int cur_end_num = end_num;
end_num = end_num+1;
if(child_num==2)if_last=1;
for(int i=0;i<child_num;i++){
SimpleNode child = (SimpleNode)node.jjt... |
a17e3d9f-a2f0-4457-94ab-e1e27625fa7c | 7 | public double eval() throws EvaluationException {
if (evaluator == null || expression == null)
return 0;
if (expression.startsWith("0x")) {
try {
return Integer.valueOf(expression.substring(2), 16);
}
catch (NumberFormatException e) {
throw new EvaluationException("Evaluation exception: " + e.ge... |
8ba7608d-ae1e-4bfd-b691-8106e9243276 | 5 | protected void startBroadMessage(){
while(noStopRequested){
try{
Response msg = broadMessages.take();//获取广播消息
Iterator<Client> it = this.clients.values().iterator();
boolean isCode = false;
while(it.hasNext()){
//log.info(msg.getBody());
Client socketer = it.next();
if(!isCode){... |
240b95b6-fcd1-4884-870c-1e467632e06c | 7 | public static String encodingName(int num) {
switch (num) {
case encodingRaw: return "Raw";
case encodingCopyRect: return "CopyRect";
case encodingRRE: return "RRE";
case encodingCoRRE: return "CoRRE";
case encodingHextile: return "Hextile";
case encodi... |
7b3e31f4-e44b-4eea-a7e7-e8e515186543 | 8 | public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... |
176fa69c-a6cc-494d-a81b-0bf28edb0dfb | 3 | public void run() {
String producedData = "";
try {
while (true) {
if (producedData.length()>75) break;
producedData = new String("Hi! "+producedData);
sleep(1000); // It takes a second to obtain data.
theBuffer.putLine(producedData);
}
}
catch (Exception e) {
// Just let thread termina... |
8ab52417-31a7-4974-8687-381fe32060e8 | 0 | Speed(long milliseconds) {
this.milliseconds = milliseconds;
} |
af2c823d-bbd9-41d9-8641-e400950b963c | 3 | public Class<?> getClass(String name){
StringBuffer tempMessage = new StringBuffer();
Class<?> cls = null;
try {
cls = Class.forName(name);
} catch (ClassNotFoundException e) {
e.printStackTrace();
tempMessage.append("ClassNotFoundException\r\n");
}
return cls;
} |
c63feb3e-a9ae-4b97-bf18-4ae17966af07 | 8 | @Override
public void run() {
logger.config("Initializing...");
running = true;
runLoop:
while (running) {
synchronized (this) {
while (timeouts.isEmpty()) {
logger.finest("Waiting for timeout");
// Check whether som... |
31674069-60c0-42a1-9de7-e637d6626b71 | 4 | @EventHandler(priority = EventPriority.HIGHEST)
public void onInteract(InventoryClickEvent event) {
if (event.isCancelled())
return;
if (event.getInventory().getType().equals(InventoryType.DISPENSER)) {
if (!(event.getInventory().getHolder() == null)) {
return;
}
if (event.isShiftClick())
even... |
eee6acf9-25b3-4024-b29a-a6bdc41fb852 | 8 | public void generateNetherTerrain(int par1, int par2, byte[] par3ArrayOfByte)
{
byte var4 = 4;
byte var5 = 32;
int var6 = var4 + 1;
byte var7 = 17;
int var8 = var4 + 1;
this.field_4163_o = this.func_4057_a(this.field_4163_o, par1 * var4, 0, par2 * var4, var6, var7, va... |
d5db5157-ce0f-4f19-ba52-8e66b48594de | 7 | private void generateLogs() throws FileNotFoundException, IOException {
BufferedWriter writer = null;
if (outFile.getName().endsWith(".gz"))
writer = newGzipBufferedWriter(outFile, Charset.forName("utf-8"));
else {
if (!options.isDaemon)
writer = Files.newBufferedWriter(outFile.toPath(), Charset.forName... |
27194eb4-b329-4937-b80e-06df252d59a0 | 2 | public static Properties getProperties() {
Properties properties = new Properties();
URL resource = Config.class.getResource("/bitcoin_secret.properties");
File propertiesFile = new File("./src/main/resources/bitcoin_secret.properties");
try {
propertiesFile = new File(resour... |
eddcd1c8-3535-4748-b684-72350ee936d6 | 3 | public void login(String randCode) throws IOException {
UserEntity user = Scheduler.getUsers().get(username);
if (user == null) {
return;
}
// URL url = new URL("https://kyfw.12306.cn/otn/login/loginAysnSuggest?loginUserDTO.user_name=" + username
// + "&userDTO.... |
cf0bd222-74cb-4dcb-8fe7-026a6fcc019c | 2 | public int getCountFailures(final String callName) {
int nbErrors = 0;
final List<CallData> data = getCallData(callName);
for (final CallData callData : data) {
if(Status.FAILURE.equals(callData.getStatus())) {
nbErrors++;
}
}
return nbErrors;
} |
91097441-4ef7-4ab1-955d-495a8427d3dc | 8 | protected void toXMLImpl(XMLStreamWriter out, Player player,
boolean showAll, boolean toSavedGame)
throws XMLStreamException {
PlayerExploredTile pet = (showAll || toSavedGame) ? null
: tile.getPlayerExploredTile(player);
// Start element:
out.wr... |
d66b9031-6e2c-4d7d-a765-4d58982c9ef9 | 3 | private int smallestChild( int parent ) {
// see if the parent is actually a leaf
if ( parent > ( size / 2 ) - 1 ) {
return NO_CHILD;
}
// parent has at least one child
int leftChild = 2 * parent + 1;
int rightChild = leftChild + 1;
// if parent has no right child, return left child... |
929dc151-1771-4f7a-9b65-8465eb3d08e4 | 7 | public static QuestionCalculation decode(String encodedQuestionCalculation) throws DecodeException {
QuestionCalculation res;
if (encodedQuestionCalculation.substring(0, 19).compareTo("#QuestionCalculaion") == 0) {
res = new QuestionCalculation();
int i = 19;
if (enco... |
fcdd2d87-f083-457e-9cb0-1c4c1e6fda76 | 7 | private boolean renderBlockRepeater(Block par1Block, int par2, int par3, int par4)
{
int i = blockAccess.getBlockMetadata(par2, par3, par4);
int j = i & 3;
int k = (i & 0xc) >> 2;
renderStandardBlock(par1Block, par2, par3, par4);
Tessellator tessellator = Tessellator.instance... |
a52bfa0b-5f7d-4b02-92e2-90fd29a05082 | 9 | private static void setDefaultLookAndFeel(){
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (UnsupportedLookAndFeelException... |
5cc336f3-83c6-4ced-870f-0c0f728fbf89 | 2 | @Override
public final void setValue(final int value) {
if (!mutable) {
return;
}
this.value = Math.min(maxValue, Math.max(minValue, value));
for (final ChangeListener x : changeListener) {
x.stateChanged(new ChangeEvent(this));
}
} |
c0bb69f7-2d59-4ed3-ba47-1a5f6e60554c | 4 | private ArrayList<StockItem> getRandomOrderItemList(boolean customerOrderMode) {
boolean selected[] = new boolean[getStockDB().getStockList().size()];
for (int i = 0; i < selected.length; i++)
selected[i] = false;
orderStockItemList = new ArrayList<StockItem>();
grandTotal = 0;
for (int i = 0; i < random... |
02b28a96-2910-41e7-872b-708798cd6ca6 | 8 | private Object handleUid(Object tos, String tagName) {
if ((tos instanceof PersonFamilyCommonContainer && ((PersonFamilyCommonContainer)tos).getUid() == null) ||
(tos instanceof EventFact && ((EventFact)tos).getUid() == null) ||
(tos instanceof Source && ((Source)tos).getUid() == null)) {
... |
4a60e0c4-6b7d-4388-a1b9-e23dfed5edda | 9 | private static final void method1025(int[] is, int[] is_73_, int[] is_74_, byte[] bs, int i, int i_75_, int i_76_) {
int i_77_ = 0;
for (int i_78_ = i; i_78_ <= i_75_; i_78_++) {
for (int i_79_ = 0; i_79_ < i_76_; i_79_++) {
if (bs[i_79_] == i_78_) {
is_74_[i_77_] = i_79_;
i_77_++;
}
}
}
... |
cbdefe27-b8c0-44ab-abb3-913502e72480 | 8 | @Override
public void processUpdaste( boolean isEnterSub ) {
switch ( _model.getSqNo() ) {
case SQ_START:
_model.onUpdateStart( isPressKey( KeyEvent.VK_ENTER ) );
break;
case SQ_READY_GO:
_model.onUpdateReadyGo();
break;
case SQ_TETRIS:
int keyCode = 0;
if ( isPressKey( ... |
5888ef04-72fc-4174-8967-340373cc418b | 1 | public JPanel getGUI() {
JPanel p1;
button1 = new JButton("Add Question");
button1.addActionListener(this);
addquestionButton1 = new JButton("Set a MCQ Question");
addquestionButton1.addActionListener(this);
addquestionButton2 = new JButton("Set a FIB Question")... |
539b4f67-b71a-4840-aa3c-3492245c1565 | 7 | public void windowClosed(WindowEvent e) {
AppInstance closingApp = getApplication(e.getWindow());
if(closingApp == null) return;
WeakVector windows = closingApp.getWindows();
Iterator it = windows.iterator();
boolean openWindows = false;
... |
45219b22-430d-40cc-97fc-4a4a49923222 | 4 | static void ImprimirTablero(Bloque tablero[][]){
System.out.print("\n\n\n\n\n\n\n");
System.out.println(" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15");
for (int i = 0; i < 15; i++) {
if (i<9) System.out.print(i+1+" ");
else System.out.print(i+1+" ");
f... |
7a81881b-1645-47ca-b9da-f889a94d7f65 | 8 | public char findWinner() {
for (int rowOffset = 0; rowOffset < 9; rowOffset+= 3) {
if (boardSpaces[0 + rowOffset] == boardSpaces[1 + rowOffset]) {
if(boardSpaces[0 + rowOffset] == boardSpaces[2 + rowOffset]) {
return boardSpaces[0 + rowOffset];
}
... |
04346090-50af-4836-a741-071094b7299d | 6 | public void add_value(Buffer lbuf, int soffset, int end, LuaValue repl) {
switch (repl.type()) {
case LuaValue.TSTRING:
case LuaValue.TNUMBER:
add_s(lbuf, repl.strvalue(), soffset, end);
return;
case LuaValue.TFUNCTION:
repl = repl.invoke(push_captures(true, soffset, end)).arg1();
break;
... |
5ec4805f-2699-42bd-9eea-b89d544d9a57 | 5 | public static String getTerm(URI uri) {
// if the SO terms have not been loaded,
// then load them now
if(null == so) {
loadSO();
}
// EO: is there a more efficient solution?
// the answer will depend on the answer to the question above
if(so.containsValue(uri) && null != uri) {
// here, we nee... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.