method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ae155bb5-8ac2-4328-9e82-ccd0ad3ab67e | 2 | private static Statistic generateStatistic(int duration, int rightCount, int mistakeCount) {
DateTime start = new DateTime();
Date startTime = start.toDate();
Date finishTime = start.plusSeconds(duration).toDate();
Statistic statistic = new StatisticImpl();
statistic.setStartTim... |
159c2d14-e735-459f-9759-22558953ede0 | 1 | @Test
public void hahmonPutoaminenPysahtyyEsteeseenAlkeellisesti() {
int hahmonKoordinaattiAlussa = pe.getY();
t.lisaaEste(e);
for (int i = 0; i < 200; i++) {
pe.eksistoi();
}
assertTrue("Hahmo ei pysähtynyt esteesen vaan jatkoi y = "
+ pe.getY(),... |
c39bfdc3-43c1-42f3-b1e0-ab5f56f08d9b | 8 | public ArrayList<Integer> getRow(int rowIndex) {
ArrayList<Integer> res = new ArrayList<Integer>();
if (rowIndex < 0)
return res;
int[] pre = new int[rowIndex + 1];
int[] cur = new int[rowIndex + 1];
for (int i = 0; i <= rowIndex; i++) {
if (i == 0) {
cur[0] = 1;
... |
5bc199f9-a598-4762-a692-9c014f7b104d | 6 | public static Direction getDir(int i) {
switch (i) {
case 0:
return TOP_LEFT;
case 1:
return TOP;
case 2:
return TOP_RIGHT;
case 3:
return BOT_RIGHT;
case 4:
return BOT;
... |
fc4cea23-40bc-4d35-a255-6a0f2a230231 | 5 | private static void drawOcean(Graphics graphics, Ocean ocean) {
if (ocean != null) {
int width = ocean.width();
int height = ocean.height();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int contents = ocean.cellContents(x, y);
if (contents == Oc... |
45b3f2f3-5ee4-4324-9395-fae03bdf58fb | 8 | @Override
public int read() throws IOException {
synchronized (this) {
if(streamClosed){
throw new IOException();
}
}
//test if the available input has reached its end
//and the EOS should be returned
if((str != null && pos == str.length())){
str =null;
return java.io.StreamTokenizer.TT_E... |
cbd5c057-383d-44ca-8248-a2c33a8dce51 | 7 | public void sampling () {
int z = 0;
int N = 0;
int wordId = 0;
float probZ [] = new float [K];
double probZ_ = 0.0;
double probSum = 0.0;
Random random = new Random ();
//Iter
for (int it=0;it<iter;++it) {
System.out.println ... |
56c8c74d-dd63-4c43-b07c-5c448401cf26 | 4 | private static int countSpace(String s){
int t=0;
for(int i=0; i < s.length(); i++) {
if(s.charAt(i) == ' ') {
t++;
if ((i>0)&&(s.charAt(i-1)==' ')){
t--;
}//count result from "asd asdsd asdasd" must be 2
... |
3faf634c-5dca-4015-ac11-4c420612cfae | 0 | @Before
public void setUp() throws Exception {
view = new MainWindowView();
view.addPropertyChangeListener(this);
controller.addView(view);
propertyChangeSupport.addPropertyChangeListener(controller);
} |
4e4e7c97-c36c-470f-a712-13831abe9c69 | 4 | public void mouseMoved(MouseEvent e) {
if( e.getX() >= 5 && e.getX() <= 45 && e.getY() >= 5 && e.getY() <= 45){
this.returnBtnFlag = true ;
}else{
this.returnBtnFlag = false ;
}
} |
9b58954f-72c1-4db7-a4a1-4c51b619c917 | 9 | public static TextBuffer jmpWrapper(Statement stat, int indent, boolean semicolon, BytecodeMappingTracer tracer) {
TextBuffer buf = stat.toJava(indent, tracer);
List<StatEdge> lstSuccs = stat.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL);
if (lstSuccs.size() == 1) {
StatEdge edge = lstSuccs.get(0)... |
2ce1514b-6119-49bb-a036-37c26a33db47 | 4 | public void replaceWithLargerNeighbor()
{
// TODO: Replace all but the first and last elements with the larger of its to neighbors
if (list.size() == 0)
{
}
else
{
for (int i = 1; i < list.size()-1; i++)
{
String current = list.get(i);
String prev = list.g... |
48bc8899-0ec3-4fad-ae5c-1a5492b54ffc | 9 | private void loadLine() throws InputExeption {
try {
// 現在位置を初期化
position = 0;
lineNo += 1;
// 行バッファをクリアする
lineBuff.setLength(0);
// 繰り返し処理
while (!closed) {
// 次の文字を取得
final int c0 = reader.read();
// 文字のコード値が-1であるかどうか判定
if (c0 == -1) {
// 文字のコード値が−1ならストリームの終了
// ストリームを... |
19817a81-baad-458d-a976-01565ab93f3d | 1 | public void testToLocalDateTime_nullLocalTime() {
LocalDate base = new LocalDate(2005, 6, 9, COPTIC_PARIS); // PARIS irrelevant
try {
base.toLocalDateTime((LocalTime) null);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
33cfb38f-ef89-40ce-be78-e33aebc4557f | 2 | public ModelHandler()
{
Models = new HashMap<String, Model>();
Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_room_models");
try
{
ResultSet Results = Grizzly.GrabDatabase().GrabTable();
while (Results.next())
{
Models.put(Results.getString("id"), new Model(Results));
}
}
... |
eb6b7e9e-47dc-43a6-a02e-1188977aaba7 | 5 | private InputStream getCorrectInputStream() throws IOException {
// if in cached mode use the tmp file
if (isCached) {
if (tempFile != null) {
// initiate a new input stream in needed
if (fileInputStream == null) {
fileInputStream = new Fil... |
0d8948d8-8004-44d0-9164-1e0092609ebf | 5 | public static void main(final String[] args) throws LWJGLException,
IOException
{
System.setProperty("org.lwjgl.util.Debug", "true");
Display.setDisplayMode(new DisplayMode(800, 600));
Display.setResizable(true);
Display.create();
final Shader vertexShader = Shader
.buildShader(
"C:\\Users\\Ad... |
a13143ed-e9fc-4af3-b5d8-ffe8b1b60b3f | 4 | private boolean read () {
String reply = null;
if (socket != null) {
try {
/* Await reply */
reply = b.readLine();
} catch (IOException ignored) {}
}
if (reply == null)
return false;
return ((reply.equals("OK")) ? true : false);
} |
38d3ed09-5f30-414b-a946-562d927524c6 | 1 | private static boolean clearBuilder(StringBuilder builder, List<Token> tokens,
File sourceDir, String sourceFile, int lineNumber)
throws TokenizeError {
if(builder.length() > 0) {
tokens.add(createToken(builder.toString(), sourceDir, sourceFile, lineNu... |
24cfb7f9-2386-4f9d-a2d4-1673b8d590b0 | 1 | static private void addBadColor(Integer a, Integer b,TreeMap<Integer, TreeSet<Integer> > noeuds)
{
TreeSet<Integer> tmp = noeuds.get(a);
if(tmp == null)
{
tmp = new TreeSet<Integer>();
}
tmp.add(b);
noeuds.put(a, tmp);
} |
e31f7dac-292c-43d3-a708-52e089115cce | 0 | public void setDateFrom(Date dateFrom) {
this.dateFrom = dateFrom;
} |
3453f72b-50fe-4b8e-b918-cfdea4cc6146 | 8 | public static void checkNearRideable(Player p) {
RideThaMob.player.add(p.getName());
List<Entity> l = new ArrayList<Entity>();
for (int i = 1; i < (RideThaMob.pl.getConfig().getInt(
"entity_check_radius") + 1); i++) {
l = p.getNearbyEntities(i, i, i);
if (!l.isEmpty()) {
for (Entity e : l) {
if... |
ec0631b1-710c-4c4a-b0df-b0929567479d | 6 | public int[] getArray(BufferedImage image, int x, int y) {
int[] n; // store the pixel values of position(x, y) and its neighbors
int h = image.getHeight();
int w = image.getWidth();
int xmin, xmax, ymin, ymax; // the limits of the part of the image on
// which the filter operate on
xmin = x - size /... |
70485f80-a69a-487a-8898-ae03ecda2823 | 1 | public static final void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCases = in.nextInt();
while (testCases > 0) {
maxChoc(in.nextInt());
testCases--;
}
} |
43542b64-60c2-49be-ad97-896b8c61bc29 | 0 | public Object next() {
Ball ball = ballContainer.getBallAt(index);
index++;
return ball;
} |
d6b424d3-9f6c-4bd3-bbe2-fed629fda81a | 9 | public static int strSearchKMP(String subS, String longS){
int[] next = new int[subS.length()];
for (int i = 0;i<subS.length();i++){
String t = subS.substring(0,i+1);
next[i]=t.length();
int j = t.length()-1;
while(j>0){
String prefix =t.substring(0, j);
String suffix = t.substring(t.length() - ... |
085eff70-762f-4678-a429-3c757edf7ef6 | 5 | final int[][] method1274(int i, int j) {
if (j != 6) {
return null;
}
int ai[][] = super.aClass112_3320.method1036(j ^ 0xffffff9c, i);
if (super.aClass112_3320.aBoolean1822) {
int k = Class117.anInt1861 / anInt4074;
int l = Class142_Sub27_Sub11.anInt48... |
cc72a969-05da-4b44-976a-92e213ced15d | 4 | public long getDateLength() {
if (this.getPayloadLenExtendedContinued() > 0){
return this.getPayloadLenExtendedContinued();
}
if (this.getPayloadLenExtended() > 0){
return this.getPayloadLenExtended();
}
if (this.getPayloadLen() == HAS_EXTEND_DATA || this.getPayloadLen() == HAS_EXTEND_DATA_CONTINUE){... |
34c9d7ae-b084-4dc6-8dca-3dfb2513d963 | 1 | private boolean validatePath(ExchangeTestbed.Case CASE, String path, boolean isLocal) {
String result;
if (isLocal) {
result = ExchangeTestbed.expectedLocalPath(CASE);
} else {
result = ExchangeTestbed.expectedRemotePath(CASE);
}
return path.compareTo(resu... |
1e46ec00-4a0c-453f-9cd5-033dc2f652d1 | 7 | public int compareTo(Object o) {
int result;
int major;
int minor;
int revision;
int [] maj = new int [1];
int [] min = new int [1];
int [] rev = new int [1];
// do we have a string?
if (o instanceof String) {
parseVersion((Str... |
ef5c9340-2f76-43a5-b48a-ff658b046e84 | 8 | public HashSet<Integer> getUsed() {
Config data = Server_Loader.data;
String tries = data.getString(id + "#BadTries");
String solved = data.getString(id + "#Solved");
HashSet<Integer> used = new HashSet();
if(tries != null && !tries.equals("")) {
String[] args = tries... |
c5672257-40a8-4c28-af4b-8f8eddc3cdd5 | 9 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
int ID_Membre_Courant = Integer.parseInt(request.getParameter(ParametresServlet.ID_Membre_Courant));
int NumExpPro_Courante = Integer.parseInt(request.getParameter("NumExpPro_Courante"));
Stri... |
470a785d-72bf-4c71-a434-e209f4d9573c | 2 | public void SelectEndState(){
Random Rand = new Random();
int StateIndex = Rand.nextInt(getNumStates());
Iterator<GameState> i = AllStates.iterator();
int n = 0;
while(i.hasNext()){
i.next();
if(n == StateIndex){
// state is chosen
} else { //state was not chosen, and is removed.
i.remove();... |
350c0909-b306-452f-bf97-f37deaef5ebe | 1 | public void populate_with_dummy(){
try{
Connection connection = DriverManager.getConnection(connectionString);
Statement s = connection.createStatement();
s.executeUpdate("CREATE TABLE ingredient(id integer primary key, name text)");
s.executeUpdate("CREATE TABLE parent(idIngredient integer, idParent inte... |
a2a071a8-2329-49ff-8ba6-78a0aeb2f3ad | 1 | public int tLineCount(){
int tline = condition.tLineCount() + truePart.tLineCount() + 2;
if(falsePart != null)
tline += falsePart.tLineCount() + 1;
return tline;
} |
d042253e-3d61-47c7-8b09-42bf82e0640e | 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... |
454b5e3e-806d-4362-9e0e-34f321bbf455 | 3 | public static String convertToInt(String s)
{
for(Season se : Season.values())
{
if(se.toString().equals(s))
{
return String.valueOf(se.getSeasonInt());
}
}
//Checks if it is an, if so returns the string
try{
return String.valueOf(Integer.valueOf(s));
}
catch(NumberFormatException e)
{
... |
f9eeab67-9678-466f-a315-944501cb45bc | 4 | public Element getNewElement(Point2D startPt, Point2D endPt) throws NoShapeChosenException {
switch (shapeSelector) {
case 1:
return new Room(startPt, endPt, win.getSelectedMaterial());
case 2:
return new Wall(startPt, endPt, win.getSelectedMaterial());
case 3:
... |
39d3f38c-aeb9-4826-9f85-7b5f72363ca2 | 9 | boolean checkMyType(Object object) {
if (object == null || !(object instanceof MyType[]) || ((MyType[])object).length == 0) return false;
MyType[] myTypes = (MyType[])object;
for (int i = 0; i < myTypes.length; i++) {
if (myTypes[i] == null ||
myTypes[i].firstName == null ||
myTypes[i].firstName.length() =... |
87aab9bc-ef38-4689-938f-6f5ffb0ae0da | 7 | public void advanceTo(String contig, int pos) {
//Advance to wholly new site
//Expand leading edge until the next record is beyond target pos
advanceToContig(contig);
if (pos > contigMap.get(contig)) {
throw new IllegalArgumentException("Contig " + contig + " has only " + contigMap.get(contig) + " base... |
0ef1e3da-671d-4d11-8553-818f02a2b076 | 7 | private void menuDeleteBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDeleteBoxActionPerformed
PokemonBox box = (PokemonBox)listBoxes.getSelectedValue();
int option = JOptionPane.showConfirmDialog(this, "Are you sure you want " +
" to delete " + box.getName() +... |
d07917bc-9546-46f1-b90f-5d93715a232b | 2 | @Override
public boolean canAttack(Board board, Field currentField, Field occupiedField) {
return this.validSetupForAttack(currentField, occupiedField) && inSameRankOrFile(currentField, occupiedField) && board.clearPathBetween(currentField, occupiedField);
} |
c40803f9-53a5-477d-bf8a-f214c02e5cd0 | 6 | @Override
public boolean onCommand(CommandSender sender, Command bukkitCommand, String label, String[] arguments) {
if (arguments.length == 0) {
displayUnknownCommand(sender, label);
return true;
}
AbstractCommand<P> command = commands.get(arguments[0].toLowerCase());
if (command == null) {
displayUnk... |
ce3f7a1d-c537-4375-8749-e3a2c3025281 | 9 | public void displayReflection(int img[][]) {
for (int i = 0; i < img.length; i++) {
for (int j = 0; j < img[i].length; j++) {
//---- Top ---//
if (i == 0) {
int a = i+2;
if(a>9) a=9;
System.out.format("%3d... |
36e95961-6f36-4c57-bd93-20ac12bdd564 | 2 | private void reset() {
for (FileRequest request : waiting.values()) {
requests.offer(request);
}
waiting.clear();
try {
socket.close();
} catch (IOException ioex) {
ioex.printStackTrace();
}
socket = null;
input = null;
output = null;
current = null;
lastUpdate = 0;
} |
4aafbf3b-567e-4ccf-893d-87b2227ae8e3 | 4 | public static void main(String args[]) {
JobTestClient jobClient = new JobTestClient();
try {
jobClient.run();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
MetaDataNodeForHtt... |
4f9d299d-d13e-4d87-8947-47ca54b38d3f | 1 | public void giveAP(double amount) {
for (int c = 0; c < active_actors.size(); c++) {
Actor a = active_actors.get(c);
a.giveAP(amount);
}
} |
73a2db11-260f-4cef-8b37-86019a3aae56 | 6 | @Override
protected void update(float delta) {
if (mInput.action() && !start) {
mCodeoutput.setText(mCode.getCode());
start = true;
updateOutput();
Timer.schedule(task, 1f, 1f);
}
if ((mCode.isFinished() || mRemainingTime <= 0) && !mDoneHandle... |
22746d6f-b230-4e96-9bfe-87b0153d2d2e | 2 | public void generateTable(int precision){
sin = new double[precision];
cos = new double[precision];
tan = new double[precision];
for(int i = 0; i < precision; i++){
double theta = (((double)i) / ((double)precision)) * tau;
sin[i] = Math.sin(theta);
c... |
1df57f6d-837b-449c-82f2-8bbace6b191b | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Bairro other = (Bairro) obj;
if (!Objects.equals(this.idBairro, other.idBairro)) {
return fal... |
3e7ef933-39cf-4cb5-81e9-6fc81a6d573d | 1 | public static void main(String... args) throws InterruptedException {
final CountDownLatch countDownLatch = new CountDownLatch(1000);
ExecutorService service = Executors.newFixedThreadPool(5);
for (int i__ = 0; i__ < 1000; i__++) {
Callable<Void> task = new Callable<Void>() {
... |
85cc055e-0050-498d-91a8-aa7651d5d3b1 | 6 | public void setValue(ELContext context, Object base, Object property, Object value) {
if ((base == null) || (property == null)) {
return;
}
context.setPropertyResolved(true);
FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class);
ELContext el... |
ecfa69cd-7369-4be8-bc16-f4854b688fef | 6 | public void getNextPosition() {
if (left) {
dx -= moveSpeed;
if (dx < -maxSpeed) {
dx = -maxSpeed;
}
} else if (right) {
dx += moveSpeed;
if (dx > maxSpeed) {
dx = maxSpeed;
}
}
if (falling && !isFlightEnabled) {
dy += fallSpeed;
}
} |
8c0c5bc6-fcf0-409b-8deb-779fe77c16ad | 9 | @SuppressWarnings("static-access")
private void manejarRequest() throws UnknownHostException, IOException {
PaqueteDHCP data = new PaqueteDHCP();
String TempIP = new String();
byte[] unicast = null;
// Ingresamos valores al data para hacer el DHCPACK
OpcionDHCP opServ = pack.existInOption(54);
if (opServ... |
ead4e28c-fead-4ba0-98c7-dabe84183097 | 1 | public static BigInteger K(byte[] s, byte[] w) {
BigInteger base = BigInteger.valueOf(s.length);
BigInteger sum = BigInteger.ZERO;
for (int i = 0; i < w.length; i++) {
BigInteger value = BigInteger.valueOf(ConCh.indexOf(s, w[i]));
sum = sum.add(value.multiply(bas... |
d48c9526-2054-4cc9-b42e-950d31a35e3b | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... |
9ac2a07b-bac3-4ccc-ad24-548f5f4fa8b3 | 6 | public static String multiply(String first, String second) {
int l1 = first.length();
int l2 = second.length();
// Base Condition 1
if (l1 == 0 || l2 == 0) {
return "";
}
// Base Condition 2
if (l1 == 1 && l2 == 1) {
int result = atoi(fir... |
8588fc89-f635-4499-aa29-0010ce8b6a0e | 3 | @Override
public void Update(int delta, Input input) {
mx = input.getMouseX();
my = input.getMouseY();
if (input.isKeyPressed(Input.KEY_NUMPAD0)) {
renderGround = !renderGround;
}
if (input.isKeyPressed(Input.KEY_NUMPAD1)) {
renderObjects = !renderObjects;
}
if (input.isKeyPressed(Input.KEY_NUMPAD... |
a5b75132-892c-4e44-97a5-6815f1a58458 | 3 | private void rotateLeft(Entry<K,V> p) {
Entry<K,V> r = p.right;
p.right = r.left;
if (r.left != null)
r.left.parent = p;
r.parent = p.parent;
if (p.parent == null)
root = r;
else if (p.parent.left == p)
p.parent.left = r;
else
... |
bda2c00b-542d-477a-8a99-87a15b02077f | 4 | public static List<ConnectedPair> list(String fileName) {
assert fileName != null;
List<ConnectedPair> pairs = new ArrayList<ConnectedPair>();
File file = new File(fileName);
try {
FileReader fileReader = new FileReader(file);
BufferedReader reader = new Buf... |
1ef986b3-1e50-44bf-ba89-00cc09936034 | 9 | public static String install(String forgeUrl, boolean isServer)
throws IOException, ClassNotFoundException, NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
String forgeFileName = UrlUtils.fileName(forgeUrl);
String forgeVersionId = null;
if (!isServer) {
forgeVersionId = Minec... |
d2a6c469-7bba-412b-b82e-4021bff58547 | 3 | @Override
public void handleMouse(int posX, int posY, int flag) {
if (!enabled) return;
this.flag = flag;
if (flag == 2 && clickEvent != null) clickEvent.trigger();
} |
f3230fed-ae27-4fc7-a206-d58c520ac843 | 9 | @Override
public void apply(Object targetEntity, Object value) {
try {
if (value instanceof String && f.getType().isEnum()) {
value = QueryBuilder.enumValueOf(f.getType(), (String)value);
}
if (value instanceof BigDecimal && (f.getType().equals(Integer.class) || f.getType().equals(Integer.TYPE))) {
... |
e228f49c-8465-4db9-b1f7-023788ff4852 | 0 | public static void main(String[] args) throws IOException, ParseException {
BibleContentTw bc = new BibleContentTw();
// bc.makeTextbook();
String str = bc.getSqlStatement();
bc.createSQL(str);
// System.out.println(str);
} |
04126d7a-55f1-412e-9ce5-08cd189522b2 | 1 | public boolean is2byte() {
char c = currentChar();
return c == 'D' || c == 'J';
} |
9b9a4a51-aad0-4973-b7c3-dc91f539e86a | 5 | private void init(List<FileItem> inputItems) {
Map<String, List<String>> map = new HashMap<String, List<String>>();
for (FileItem item : inputItems) {
if (item.isFormField()) {
List<String> currentValues = map.get(item.getFieldName());
if (currentValues == null) {
currentValues = new ArrayList<Stri... |
f19e9fe5-c5ba-4df0-8b9f-c370b2454681 | 5 | public void dumpTweets() throws IOException {
BufferedWriter fileWriter = new BufferedWriter(new FileWriter(IndexConfig.statLoc + File.separator + "tweets.txt"));
for( Long rootId : roots ) {
Stack<Pair<Long,Integer>> s = new Stack<Pair<Long,Integer>>();
s.add(new Pair<Long, ... |
b9e488df-cf3b-4ab3-82ee-1f85bc0c34d4 | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (!(obj instanceof Bigram))
{
return false;
}
Bigram other = (Bigram) obj;
... |
f4b32d12-b137-4043-88a1-9d24c3858f6e | 6 | private String createCompareRecordsMethod( String variable ) {
StringBuilder sb = new StringBuilder();
sb.append( "\n\n" + TAB + "public static void compareRecords( " + variable + " " + toJavaCase( variable )
+ ", " + variable + " readRecord ) {\n\n" );
for ( Column column : ta... |
57255e01-b27a-4009-b6ed-47907994c5e4 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
Outliner.documents.addOutlinerDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
Outliner.documents.addTreeSelectionListener(this);
setEnabled(false);
} |
99178039-48c8-4ed7-8bc0-1871f565da2e | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (messagesQueue.size() == 0)
{
messageDelay.stop();
activeDelay = 1;
}
else
{
String channel = addHash(messagesQueue.get(0).split(" ", 2)[0]);
if (!acebotCore.getChannel(c... |
aa1bb36f-e2d1-49a2-a35c-665e36c05e1e | 7 | public boolean enchantItem(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = this.tableInventory.getStackInSlot(0);
if (this.enchantLevels[par2] > 0 && var3 != null && (par1EntityPlayer.experienceLevel >= this.enchantLevels[par2] || par1EntityPlayer.capabilities.isCreativeMode))
{... |
659e02db-e989-4f40-91fb-27d35dcdd138 | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbSecSessionByStartIdxKey ) {
GenKbSecSessionByStartIdxKey rhs = (GenKbSecSessionByStartIdxKey)obj;
if( getRequiredSecUserId() < rhs.getRequiredSecUserId() ) {
return( -1 );
}
else if( getRequired... |
a91eba4a-e4d6-4f65-9fe5-84f6d3925d6e | 9 | final void imc_addkey(PACKET p, String key, String value)
{
for(int i = 0; i < value.length(); i++)
{
if(value.substring(i, i+1).equals("\""))
{
String tmp = value.substring(0, i);
tmp = tmp.concat("\\\"").concat(value.substring(i+1, value.length()));
value = tmp;
i++;
}
}
for (int i... |
80c88d06-67b2-4e17-9e35-d6b538206d76 | 8 | public static void main(String[] args) {
String datamodel = args[0];
String testfile = args[1];
String predictionsOutput = args[2];
DataModel model = null;
try {
model = new FileDataModel(new File(datamodel));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
re... |
af4daa94-06df-46f7-af13-18b24265b332 | 3 | public Device hasDevice(String type) {
Device targetDevice = deviceFactory(type, 0);
for (Device device : deviceList) {
if(device.equals(targetDevice) && device.getAmount()>0) return device;
}
return null;
} |
d4c01fad-c0ee-4ff6-80df-aebe4eb6f3c9 | 7 | static void crossValidationRandomForest(String inputFileNameX, String inputFileNameY) {
ArrayList<Sample> allSamples = Parser.parse(inputFileNameX, inputFileNameY);
System.out.println("Random Forest");
int[] numTrees = {80,100};
double[] numSubSampleRatios = {0.8, 0.85};
double[] numFeaturesRatios = {0.2, 0.3... |
4e6b6565-71c3-45c6-b810-3221c017cc3d | 8 | public static DefaultListModel RefreshList (DefaultListModel listobjects){
listobjects.removeAllElements();
// Generate state of buttons.
if (Globals.ListTypeControl == 0) { // CUSTOMER
for (int i = 0 ;i < Globals.ATA.CustomerArray.length; i++){
listobjects.addElement(
"ID: " + ... |
7bc25e91-655a-44bb-9228-e169e593f1e1 | 8 | @Override
public void keyReleased(KeyEvent ke) {
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
keyState[KeyCode.UP.ordinal()] = false;
break;
case KeyEvent.VK_DOWN:
keyState[KeyCode.DOWN.ordinal()] = false;
break;
case KeyEvent.VK_LEFT:
keyState[KeyCode.LEFT.ordinal()] = false;
b... |
f6b4cda3-297c-4f45-bce8-b260f3ee9bb0 | 0 | public int getY() {
return this.y;
} |
8016f949-dca3-4a55-a2b4-a5bad0a9e303 | 3 | @Override
public boolean hasNext() {
if (reader == null) return false;// No input stream?
if (!seqReady) {
seqReady = readSeq(); // Try reading a sequence.
// End of file or any problem? => Close file
if (seqReady == false) close();
}
return seqReady;
} |
453d71c3-d972-4cff-b50f-16d77306cb51 | 9 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int s =... |
fb673f4d-ce26-4307-a13b-e47d964d2f88 | 3 | public void dispose() {
if (namesAndValues != null) {
namesAndValues.clear();
namesAndValues.trimToSize();
}
if (kidsReferences != null) {
kidsReferences.clear();
kidsReferences.trimToSize();
}
if (kidsNodes != null) {
k... |
a96c100f-1c53-4075-a891-9b840b7c8ef3 | 2 | private String getXmlStringFromUrl(String urlStr) throws Exception {
URL url = new URL(urlStr);
BufferedReader reader = null;
StringBuffer xmlStr = new StringBuffer();
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
String temp = null;
... |
e839fdb6-666b-49a3-a7c4-0dd8fe7459c5 | 4 | @Override
public void run() {
String CurLine = ""; // Line read from standard in
String[] line = null;
String args = null;
String cmd = null;
System.out.println("Neuronales Netz gestartet... Es sind folgende Kommandos aktiv:");
printCommandList(); // Geladene Kommandos ausgeben
InputStreamReader conv... |
5e1f901e-b0e2-4002-9d89-a86fce7859e4 | 6 | @EventHandler
public void CaveSpiderNightVision(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.getCaveSpiderConfig().getDouble("Ca... |
41603ce5-bcb9-4186-bd13-0a5c696736df | 4 | public Socket connectSocket(Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params)
throws IOException, UnknownHostException, ConnectTimeoutException
{
int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
int soTimeout = HttpConnectionParams.getSoTimeout(p... |
67a479a0-f682-46e8-a87f-1cb61632a3a6 | 2 | public static AccountsField getFieldFromAbbreviation(String a)
{
for (AccountsField field : AccountsField.values())
{
if (field.toString().equals(a))
{
return field;
}
}
return null;
} |
9b2bf4e5-82a1-4519-a4e4-49f84d9ea54d | 8 | private void parseLine(final String line)
throws IllegalInstructionException {
final String[] lineParts = line.split("[\\s]");
if (lineParts.length > 0) {
try {
this.commandWord =
CommandWord.valueOf(lineParts[0].toUpperCase());
} cat... |
167576c0-1bad-4454-83cd-c142e83b0f2c | 7 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// start DB transaction by opening it
boolean connectSuccess=Helper.openConnection();
// connection successful - proceed
if(connectSuccess)
{
// get the res... |
b2eae5f3-d0e6-44a1-8ee9-333fd4202084 | 1 | public void visitTableSwitchInsn(
final int min,
final int max,
final Label dflt,
final Label[] labels)
{
minSize += 13 + labels.length * 4;
maxSize += 16 + labels.length * 4;
if (mv != null) {
mv.visitTableSwitchInsn(min, max, dflt, labels);
... |
8732a57e-cc13-4958-8027-de9cf8affd52 | 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... |
aaf8126e-07fe-44c4-894d-23fb989e8822 | 6 | public String computeHash(String serverid, byte[] sharedSecret, byte[] serverPublicKey ) {
String resulthash = "";
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA1");
md.update(serverid.getBytes());
md.update(sharedSecret);
md.update(serverPublicKey);
byte[] hash = md.digest()... |
fa252c52-e014-49de-bef5-b4e0f0b2fb77 | 8 | private void loadLocalConfig() throws StagingException {
Map<URI, SharedStagingArea> localAreas = new HashMap<URI, SharedStagingArea>();
this.areas.put(LOCAL_CONFIG_URL, localAreas);
try {
JsonNode rnode;
ObjectMapper om = new ObjectMapper();
rnode = om.readTree(this.localConfig);
if (rnode.has("custo... |
6c16c557-0e37-4012-9dca-6b769a979958 | 8 | public List<DicCat> getCatList()
{
List<DicCat> catList = null;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream("naver_cat_all.txt"), "utf-8"));
String line = null;
DicCat cat = null;
Hashtable<String, DicCat> catMap = new Hashtable<String, DicCat>()... |
0cb8eb62-6219-4120-81dc-26944c5e23d6 | 4 | public String getBICString() {
Iterator<BankAccount> it = accountsList.iterator();
StringBuilder builder = new StringBuilder();
if(it.hasNext()){
String bic = it.next().getBic();
builder.append(bic!=null?bic : "");
}
while(it.hasNext()){
String... |
de17fd09-c444-4e1f-b26f-5352e8760c47 | 9 | private static void writeInput(int input, PrintWriter out) throws IOException {
out.print("|");
out.print((input & Move.RESET) != 0 ? "P" : ".");
out.print("|");
out.print((input & Move.UP) != 0 ? "U" : ".");
out.print((input & Move.DOWN) != 0 ? "D" : ".");
out.print((input & Move.LEFT) != 0 ? "L" : ".");
... |
a296a18d-06f3-4cfc-8d62-fe81137af068 | 4 | public List<BipolarQuestion> getResponseBipolarList(String oppositeFileName, String teamType) {
List<BipolarQuestion> bipolarQuestionList = new ArrayList<BipolarQuestion>();
Element bipolarQuestionE;
BipolarQuestion bipolarQuestion;
BipolarQuestionDao parentBipoarQuestion = new BipolarQuestionDao(oppositeFil... |
a2d84c74-1afe-41c9-ac60-8962bf0c606c | 8 | public static long readHello(DataInputStream in, boolean writableExpected) throws IOException
{
long helloMagic1 = in.readLong();
if(helloMagic1 != 0x4E42444D41474943L) // NBDMAGIC
throw new RuntimeException(String.format("not NBDMAGIC: 0x%x", helloMagic1));
long helloMagic2 = in.readLong();
if(helloMagic... |
fdf0364d-23cc-4399-bb6a-33a1df4a3613 | 2 | private void initComponents()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 575, 260);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu jMenuFile = new JMenu("File");
menuBar.add(jMenuFile);
JMenuItem jMenuItemClear = new JMenuItem("Clear");
jMenuFile.add... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.