method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0f173b28-31cc-47ae-bffa-5f9f2aa6212f | 4 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
}
catch (Exception e) {
System.err.println("Invalid file input");
}
int input;
int count;
int count2;
int count3;
while (inputScanner.hasNextLine()) {
count = 1;
cou... |
fe08001d-f2af-49ce-90c5-45dc87458d3b | 3 | String[] getMOTD() {
try {
File file = new File("MOTD.txt");
if(!file.exists()){
file.createNewFile();
}
BufferedReader r = new BufferedReader(new FileReader(file));
ArrayList < String > temparray = new ArrayList < String > ();
String s = ... |
1cbcfe1f-984c-4397-9dc7-90aa45915bcb | 4 | public boolean matchesSub(Identifier ident, String subident) {
String prefix = ident.getFullName();
if (prefix.length() > 0)
prefix += ".";
if (subident != null)
prefix += subident;
if (firstStar == -1 || firstStar >= prefix.length())
return wildcard.startsWith(prefix);
return prefix.startsWith(wildc... |
6e68a596-71a5-4121-8f9c-82499d373a03 | 9 | public void updateProcess(int NEW_STATE) {
long timePassed = SystemClock.getTime()-this.timeOfLastEvent;
if (NEW_STATE == CPU_QUEUE) {
Statistics.processesPlacedInCpuQueue();
} else if (NEW_STATE == IO_QUEUE) {
Statistics.processesPlacedInIOQueue();
} else if (NEW_STATE == FINISHED) {
Statistics.pro... |
8e4b063e-aac4-4ad6-8a0b-5fe4b0b22a05 | 5 | private String determineChomp (String text) {
String tail = text.substring(text.length() - 2, text.length() - 1);
while (tail.length() < 2)
tail = " " + tail;
char ceh = tail.charAt(tail.length() - 1);
char ceh2 = tail.charAt(tail.length() - 2);
return ceh == '\n' || ceh == '\u0085' ? ceh2 == '\n' || ceh2 ... |
ae2b4f2f-8a0e-42c0-a497-eccb8ec99cb9 | 7 | public boolean checkEndConditions(){
//the return value
boolean retVal = false;
try{
//the number of each piece left
int whitesGone = 0 , bluesGone = 0;
//the board to work with
Board temp = theFacade.stateOfBoard();
//go through all the spots on the board
for(... |
b670497f-8bf1-4b40-960b-184188d55356 | 4 | public double perimeter() throws TypeOverflowException {
double p = 0;
try {
for (Iterator<Line> it = lineIterator(); it.hasNext(); ) {
p += it.next().distance();
if (Double.isInfinite(p) || Double.isNaN(p))
throw new TypeOverflowException();
}
} catch(OverflowException e) {
throw new Type... |
e6649d6a-1acb-4d03-8cfd-2a3d9daa2d71 | 9 | private void affichageErreursDiffuseur(List<Error> erreursDiffuseur) {
for (Error e : erreursDiffuseur) {
switch (e) {
case raisonSocialeVide:
this.labelErreurRaisonSocialeDiffuseur.setText("Veuillez saisir une raison sociale");
break;
... |
215f53b3-4f3f-4b48-9620-fdcb405dfc68 | 9 | public void init(File param){
isInialize=true;
try {
configFile = FileConfig.deserializeXMLToObject(param);
} catch (FileNotFoundException e1) {e1.printStackTrace();}
/*
* Download SVM
*/
try {
File f = new File(configFile.getBinSVM());
if(f.exists()){
FileInputStream fis = new File... |
6b670810-ac06-458d-9ef8-2c2cf45aade8 | 1 | public boolean connect() {
try {
connectionSocket = new DatagramSocket();
inetAddress = InetAddress.getByName(ip);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
} |
0fab2a5f-2018-4fdb-a0d5-fa6b0cbf4454 | 1 | * @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public void converseVoid(final Object command)
throws UnknownHostException, IOException... |
0a12d96d-29cf-4765-82be-5ea0a6c88822 | 2 | public int lastLineNumber(){
int lineNum = parse.getLastLineNumber();
if (lineNum <= -1) return -1; // Nothing has been read yet
if (lineNum == 1) return -1; // only labels have been read
return lineNum - 1; // adjust line number to account for the label line
} |
67138f0b-5630-49bb-8647-f9ba7ce12764 | 2 | @Override
public void paintComponent(Graphics graphics) {
// Controls when canvas needs to be drawn onto.
if (this.startDraw) {
// Get the reference of graphics ovject and pass it to screengc.
Graphics screengc = graphics;
// Get the graphics instead from the buf... |
cb3269d8-80e7-4bf6-b7ef-b2c601921c90 | 6 | @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("<td valign='top'>");
sb.append("Event created by: ").append(getCreator()+"<br />");
sb.append("Date: ").append(new Date(getDatetimemillis())+"<br />");
sb.append("Position: ").append(getLatitud... |
2e86822f-ce21-408b-8cb7-a9e7e38e8799 | 9 | @Override
public void checkForMutations()
{
// Convenience variables.
AbstractAction replicateAction = ((AbstractAction)replicationResult.getReplicate());
Collection<ICondition> original = action.getConditions();
Collection<ICondition> replicate = replicateAction.getConditions();
// Look for addition and... |
3c4c90aa-0bde-4759-96c0-a2b5b5b5750f | 8 | public Image attackImage(int i)
{
Image temp = null;
switch(i)
{
case 1:
temp = new ImageIcon("src/images/north_attack.png").getImage();
break;
case 2:
temp = new ImageIcon("src/images/north_east_attack.png").getImage();
break;
cas... |
a32f01b2-4411-4019-8957-c30c76993a0f | 6 | public void FixCSV(String filePath, boolean isFixHeader) throws FileNotFoundException, IOException{
FileManager fm = new FileManager();
fm.copy(filePath, "c:/temp",true);
File theFile = new File("c:/temp");
FileReader readerFile = new FileReader(theFile);
BufferedReader ... |
272fd746-7739-41f4-8f78-5c8c37b2de3c | 9 | public SchemeObject readSymbol(){
StringBuilder buffer = new StringBuilder();
int c = getc();
while(isInitial(c) || Character.isDigit(c) ||
c == '+' || c == '-' || c == '.' || c == '/' || c == '_' || c == '&'){
buffer.append((char)c);
c = getc();
}
if(isDelimiter(c)){
... |
d99083df-60f0-4b74-884d-40d50f025802 | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbSecFormByUJEEServletIdxKey ) {
GenKbSecFormByUJEEServletIdxKey rhs = (GenKbSecFormByUJEEServletIdxKey)obj;
if( getRequiredSecAppId() < rhs.getRequiredSecAppId() ) {
return( -1 );
}
else if( getR... |
630b0574-565f-4ef3-bdb8-4100a3304f80 | 1 | public MediaUrlDao() {
// create a database connection
try {
con = DriverManager.
getConnection("jdbc:h2:./database/twitterKeyWordSearch.h2");
tableCheckAndCreate();
} catch (SQLException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
} |
b15fbab4-0858-4117-934a-96ed9bbf98de | 4 | public static byte pedir_q_cuenta(){
byte aux=0;
do{
try{
System.out.println("1. Ingreso en Cuenta Corriente");
System.out.println("2. Ingreso en Cuenta Ahorro");
System.out.print("OP => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
aux=Byte.parseByte(stdin.r... |
bb93e631-7fc2-45e4-ba77-48c6f42de6c2 | 4 | @Override
public boolean execute(Player player) {
if (!player.getInventory().hasItem("beamer"))
{
GameEngine.gui.println("You can not teleport without the beamer.");
return false;
}
Beamer beamer = (Beamer) player.getInventory().getItem("beamer");
if (beamer.isCharged())
{
Room vRoom = beamer.g... |
ea11dbdd-5388-45f6-9b91-ba94b05291c0 | 2 | public boolean equals(Object aObject) {
if (this == aObject) {
return true;
} else if (aObject instanceof DAOCompeticao) {
DAOCompeticao lDAOCompeticaoObject = (DAOCompeticao) aObject;
boolean lEquals = true;
return lEquals;
}
return false;... |
62ce08de-c310-4048-aa87-7d6b85cb35b2 | 4 | public void eseguiSimulazioneConvalida() {
/* Inizializzazione vettore. */
ArrayList<Double> tempiUscitaMedi = new ArrayList<Double>();
/* Cicla sui job. */
for (int i = passo ; i <= jobTotali ; i += passo) {
seed_arrivi = 229;
seed_routing = 227;
s... |
76f21d81-5cf8-4535-b16a-8be0684ce995 | 7 | public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... |
a8757093-8415-45d3-a896-4a2bbf7ae134 | 9 | protected void fillSpectrum()
{
for (int i = 0; i < spectrum.length; i++)
{
spectrum[i] = (float) Math.sqrt(real[i] * real[i] + imag[i] * imag[i]);
}
if (whichAverage == LINAVG)
{
int avgWidth = (int) spectrum.length / averages.length;
for (int i = 0; i < averages.length; i++)
... |
f0feb9a7-9c57-4a0a-9456-d56a36eb4dba | 5 | public void fadeOutIn( FilenameURL filenameURL, long milisOut, long milisIn )
{
if( !toStream )
{
errorMessage( "Method 'fadeOutIn' may only be used for " +
"streaming and MIDI sources." );
return;
}
if( filenameURL == null )
... |
f1973bb3-62de-4dd8-8e20-50c5e655d065 | 4 | @Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
{
// hack
TreePath path = tree.getPathForRow(row);
if (path != null)
{
TreeNode tn = (TreeNode)path.getLastPathCom... |
b7d8454e-bb2c-47b6-9f27-3982702166b2 | 3 | @Override
public void onCollideWithEntity(Entity entity)
{
if(timeAlive >= lifeTime && !this.hasCollided && !(entity instanceof EntityPlayer))
{
this.hasCollided = true;
world.attemptAttack(this, this.getBB(this.getCoords()), this.getFacing().copy().normalise(), this.damage, this.knockback);
}
} |
2d078087-b3f0-4bf4-8015-7b4f5d08900f | 1 | private void copyHashMap(HashMap from, HashMap to) {
to.clear();
Iterator it = from.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
String value = (String) from.get(key);
to.put(key,value);
}
} |
82b8e14a-1777-43c9-abf3-af91d94d44df | 5 | private void updatePicture() {
BufferedImage bufferedImage = null;
try {
Iterator<ImageReader> readers = ImageIO
.getImageReadersByMIMEType(mimeType);
ImageInputStream iis = ImageIO
.createImageInputStream(new ByteArrayInputStream(image));
if (readers.hasNext()) {
ImageReader reader = reader... |
5cf9c6ac-2381-4140-b9bf-ca8325b87412 | 1 | public void untimed() {
boolean captured = lock.tryLock();
try {
System.out.println("tryLock(): " + captured);
} finally {
if (captured)
lock.unlock();
}
} |
cc191e38-1993-4c72-8f5e-020352b66ead | 7 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int cases = Integer.parseInt(in.readLine());
StringBuilder sb = new StringBuilder( );
for (int i = 0; i < cases; i++) {
String line = in.readLine();
int M = 0;
int F = 0;
... |
56633a64-ca23-499e-8852-0161f46e8407 | 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... |
9a181ac0-01bb-45d5-b06c-fed02060b6c9 | 3 | @Override
public void setNewPosition(int x, int y) {
boolean bottleIsThrowable =
mMovementStr == MovementStrategy.ALIVE && bottle != null;
if (bottleIsThrowable && rnd.nextInt(30) == 0) {
bottle.setNewPosition(getX(), getY());
Field.getInstance().addStationar... |
6bcacbe6-9be0-4a0f-ab06-47f2cccc4563 | 4 | Object getParameter(int position) {
if (position >= 0 && position < values.length) {
if (values[position] == null) {
try {
values[position] = types[position].newInstance();
} catch (Exception ex) {
throw new RuntimeException(ex)... |
f72e0f6e-7813-44c3-94ad-8f0e12416907 | 7 | public int getTextureForDownloadableImage(String par1Str, String par2Str)
{
ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(par1Str);
if (var3 != null && var3.image != null && !var3.textureSetupComplete)
{
if (var3.textureName < 0)
... |
a3ff991c-1ed9-4f0c-b6ff-7258acb40569 | 7 | @Override
public String getAnswer() throws Exception {
//Reworked this to use a boolean cache instead of a Set for a major jump in performance.
//Max value is x^2 + 2^3 + 2^4
int max = (int) sqrt(TARGET - 8 - 16);
Iterable<Long> primes = getPrimes(max);
boolean[] cache = new... |
a31cd477-7134-4c32-a888-96ea7533b1bb | 1 | Hashtable getHiddenMethods() {
if (hiddenMethods == null)
hiddenMethods = new Hashtable();
return hiddenMethods;
} |
d479473f-cee0-461a-8e0e-eded39e218dd | 9 | public boolean solve() {
Scanner sc = new Scanner(System.in);
pattern = sc.next();
while (sc.hasNext()) {
int openCost = sc.nextInt();
int closeCost = sc.nextInt();
bracketCosts.add(new Cost(openCost, closeCost));
}
int currI... |
e5c07668-406d-4613-bba8-5f5f6cf9906a | 2 | private void paintBoard(Graphics graphics) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
graphics.setColor(BOARD_COLOR);
graphics.drawRect(STARTING_X_INDEX + (j * SIZE_OF_SQUARE), STARTING_Y_INDEX + (i * SIZE_OF_SQUARE), SIZE_OF_SQUARE, SIZE_OF_SQUARE);
}
}
} |
d41a1117-137b-415c-8e6f-c26e413e0b13 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
456e180c-258e-495f-a99f-104d63a94025 | 2 | public void showStorage(){
System.out.println("Total Balance : " + access(Accesscreate()));
if(characterList.size() != 0){
System.out.println("List character : ");
for(Character character : characterList){
System.out.println("character :" + character.toString());
}
}else{
System.out.print... |
dda99fd8-90a7-44a0-baa9-ade2e2c8d000 | 0 | public int getUserAccess()
{
return userAccess;
} |
8e370dc3-cc06-41f0-ac02-642c30746e0f | 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... |
a94f5b65-f07d-4ede-9ae7-316edfb7fa1b | 7 | protected void renderHealthbars(Rendering rendering, Base base) {
if (! structure.intact()) return ;
if (healthbar == null) healthbar = new Healthbar() ;
healthbar.level = structure.repairLevel() ;
final BaseUI UI = (BaseUI) PlayLoop.currentUI() ;
if (
UI.selection.selected() != this &&
... |
96988b9c-37d5-4433-96a9-5f0fd5c7197a | 4 | private void addStringFromDir(File dir) {
System.out.println("addString");
File file = dir;
BufferedReader fin = null;
try {
fin = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
String str = null;
try {
str = fin.r... |
b2a76a11-4adf-4520-a51d-9c2aba167ac4 | 2 | public String getParknameByPID(Statement statement,String PID)//根据PID获取停车场名
{
String result = null;
sql = "select parkname from Park where PID = '" + PID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("parkname");
}
}
catch (SQLException e) ... |
8d66fd9f-9695-472d-95a4-34de00b469da | 7 | @Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource().equals(editButton)) {
setEditFieldsEditable(true);
riverList.setEnabled(false);
setButtonMode(1);
}
if (evt.getSource().equals(newButton)) {
riverListModel.insertElementAt(MainWindow.riverDB.newRiver (), riverLis... |
77edf2ac-9ca7-41fe-847a-d5eac098e254 | 0 | public void setUsed(Boolean used) {
this.used = used;
} |
035e20a3-4887-465a-bddb-8a030c82a5dc | 4 | public int[] bothUtility(){
int blueUtil = 0;
int greenUtil = 0;
for(int i = 0; i < boardSize; i++)
{
for(int j = 0; j <boardSize; j++)
{
COLOR myColor=this.board.get(i).get(j).color;
if( myColor== COLOR.BLUE)
{
blueUtil += this.board.get(i).get(j).weight;
}else if(myColor == COLOR.GR... |
f88b6fd9-b38d-4003-ae85-ce0d53bd8410 | 4 | public void clearCurrent() {
int position;
ItemPanel itemPanel;
for ( position = 0; position < Data.INVEN_SLOTS; position++ ) {
itemPanel = (ItemPanel) panelInven.getComponent( position );
setItemPanel( itemPanel, null );
} // for
for ( position = 0; position < Data.COIN_SLOTS; ... |
9b620975-1616-4931-9f03-2d61f586a30b | 0 | public boolean isHorizontal() {
return horizontal;
} |
a50818e6-8974-4ea5-87ce-3759e6dab811 | 8 | public String toString()
{
int level = level();
char[] tab = new char[level];
for(int i = 0; i < level; i++)
{
tab[i] = '\t';
}
String tabs = new String(tab);
StringBuilder toReturn = new StringBuilder();
int longestKey = 0, extraWidth = 4;... |
49981229-0e2c-478d-8a4e-5d0f5a0e02e0 | 9 | public ArrayList<Integer> postorderTraversal(TreeNode root)
{
if (root == null)
return new ArrayList<Integer>();
ArrayList<Integer> result = new ArrayList<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
TreeNode p = root;
boolean inLeft = true;
... |
7d807b66-1776-4b74-8802-f831fdfd8a1a | 1 | public static Test suite() {
try {
endpointURL = new URL(endpointURLString);
} catch (MalformedURLException e) {
}
TestSuite testSuite = new TestSuite();
testSuite.addTest(new UnitTest("testMakeValidConstantName"));
testSuite.addTest(new UnitTest("testCycAccessInitialization"));
testS... |
fb250e6f-0112-435f-ac1e-066f1a610354 | 6 | @Override
public byte[] drawInvoice() throws IOException, COSVisitorException {
PDDocument doc = null;
try {
doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
... |
ea020eb8-a9ca-4a23-901f-68e174ea9aad | 9 | public static ListNode mergeSortedList(ListNode l1, ListNode l2){
if(l1 == null) return l2;
if(l2 == null) return l1;
ListNode newHead;
ListNode curNode;
if(l1.val < l2.val){
newHead = l1;
l1 = l1.next;
}else {
newHead = l2;
... |
c90c808d-3115-4682-9a84-f2604159187f | 3 | public void choisirParametres() {
// Initialisation des tailles de grille
this.jComboBoxTailleGrilles.removeAllItems();
for(TailleGrille tg : this.TailleGrilles){
this.jComboBoxTailleGrilles.addItem(tg.getX()+"x"+tg.getY());
}
// Initialisation des e... |
b879d50d-87db-49f4-bfc3-139c17b541ca | 2 | protected void readAttribute(String name, int length,
ConstantPool constantPool, DataInputStream input, int howMuch)
throws IOException {
byte[] data = new byte[length];
input.readFully(data);
if ((howMuch & UNKNOWNATTRIBS) != 0) {
if (unknownAttributes == null)
unknownAttributes = new SimpleMap();
... |
a013eb19-625d-40bc-bd87-0e7890135aae | 7 | private int[] findCloesetPoints(int point, List<Integer> knownPoints,
boolean downwards) throws InterpException
{
int positionLast = -1;
int position = -1;
for (Integer curPoint : knownPoints)
{
position = knownPoints.indexOf(curPoint)... |
c7b79923-daeb-4f71-81bd-d83f10e9f5d3 | 6 | @Override
public void run() {
// get folders
int number_of_folders = 0;
if (main.arguments.length >= 1 && lib.Console.isNumeric(main.arguments[0])) {
number_of_folders = new Integer(main.arguments[0]);
} else {
number_of_folders = lib.Console.inputInteger("How... |
3cb8ff20-ad6f-4c2e-9b3e-0a49826c0581 | 3 | private void isLessThanEqualsToDate(Date param, Object value) {
if (value instanceof Date) {
if (!(param.before((Date) value) || param.equals((Date) value))) {
throw new IllegalStateException("Given Date does not lie after the supplied date.");
}
} else {
throw new IllegalArgumentException();
}
} |
d697d172-508b-4921-9162-f5e34cfa900f | 9 | public String execute(HttpServletRequest request, HttpServletResponse arg1)
throws Exception {
ResourceBundle bundle = Resource.getInstance().getRequestToObjectMap();
this.salesItemId = generalTools.NullToEmpty((String)request.getParameter("salesItemId"));
this.txtCountryId = generalTools.NullToEmpty((Strin... |
da5ff544-c986-447d-b877-67215949b976 | 4 | public static void exec(String s) {
try {
String cmd = s + "\n";
try {
JFrameMain.proc.getOutputStream().write(cmd.getBytes());
JFrameMain.proc.getOutputStream().flush();
} catch (IOException e) {
System.out.println(e.getMessage());
}
if (s.equalsIgnoreCase("stop")) {
BukkitServer.stop(... |
ffaa13d6-152b-4a51-ab0f-4475434f6c7d | 4 | @Override
public void moveCursor(int down, int right) {
for (int i = 0; i < right; i++) {
this.getCursor().movePositionRight();
}
for (int i = 0; i > right; i--) {
this.getCursor().movePositionLeft();
}
for (int i = 0; i < down; i++) {
this.getCursor().selectLineDown();
}
for (int i = 0; i > dow... |
353ca6a5-dd6c-4fd1-aac1-7b42898883c8 | 1 | @Test(expected = DuplicateInstanceException.class)
public void addDuplicateActivityTest() throws DuplicateInstanceException {
Activity activity = null;
try {
activity = activityService.find(0);
} catch (InstanceNotFoundException e) {
fail("Activity not exist");
}
activityService.create(activity);
} |
8a8ac40f-c5a3-414c-baef-f0864d1ff1a9 | 7 | public static String camelCaseToUnderline(String name) {
final int length = name.length();
boolean inupper = false;
StringBuilder stb = new StringBuilder(length);
int i = 0;
while (i < length) {
char c = name.charAt(i);
i = i + 1;
if(inupper) {... |
d31b9359-9cc0-45a9-83de-a6a096c8e6f9 | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null || !Room.CheckRights(Main.Data, true) || Room.MoodlightData == null)
{
return;
}
Environment.InitPacket(... |
c9d882c1-fc4f-4dbc-8d1e-ac543fe12ad4 | 6 | public boolean contains(World world, Vector pt) {
if (!this.world.getName().equals(world.getName())) {
return false;
}
final double x = pt.getX();
final double y = pt.getY();
final double z = pt.getZ();
return x >= min.getBlockX() && x < max.getBlockX() + 1
&& y >= min.getBlockY() && y < max.getBloc... |
5f239a4b-4abb-494c-94a5-7f1f67309573 | 7 | private static int[] merge(int[] left, int[] right) {
int[] merged = new int[left.length + right.length];
int mergedTail = left.length + right.length -1;
int leftTail = left.length -1;
int rightTail = right.length -1;
while(leftTail>=0 && rightTail>=0) {
if(left[leftTail] >= right[rightTail]) {
me... |
95ef48f1-6bf7-4f83-81d5-adce4ee3c63e | 7 | public Instances pruneToK(Instances neighbours, double[] distances, int k) {
if(neighbours==null || distances==null || neighbours.numInstances()==0) {
return null;
}
if (k < 1) {
k = 1;
}
int currentK = 0;
double currentDist;
for(int i=0; i < neighbours.numInstances(); ... |
c77be90d-a17d-4852-8848-9830a031ab7c | 9 | private String digitConver(char digit)
{
String returnVal;
switch(digit)
{
case '1':
returnVal = "壹";break;
case '2':
returnVal = "贰";break;
case '3':
returnVal = "叁";break;
case '4':
returnVal = "肆";break;
case '5':
returnVal = "伍";break;
case '6':
... |
ba14f8b8-da02-435b-9e5c-4a169b68c40f | 5 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player player = (Player)sender;
if(commandLabel.equalsIgnoreCase("ignite")) {
if(sender.hasPermission("basics.command.ignite.self")) {
if(args.length == 1) {
sender.sendMessage(ChatColor.GREEN + "You have b... |
201337d1-7bba-4c47-88e9-62fc683bd11c | 3 | public void TheifStall(String stallName, String message, int lvlReq, int XPamount, int item, int itemAmount, int delay, int emote) {
if(theifTimer == 0) {
if(playerLevel[17] >= lvlReq) {
setAnimation(emote);
sendMessage("You steal from the "+stallName);
sendMessage(message);
addItem(item, itemAmount);
... |
632208e3-daca-45c1-baaa-cd61bbf6e40c | 1 | public Object mapValue(Object value) {
return value instanceof Type ? mapType((Type) value) : value;
} |
7a9ee528-e6b6-4f57-9015-286e370d3c6a | 6 | public void printBrake(){
DecimalFormat df = new DecimalFormat("#.000");
IO.println("> Brake Calculation for " + speed + "m/s braking at " + brakerate + " m/s");
IO.print("Cofirm Operation... (y/n) ");
Scanner s = new Scanner(System.in);
String confirm = s.nextLine();
IO.logln("<IN> " + confirm);
... |
812acd61-1c6c-44d0-92ee-fb8c0bc840ba | 5 | public CodeMap3y set(final int index, final int value) {
final int i0 = index >>> 26;
int[][] map1;
if (i0 != 0) {
if (map == null)
map = new int[MAX_INDEX_ZERO][][];
map1 = map[i0];
if (map1 == null)
map[i0] = map1 = new int[MAX_INDEX_ONE][];
} else
map1 = map10;
final int i1 = (index >... |
a48022d5-dd29-46d9-b4c7-c2ac476dcd97 | 0 | public final int getRowCount() {
return data.size();
} |
60aaed90-c203-4a71-bb23-3afef771b3df | 8 | private void readValues(Stream buffer) {
do {
int configId = buffer.getUnsignedByte();
if (configId == 0) {
return;
} else if (configId == 1) {
anInt390 = buffer.get24BitInt();
method262(anInt390);
} else if (configId == 2) {
anInt391 = buffer.getUnsignedByte();
} else if (configId == 3... |
a7ba7efa-6a1c-4bf0-8910-df289208ebd2 | 7 | @Override
public TrackerResponse sendRequest (TrackerRequest request, long time, TimeUnit unit) {
String host = uri.getHost();
int port = uri.getPort();
try (DatagramSocket socket = new DatagramSocket()) {
InetAddress addr = InetAddress.getByName(host);
// UDP Socke... |
8b296d2b-f27b-44fb-95b7-2af09ffe3651 | 4 | public Value measure(Env env) throws SimPLException
{
Value v1 = e.measure(env);
switch(this.op){
case negative:
if(v1.type.typeid == Type.TypeEnum.t_int)
{
IntValue res = new IntValue();
res.type.typeid = Type.TypeEnum.t_int;
res.value = -((IntValue)v1).value;
return res;
}
else
... |
7133379b-f98f-44cd-befd-217a61c7fefc | 3 | public static Object createObjectViaDefaultConstructor(String className) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
if(className != null) {
// Fetch class object ...
Class<?> cla... |
ff36d365-45c6-4224-9392-4f7febb604bd | 1 | public AbilityType getAbilityFromHotkey(int x) {
if (x < 10) {
return player.characterSheet.hotkeys[x - 1];
}
return null;
} |
e0b4137c-7587-4de3-90ff-7c1202e07bad | 9 | private TreeNodeObject makeRootNode(ResultData result) {
// erste Knoten ist Wurzelknoten
String rootPid = "";
// alle erzeugten TreeNodeObjekte werden in einer HashMap gespeichert
Map<String, TreeNodeObject> hashMap = new HashMap<String, TreeNodeObject>();
// erst werden alle TreeNodeObjekte ohne Unterm... |
1d7e7b65-6ac2-43d4-9c4d-d70f38f2123e | 8 | public static void initPermissions() {
createFiles(); // make sure the files exist, if not, create them
try {
Server.display("Loading permissions from file...");
BufferedReader inputFile = null;
try {
// Clear arrays
lstAdmin.clear();
... |
d6b251e4-4e37-4e21-bd86-df9815c7020c | 4 | private List<Integer> findSharedMovies(int user1, int user2) {
List<Integer> sharedMovies = new ArrayList<Integer>();
HashSet<Integer> user1Movies = userRatedMovies.get(user1);
HashSet<Integer> user2Movies = userRatedMovies.get(user2);
if (user1Movies == null || user2Movies == null) {
return sharedMovies;
... |
f1d1d068-e25d-4310-97c7-8e12d1772952 | 8 | public static boolean overlaps(Rectangle r1, Rectangle r2){
//check if r2's verticies are contained in r1
if (r1.contains(r2.getLocation())){
return true;
}
else if(r1.contains(new Point(r2.x + r2.width, r2.y))){
return true;
}
else if(r1.contains(new Point(r2.x, r2.y + r2.height))){
return true;
... |
43586403-f218-47bf-836a-e97e7915c3ba | 6 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length != 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.accept + " (channel)");
return;
}
String... |
bebec32a-3bba-4164-a441-3e5bfc930378 | 4 | public static String readFile(String filename) {
//read content from file
BufferedReader br = null;
String data = "";
try {
String sCurrentLine = "";
br = new BufferedReader(new FileReader("" + filename));
while ((sCurrentLine = br.readLine()) != n... |
1a2e583b-066b-4e8a-b967-7f5a94a8c746 | 8 | public static String getMediaDirectory()
{
String directory = null;
boolean done = false;
// check if the application properties are null
if (appProperties == null)
{
appProperties = new Properties();
// load the properties from a file
try {
// get the URL for where we l... |
0853ea36-3327-42fd-ab2e-c46c3f428b3e | 2 | public static void setWordWrapInWindow(IWorkbenchWindow window, boolean state) {
if (window == null) {
return;
}
IWorkbenchPage page = window.getActivePage();
// iterate all open editors
IEditorReference[] editors = page.getEditorReferences();
for (IEditorR... |
d4289c7b-fa35-4456-8624-d81958b2da5d | 9 | protected void doStart() {
if ("".equals(fetchFrequencyTf.getText()) || "".equals(repostFrequencyTf.getText()) || "".equals(repostCountTf.getText()) || "".equals(commentCountTf.getText())) {
JOptionPane.showMessageDialog(null, "请输入信息!", "设置", JOptionPane.ERROR_MESSAGE);
return;
}
// 保存设置
try... |
de84fe6b-1433-4c5d-9b43-571af490a9ed | 7 | public static String getInitials(String s, boolean withFirstLetter) {
if (s == null) {
return null;
}
StringBuilder sb = new StringBuilder(s.length());
boolean upperCase = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if ... |
48659f75-2fc8-4f80-b83e-829156352b5a | 8 | public int reverse(int x) {
if (x == 0) {
return x;
}
int val = Math.abs(x);
int retVal = 0;
while (val > 0) {
retVal = retVal * 10 + (val % 10);
val = val / 10;
}
// Checking whether there should be leading zero's?
//Print number with leading zero's
int zeroval = Math.abs(x);
int zeros... |
857f2b35-b490-46d1-9e14-be75d1a0fa75 | 2 | Context(Object... parameters){
int length = parameters.length/2;
Reference[] reference_array = new Reference[length];
for(int i = 0; i < length; i++){
reference_array[i] = new Reference((String)parameters[2*i], (parameters[2*i+1] instanceof Representation)?(Representation)parameters[2*i+1]:new Representation(p... |
3d474c16-1947-4a41-9a57-3d8f6c791869 | 0 | @Test
public void testAddRedMarker() {
System.out.println("addRedMarker");
Cell instance = new Cell(0,0);
instance.addRedMarker(0);
instance.addRedMarker(1);
instance.addRedMarker(2);
instance.addRedMarker(3);
instance.addRedMarker(4);
instance.addRedM... |
9429349b-dfde-463b-8751-da4dfd702ae6 | 2 | private static int task2() {
int sum = 0;
int temp = 1;
int temp2 = 1;
int tempTotal = 0;
for (int i = tempTotal; tempTotal < 4000000; i += tempTotal) {
tempTotal = temp + temp2;
if ((tempTotal % 2) == 0) {
sum += tem... |
423e52f8-738b-440a-9ced-b3f47abf22be | 0 | private void c_OHPage(){
c_OHPane = new JPanel();
c_OHPane.setBackground(SystemColor.activeCaption);
c_OHPane.setLayout(null);
JLabel lbl_OpeningHour = new JLabel("Opening Hour");
lbl_OpeningHour.setHorizontalAlignment(SwingConstants.CENTER);
lbl_OpeningHour.setFont(new Font("Arial", Font.BOLD, 30));
l... |
96c65e06-cb2d-4767-bc22-b8c0180db6ae | 7 | public void action(Echeancier e, Etage etage, int date) {
System.out.println("Début action");
//La cabine change d'étage
this.setEtage(etage);
this.setDistanceParcourue(this.getDistanceParcourue() + 1);
if (this.etage.getNumero() == ascenseur.getNumEtageLePlusHaut() || this.e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.