method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b9e98814-6bf8-4aa5-9665-062ad401e1da | 1 | private String getTagValue(Document message, String tag_name) {
NodeList nodes = message.getElementsByTagName(tag_name);
if (nodes.getLength() == 0) return "";
return nodes.item(0).getFirstChild().getNodeValue().trim();
} |
f527b6be-87a8-46a5-8771-f6901915a047 | 9 | public static Stella_Object expandMacro(Cons tree) {
{ Symbol macroname = ((Symbol)(tree.value));
MethodSlot expanderobject = Symbol.lookupMacro(macroname);
java.lang.reflect.Method expandercode = expanderobject.functionCode;
Cons args = tree.rest;
Stella_Object expansion = null;
if (... |
951d55e2-41f7-41f1-a3a6-26bb0d4b0554 | 0 | public String getName() {
return Name;
} |
209a2c02-c700-40c1-8d64-19c7fb4f02a3 | 6 | static boolean _equals_(final Pointer<?> pointer, final Object object) {
if (object == pointer) return true;
if (!(object instanceof Pointer<?>)) return false;
final Pointer<?> data = (Pointer<?>)object;
return Objects.equals(pointer.data(), data.data());
} |
7b7a31a2-99cc-48f7-99b0-0143b828ddb8 | 8 | @Override
public String handleIt(Map<String, String[]> params, HttpSession session, HttpServletRequest request, HttpServletResponse response)
throws IOException {
NewsDAO dao = (NewsDAO) NewsDAOFactory.getTheDAO();
UserBean user = (UserBean)session.getAttribute("user");
int mutableNewsId = Integer.parseInt(((Strin... |
0158b0f7-837f-4cce-8a63-a48e9129ad2c | 3 | public boolean IsInWorldMap2(int coordX, int coordY) {
for (int i = 0; i < worldmap2[0].length; i++) {
if (worldmap2[0][i] == coordX && worldmap2[1][i] == coordY) {
return true;
}
}
return false;
} |
5615b2cb-7f84-4376-9437-fa04027b4d2a | 9 | private int evalStateSide(State s, String side) {
int score = 0;
if(side != "red" && side !="blue")
return -1;
String opp = (side == "red")?"blue":"red";
MyList Pawns = s.ownees(side);
for(Object pawn : Pawns){
int thisScore = secureScore;
for(Object neighbour : ((Hexpos)pawn).neighbours()){
Hexp... |
e9510b18-4cf8-4d8f-9c4d-1b6f1c7f3ffd | 4 | public MethodInfo findMethod(String name, String typeSig) {
if ((status & METHODS) == 0)
loadInfo(METHODS);
for (int i = 0; i < methods.length; i++)
if (methods[i].getName().equals(name)
&& methods[i].getType().equals(typeSig))
return methods[i];
return null;
} |
447ca869-a99a-4e00-8a19-01eed5bf53b9 | 6 | protected int contest(int b, int g, int r) {
/* finds closest neuron (min dist) and updates freq */
/* finds best neuron (min dist-bias) and returns position */
/* for frequently chosen neurons, freq[i] is high and bias[i] is negative */
/* bias[i] = gamma*((1/netsize)-f... |
01eafa61-a818-4a25-ad41-ab893451e3d8 | 7 | private void generateCallArgArray(Node node, Node argChild, boolean directCall)
{
int argCount = 0;
for (Node child = argChild; child != null; child = child.getNext()) {
++argCount;
}
// load array object to set arguments
if (argCount == 1 && itsOneArgArray >= 0) ... |
7e920ab0-88ed-4273-acec-378ae4f87101 | 8 | public static List listLogicCommands() {
{ List commands = List.newList();
{ MethodSlot function = null;
Iterator iter000 = Module.allFunctions(Stella.getStellaModule("/LOGIC", true), true);
Cons collect000 = null;
while (iter000.nextP()) {
function = ((MethodSlot)(iter000.... |
733eceaf-a8ce-42f5-87ce-4ff99506abdc | 6 | public List<String> generateParenthesis(int n) {
final char OPEN_P = '(';
final char CLOSE_P = ')';
List<String> ret = new ArrayList<String>();
int len = n * 2;
char[] seq = new char[len];
int openPLeft = n - 1;
int openPUnpair = 1;
int offset = 1;
seq[0] = OPEN_P;
while (offset > 0) {
while (op... |
634fdf1f-ff68-48b4-8d58-66bbdc7577f3 | 1 | public static synchronized DownloadManager getInstance() {
if (instance == null) {
instance = new DownloadManager();
}
return instance;
} |
8996099a-7470-4153-ba84-be718e3f5b4d | 7 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if(cmd.getName().equalsIgnoreCase("heal")){
if(!(sender instanceof Player)){
sender.sendMessage("This is a player command.");
}
if(sender instanceof Player){
if(sender.hasPermission("ArcadeEss.heal")){
if(ar... |
779a2397-98e5-4b69-aa3b-62771bd073e2 | 7 | public static void startupHierarchy() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if ... |
fef0b639-0304-42b5-a611-8980513a836c | 2 | private static void realizarVenta( Tienda tienda)
{
boolean salir;
Integer idCliente, idMusica, stock;
do
{
try
{
System.out.print( "Introduce el Id del cliente comprador: ");
idCliente = Integer.parseInt( scanner.nextLine());
System.out.print( "Introduce el Id del producto a vender... |
aea14d4b-1384-4a15-b022-1583f879cf40 | 4 | public boolean cancelReservation(String val){
for(int i=0;i<wSeats.length;i++) {
if(wSeats[i].equals(val)){
wSeats[i]="NA";
return true;
}
}
for(int i=0;i<aSeats.length;i++) {
if(aSeats[i].equals(val)){
aSeats[i]="NA";
return true;
}
}
return... |
6711da99-7081-4436-b781-79b181ddef52 | 7 | void popAll(PathConsumer2D io) {
if (DO_STATS) {
// update used marks:
if (numCurves > curveTypesUseMark) {
curveTypesUseMark = numCurves;
}
if (end > curvesUseMark) {
curvesUseMark = end;
... |
cb4da754-1213-46ed-8cfe-da82ec552f80 | 4 | public boolean getControls(String control){
if(control == "Xfact"){return true;}
if(control == "Mirror"){ return true;}
if(control == "Mat"){ return true;}
if(control == "InMode"){return true;}
return false;} |
76cbda09-16e1-4d6a-8137-a17fcffce604 | 0 | public void setjTextFieldVille(JTextField jTextFieldVille) {
this.jTextFieldVille = jTextFieldVille;
} |
6a3c7160-e314-4179-874f-d4906849a7b0 | 2 | @Override
public void startPlayCard() {
if(presenter.isPlayersTurn()&&presenter.getClientModel().getServerModel().getPlayers().get(presenter.getPlayerInfo().getIndex()).getOldDevCards().getTotalDevCardCount()>0){
DevCards d=presenter.getClientModel().getServerModel().getPlayers().get(presenter.getPlayerInfo().get... |
29954a07-c0f5-478e-88f8-3a42b93e6018 | 6 | public void sort(List<Integer> list) {
if (list.size() < 2)
return;
int count = 0;
for (int idx = 1; idx < list.size(); ++idx) {
int current = list.get(idx);
int expectedIdx = idx;
// searching in the sorted part
for (int sortedIdx = ... |
96530bcc-10a4-470d-a1d1-0c4bb8920478 | 7 | private boolean isOneGroupInOneClassroom(Group group, int lectureNumber, LinkedHashMap<String, LinkedHashMap> dayTimeTable) {
boolean oneLectureInOneRoom = true;
if (group != null) {
ClassRoom groupsRoom = group.getClassRoom();
String classRoomNumber = groupsRoom.getRoomNumber();... |
b90ed2ca-2140-4664-afac-ee801a2d09ac | 4 | public void printFlattenTree(List<String[]> l, String filename){
OutputStream fis = null;
BufferedWriter br = null;
try {
fis = new FileOutputStream(filename);
br = new BufferedWriter(new OutputStreamWriter(fis, Charset.forName("UTF-8")));
for(String[] taxon: l){
br.write(taxon[0]... |
2d21ca92-6f5b-46b2-9ebe-a860ce11fc5e | 9 | @Override
public List<Ability> matchedAffects(final MOB invoker, final Physical P, final long flag, final int abilityCode, final int domain)
{
final Vector<Ability> V=new Vector<Ability>(1);
if(P!=null)
{
P.eachEffect(new EachApplicable<Ability>()
{
@Override
public void apply(Ability A)
{
... |
92cef079-a41c-46dc-8433-086891adc983 | 0 | @Override
public void mouseReleased(MouseEvent e) {
} |
23edb911-cff8-4b5f-b062-1e98ddd2d84b | 4 | public void setBaconNumbers(String toName) {
this.baconNumber = 0;
Queue<ActorGraphNode> q = new LinkedList<>();
q.add(this);
ActorGraphNode current;
while (!q.isEmpty()) {
current = q.poll();
for (ActorGraphNode neighbor : current.linkedActors) {
if (neighbor.baconNumber == -1) {// not visited
... |
5be143e5-1a25-4547-a3ea-a91c25708f1f | 9 | static public byte[] decode(String b64Str)
{
// not yet tested
StringBuffer sb = new StringBuffer();
int len = b64Str.length();
while ((len > 0) && (b64Str.charAt(len - 1) == Base64Pad)) { len--; }
/* output buffer length */
// XX==, XXX=, XXXX, XXXXXX==
... |
3b09141a-a718-4c42-8762-8ec63b714c8c | 3 | public int getOverheadBytes() {
if (parent == null) return 0;
double ourShare = 1.0;
int ourDataLen = getData().length;
int pageDataLen = parent.getDataSize();
if (pageDataLen != ourDataLen) {
// We don't have a page to ourselves, so we can't come up
// ... |
85ad19d6-e5a5-4f7e-8c69-20816edc92fb | 9 | public void parseScene(String sceneFileName) throws IOException, RayTracerException
{
FileReader fr = new FileReader(sceneFileName);
BufferedReader r = new BufferedReader(fr);
String line = null;
int lineNum = 0;
System.out.println("Started parsing scene file " + sceneFileName);
while ((line = r.readLi... |
c9cd9c23-7a2e-4bfb-9e33-e805dc772533 | 1 | public void poistaTiedote(int tiedoteID) throws DAOPoikkeus {
// Avataan ensin tietokantayhteys
Connection yhteys = avaaYhteys();
try {
// Suoritetaan haku
String sql = "DELETE from Tiedotteet WHERE tiedoteID=?";
// Alustetaan sql-lause
PreparedStatement lause = yhteys.prepareStatement(sql);
// Tä... |
59ef738e-3f97-408b-810c-8cac1f3d69db | 7 | public void validacion( String apellidoPaterno, String nombres, String email ) throws BusinessException
{
String mensaje = "";
if (apellidoPaterno==null || apellidoPaterno.isEmpty())
mensaje += "\nEl apellido paterno no puede ser vacio o nulo";
if (nombres==null || nombres.isEm... |
ed17f787-18c1-4b76-9b43-068c6b40baec | 8 | private static void dealWithException(Exception e) {
if (e instanceof SAXParseException) {
SAXParseException ee = (SAXParseException) e;
System.out.println("\n** Parsing error" + ", line " + ee.getLineNumber() + ", uri " + ee.getSystemId());
System.out.println(" " + ee.getMessage());
Exception x = (ee.g... |
f0a47109-671c-4184-bd59-5d28bf6e6673 | 1 | public void printResult() {
log.info("共有" + this.goalMap.size() + "筆時間花費紀錄");
for (Calculator cal : this.goalMap.values()) {
log.info(cal.getName() + ":" + cal.getAllThroughTime() + " msecs");
}
} |
ffdf4910-ca96-44fd-96ab-6406ff2fa298 | 6 | public BinaryPacket getBinaryCommandHeader() throws Exception {
if(baos.size()<24) return null;
byte input[] = baos.toByteArray();
byte headerData[] = new byte[24];
System.arraycopy(input, 0, headerData, 0, 24);
RequestHeader header = RequestHeader.parse(headerData);
//saftey check
if(header.getKeyLe... |
27c60f53-5fc0-46c7-b6d8-cc785146723a | 8 | private Mesh loadMesh(String fileName) {
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
if (!ext.equals("obj")) {
System.err.println("Error: File format not supported for mesh data: " + ext);
new Exception().printStackTrace()... |
54997e83-b152-4e80-b609-0a81c6585334 | 9 | @Override
public void load() {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(new File(path));
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("TRA... |
5575c969-65b6-4a52-a155-fd12b3bbf8dd | 4 | private static void maybePrintDeviceDetails (
int indent,
DeviceDescriptor info
) throws IOException
{
indent += 8;
// FIXME: use external config data; XML format
if (info.getDeviceClass () == Descriptor.CLASS_HUB)
printHubDetails (indent, info.getDevice ());
else if (isPtp (info.getDevice ().getC... |
f4b1af07-9c97-4f7d-abda-664e72746a81 | 4 | public static void main(String[] args) {
PlayerHand player = new PlayerHand();
Deck deck = new Deck();
BlackJackGame game = new BlackJackGame(deck, player);
while (!game.isOver()) {
game.doTurn();
}
game.display();
if (game.isDraw()) {
System.out.println("DRAW");
} else if (game.didPlayerW... |
296515c3-63c2-476f-894e-6687f51de656 | 4 | public void removeResultFromEvent(String eventIdentifier, String resultIdentifier)
{
for(Event e: events){
if(e.getIdentifier().equals(eventIdentifier))
{
//We check if the result is actually there
for(Result r: e.getResults()){
if(r.getIdenti... |
5bfe471d-186e-4022-9058-5eb4586ed164 | 1 | public Class[] getParameterClasses() throws ClassNotFoundException {
Class[] paramClasses = new Class[parameterTypes.length];
for (int i = paramClasses.length; --i >= 0;)
paramClasses[i] = parameterTypes[i].getTypeClass();
return paramClasses;
} |
2adcbdb5-5099-4b35-9f60-1897d9e9015f | 0 | @Before("execution(* com.laudandjolynn.springtest.springtechmanual.aop.IHello.hhhh())")
public void before(JoinPoint joinPoint) throws Throwable {
log.debug("method starts... 呵呵!");
} |
1333795c-aacb-4baf-b55c-a580ef01c09f | 8 | protected void drawVertical(Graphics2D g2, Rectangle2D area) {
Rectangle2D titleArea = (Rectangle2D) area.clone();
g2.setFont(this.font);
g2.setPaint(this.paint);
TextBlockAnchor anchor = null;
float y = 0.0f;
VerticalAlignment verticalAlignment = getVerticalAlignment();
... |
93cbbaaa-e488-4484-8ce4-34dfdc003777 | 6 | private static final int getElementalAmp(final int job) {
switch (job) {
case 211:
case 212:
return 2110001;
case 221:
case 222:
return 2210001;
case 1211:
case 1212:
return 12110001;
... |
3f8d6f62-9a5b-4fee-9f76-359bddcbeeb9 | 7 | public static void updateLearning(int action){
try { // Try to read values from the file
BufferedReader reader = new BufferedReader(new FileReader("learn.txt"));
String line = null;
line = reader.readLine();
int planetsL = Integer.valueOf(line);
line = reader.readLine();
int shipsL = Integer.valueO... |
03416ce3-2414-4137-beeb-44193e67f03b | 1 | private void generateCandidatePositions() {
Polygon p = new Polygon(new LinearRing(path.getExteriorRing().getCoordinateSequence(), path.getFactory()), new LinearRing[0], path.getFactory());
Geometry inset = p.buffer(-3);
if(inset.isEmpty()){
inset = path;
}
Point interiorPoint = inset
.getInteriorPoint... |
c3bbb646-b4c2-4341-a68a-657e7b02018f | 8 | private void handleGoCommand(String command){
System.out.println("=======================================================================");
//switch om te kijken of het noord oost zuid of west is
switch(command){
case "north":// Kijk of er in het noorden een deur is
if (myRooms[myPlayer.getCurrentro... |
ad2ab9f3-82f2-44e3-9199-2a5f58367178 | 7 | private final boolean cons(int i) {
switch (b[i]) {
case 'a': case 'e': case 'i': case 'o': case 'u':
return false;
case 'y':
return (i==k0) ? true : !cons(i-1);
default:
return true;
}
} |
fb592b68-793b-476f-8a6e-4989a0cc68fa | 4 | public boolean loadAll() {
boolean test = false;
if (test || m_test) {
System.out.println("Loader :: loadAll() BEGIN");
}
loadGrid();
loadPlayer1();
loadPlayer2();
loadTimer();
if (test || m_test) {
System.out.prin... |
f7c6b675-ef7c-48c6-b4ef-2ffe105fbb58 | 4 | public static ArrayList<String> tokenizeEmail(File tempFile)
{
ArrayList<String> allWords = new ArrayList<String>();
try
{
Scanner ab = new Scanner(tempFile);
while (ab.hasNext())
{
String tempLine = ab.nextLine();
String[] tempWords = tempLine.split("\\[|\\]|\\(|\\)|!|'|,| |-|\\.|;|\"|\\... |
55c2dfc0-f97d-40be-aa5d-e68359a924df | 1 | public Knooppunt getLeegKnooppunt() {
int maxRij = this.speelveld.length;
int maxKol = this.speelveld[0].length;
int rangeRij = maxRij - 1;
int rangeKol = maxKol - 1;
int rij = (int) (Math.random() * rangeRij);
int kol = (int) (Math.random() * rangeKol);
Knooppun... |
b9f3c6af-cf30-4cd3-8542-a0764baf9d12 | 2 | private static void login(BufferedReader br, ServiceInterface obj,
Scanner cs) throws IOException{
// TODO Auto-generated method stub
/*
String str[] = new String[2];
for (int i = 0; i < 2; i++) {
str[i] = br.readLine();
}
String[] userIds=rb.getStringArray("userIds");
String[] passwords=rb.getS... |
5a72bbba-8d02-4148-a49b-2ec318089e14 | 3 | private void childrens_atom( List<QuadTree> results, QuadTree node, int[] finalTypes )
{
if ( node == null ) return;
if ( node.children == null )
{
results.add( node );
return;
}
for ( int type : finalTypes )
{
childrens_atom( results, node.children[type], finalTypes );
}
} |
3f72fa0b-b5cb-43d3-a325-b9194827ca48 | 3 | public static String readString(DataInputStream var0, int var1) throws IOException {
short var2 = var0.readShort();
if(var2 > var1) {
throw new IOException("Received string length longer than maximum allowed (" + var2 + " > " + var1 + ")");
} else if(var2 < 0) {
throw new IOException... |
f5bc3857-d248-486f-9f1e-daa458bdbf14 | 5 | @Override
public boolean verify(JComponent input) {
Matcher matcherIdCod = patternIdCod.matcher(textFieldIdCod.getText());
Matcher matcherTel = patternTel.matcher(textFieldTel.getText());
if (input instanceof JTextField) {
JTextField tf = (JTextField) input;... |
e53ed291-3351-4635-b40d-6bfcc27f0f98 | 9 | private void setFileDescription(FileTreeNode tn)
{
String fullpath = (String)tn.getUserObject();
selectedPath = fullpath;
if (tn.isFile)
{
String[] sizeexts = {"kB", "MB", "GB"}; int e = 0;
int filesize = archive.fileSize(fullpath);
int sizeround ... |
28ac3e0f-4fb1-4c9e-829d-3bb0412e7654 | 5 | private String doPost(String api, String body) {
String query = "apikey=" + apiKey;
String answer = null;
URLConnection client = null;
;
statusCode = 0;
lastAnswer = null;
try {
client = new URL(infoConnectAPIRoot + api + "?" + query).openConnection();
System.out.println("Request: POST " + client.ge... |
75a75b0b-3ffd-4ea1-b35f-be553e4235b7 | 8 | public static synchronized void setCodec(String extension,
Class<?> iCodecClass) throws SoundSystemException {
if (extension == null)
throw new SoundSystemException("Parameter 'extension' null in "
+ "method 'setCodec'.", SoundSystemException.NULL_PARAMETER);
if (iCodecClass == null)
throw new SoundSy... |
4c4aae1f-95a7-4705-b4d6-73ed37745f3b | 6 | public MarkInvoiceAsPaidResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "invoiceID") ) {... |
b795d6ac-442f-4a9d-9c2e-08bb5ea0d1a0 | 7 | public boolean onColumnRail() {
// if the column is railway
if (col == 0 || col == 4) {
if (row != 0 && row != 11) {
return true;
}
else {
return false;
}
}
else if (col == 2 && (row == 5 || row == 6)) {
return true;
... |
e5a2238c-c326-44cc-81c2-e25a19859d5d | 9 | public void run(ImageProcessor ip) {
/**ip.invert();
imp.updateAndDraw();
IJ.wait(500);
ip.invert();
imp.updateAndDraw();*/
long initTime=System.currentTimeMillis();
final GenericDialog gd = new GenericDialog("Create image");
gd.addNumericField(... |
f96351be-ead9-481f-bab4-ce225ff585ba | 2 | public Object trapFieldRead(String name) {
Class jc = getJavaClass();
try {
return jc.getField(name).get(null);
}
catch (NoSuchFieldException e) {
throw new RuntimeException(e.toString());
}
catch (IllegalAccessException e) {
throw new ... |
d8f273ac-9bb3-4814-92ca-743d2466c364 | 7 | private void readBinaryPatchContent(SinglePatch patch) throws PatchException, IOException {
List<Hunk> hunks = new ArrayList<Hunk>();
Hunk hunk = new Hunk();
for (;;) {
String line = readPatchLine();
if (line == null || line.startsWith("Index:") || line.length() == 0) {
... |
b9256ad5-cd2b-43ca-b1e3-acf03ebf42f8 | 3 | public void testConstructorEx8_TypeArray_intArray() throws Throwable {
int[] values = new int[] {1, 1, 1};
DateTimeFieldType[] types = new DateTimeFieldType[] {
DateTimeFieldType.era(), DateTimeFieldType.year(), DateTimeFieldType.year() };
try {
new Partial(types, values)... |
66f7bed8-3c56-440e-9a1d-19d3beaa9105 | 1 | public static int doUpdate(String cmd) throws DALException
{
try { return stm.executeUpdate(cmd); }
catch (SQLException e) { throw new DALException(e); }
} |
a42ae297-cc8b-466f-b990-e0e9b6f26ac5 | 4 | public TiledMap(MapVersion version, MapOrientation orientation,
int width, int height, int tilewidth, int tileheight,
Map<String, String> properties,
Map<Integer, TilesetRef> tilesets,
List<Layer> layers) {
if (width < 0 || height < 0) throw new IllegalArgumentException(
"width and height have to be ... |
d610f381-80bf-43d9-b1fd-a07af01cdff0 | 9 | synchronized public void changeLocBypass(int newLocX, int newLocY) {
int oldLocX = intLocX;
int oldLocY = intLocY;
Game.removeDuskObject(this);
intLocX = newLocX;
intLocY = newLocY;
try {
if (isPlayer()) {
updateMap();
if (Game.overMerchant(oldLocX,oldLocY) != null)
offMerchant();
if (Ga... |
ab058fcd-ea4f-4076-be3f-848b70565416 | 3 | protected Box recursiveGetBoxAt(Box root, int x, int y)
{
if (root.getBounds().contains(x, y))
{
for (int i = 0; i < root.getChildCount(); i++)
{
Box ret = recursiveGetBoxAt(root.getChildBox(i), x, y);
if (ret != null)
retur... |
4bcd1ea3-686d-49c7-b2ae-2856d559caa0 | 9 | public static int getFrequency(){
Bukkit.getLogger().info("<Minetrends> Authenticating with Minetrends...");
URL url = null;
HttpURLConnection conn = null;
int responseInt = 0;
String urlParameters = "key=" + Minetrends.publicKey;
try {
url = new URL(Minetrends.hostname + "/api/getfrequency");
... |
4422211f-335b-427b-ac87-0fa3fae9f69a | 8 | public boolean isIdentity() {
return (m00 == 1 && m01 == 0 && m02 == 0)
&& (m10 == 0 && m11 == 1 && m12 == 0)
&& (m20 == 0 && m21 == 0 && m22 == 1);
} |
e907815b-39d6-48e0-8add-bf88435b333f | 9 | private void updateTabs()
{
if(terrain == null)
{
return;
}
int width = terrain.getHeightMap(0).cols();
int height = terrain.getHeightMap(0).rows();
// plot heightmap
try
{
int level = 0;
int width2 = terrain.getHeightMap(level).cols();
int height2 = terrain.getHeightMap(level).rows();
... |
ce98c3da-3461-4910-bedc-1634dcfefb83 | 5 | public static ArrayList<Edge> getEdges(ArrayList<Node> nodes, SQLiteConnection db) {
ArrayList<Edge> edges = new ArrayList<>();
try{
SQLiteStatement st = db.prepare("SELECT * FROM edge");
while(st.step()){
Node a = null;
Node b = null;
... |
7d857bd1-210e-4e93-ae77-9ec8cb49bd68 | 8 | @SuppressWarnings({"unchecked"})
public static void main(String[] args) throws IOException {
if (args.length < 1) {
System.out.println("You should pass file with input data");
System.exit(1);
}
int numberOfExperiments = 1;
if (args.length == 2) {
n... |
13793948-b618-4e98-bbfd-d60731f161ec | 3 | public void generateLabyrinth(long seed) {
Random random = new Random(seed);
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[0].length; j++) {
int n = random.nextInt(100);
if (n < 25) {
grid[i][j].setWalkable(false);
... |
2b256a62-c588-4077-983f-8dc9277a0410 | 5 | private void drawJulia (Display d, double re, double im)
{
int max = 10;
int max_iter = 50;
Complex t = new Complex(0,0);
int X = Reestr.WIDTH/2;
int Y = Reestr.HEIGHT/2;
Color current;
for (int y = -Y; y < Y; ++y)
{
for (int x = -X; x < X; ++x)
{
Complex z = new Complex (x*0.005,y*0.005);
... |
c291c68c-1266-40d4-8c7e-26cdcafaac27 | 9 | private CollectionView getBean(NodeList nodelist) {
CollectionView bean = new CollectionView();
for (int counter = 0; counter < nodelist.getLength(); counter++) {
Node parentNode = nodelist.item(counter);
NodeList children = parentNode.getChildNodes();
Node node = children.item(0);
if (node == null)
... |
64da652d-808c-4878-acb3-894a8fe5b977 | 2 | public float getHigh() {
float highVal = Float.MAX_VALUE;
try {
highVal = Float.parseFloat(high.getText());
if (highVal == highVal)
return highVal;
} catch (Exception e) {
}
return highVal;
} |
f251c83a-9698-4dab-aab7-9e9f61e0644b | 3 | public void removeFirstQuestion(String target) throws Exception {
LinkedList<AbstractQuestion> playersActiveQuestions = getQuestions(target);
if (playersActiveQuestions.size() == 0) {
removeAllQuestions(target.toLowerCase());
throw new Exception("There are no pending questions");
}
if (playersActiveQuesti... |
e8b3da12-cf83-471a-9688-9e2c98c1eeac | 5 | public static ArrayList<Item> getItemList() throws SlickException{
QueryExecutor qe = new QueryExecutor();
ArrayList<ArrayList<String>> items;
ArrayList<Item> rtrItems = new ArrayList<Item>();
for (int i = 0; i <= 30; i++) {
rtrItems.add(null);
}
String query = "SELECT i.itemID,typeID,Name,icon,value,def... |
b3efaa19-1aae-45aa-bee0-6fb3a1e56a0a | 2 | public Item dequeue() {
if (isEmpty())
throw new java.util.NoSuchElementException();
else if (size() == 1) {
Item item = first.item;
first = null;
last = null;
size--;
return item;
}
Item item = first.item;
f... |
2a3dcfc6-618d-4260-adf5-4886e46e2ec8 | 9 | private static void verifyAFile(String filepath) throws Exception
{
HashMap<String, String> animalToCageMap = getAnimalToCageMap();
HashMap<String, Holder> metaMap = parseMetadataFile();
BufferedReader reader = new BufferedReader(new FileReader(new File(filepath)));
reader.readLine();
for(String s =... |
f42977ba-b7b5-4faf-9124-fb64f43be57c | 2 | public static void cambiarNombre() {
Nombre nombre = new Nombre();
name = (String) JOptionPane
.showInputDialog(frame, "Que nombre quieres");
if (name != null && !name.equals("")) {
frame.setTitle("Usuario: " + name);
nombre.setNombre(name);
Conexion.enviarObjeto(nombre);
}
} |
e66b9e2b-c66c-4670-b416-d475f7d9b038 | 0 | public void setMultipleObjects(ArrayList objects) {
this.myObjects = objects;
} |
c1990326-6eaa-4a6d-975e-804d34c11321 | 3 | public static void sendMessage(Message m, String url)
{
try {
IMessageReceivedHandler stub = (IMessageReceivedHandler) java.rmi.Naming.lookup("rmi://"+registry+":1099/"+url);
stub.onMessageReceived(m);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStack... |
f1eea339-fe15-4a57-a01c-23cad4326ac4 | 9 | public final void writeDocList(String name, DocList ids, Set<String> fields)
throws IOException {
boolean includeScore = false;
if (fields != null) {
includeScore = fields.contains("score");
if (fields.size() == 0 || (fields.size() == 1 && includeScore)
|| fields.contains("*")) {
fields = null; ... |
0d45a037-7cc7-4eff-a378-d26205d0ecc9 | 3 | protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) {
super();
if (pattern == null) {
throw new IllegalArgumentException("The pattern must not be null");
}
mPattern = pattern;
mTimeZoneForced = (timeZone != null);
if (timeZone =... |
8ecbe27d-52c9-4e44-a897-0db8bd94bbf7 | 8 | public static String trimNonNumeric(String src/*boolean allowNegative,boolean allowDecimal*/) {
if(src==null) {
return ""; // cuz I'm a nice guy
}
if(src.isEmpty()) {
return src;
}
if(src.length()==1) {
return src.matches("\\d")?src:"";
}
if(!src.matches("[-]{0,1}\\d+\\.{0,1}\\d+.*")) {
// TOD... |
11c50e74-43eb-4270-827b-87c33bfc12f0 | 3 | public int dispatchWithArgs(Object... args) {
clearArgs();
for (Object arg : args) {
Class<?> argclass = arg.getClass();
// System.out.println("argclass=" + argclass);
if (!pushPrimitiveArg(argclass, arg)) {
// in this usage everything that is not a pr... |
cd13082e-1810-4517-931b-c9608030569f | 6 | public void submit2()
{
//Declaring variables
int num = 0;
int index = 0;
boolean won = false;
Team temp;
Exception wl = new Exception();
//Check if valid team number is entered
try
{
//Pull number from label, throwing exception if... |
803b7b9e-3973-4aa3-a68b-e0bf4ff28d60 | 9 | @Override
public void execute() {
final SceneObject gate = SceneEntities.getNearest(Constants.BURTHOPE_GATE);
if (Settings.noob){
if (gate!= null && gate.isOnScreen() && Constants.BURTHOPE_GATE_AREA.contains(Players.getLocal())) {
gate.interact("Open");
Task.sleep(250, 350);
} else if (gate!= null && !g... |
8482e1e0-e41b-4aeb-be3a-d2c41a693970 | 4 | @Override
public void processExit(String exitValue, Vertex vertex) {
super.processExit(exitValue, vertex);
if (exitValue.equals("true")) {
//FIXME vyhod chybovu hlasku
if (leader != null) {
Dialog.showError("Leader had been already choosed.");
... |
2f8e014d-f283-46e3-8a6a-7b507d87af7b | 1 | public static void main(String[] args) throws IOException {
if (!new File("./logs/").exists()) {
new File("./logs/").mkdir();
}
ActiveUserExtractor extractor = new ActiveUserExtractor("./Status/",
new File("activeUser.txt"), 200000000);
extractor.start();
} |
36d58e56-5ddf-45af-966b-b11faa97dae8 | 2 | public boolean beforeVersion(int major, int minor) {
return (majorVersion < major ||
(majorVersion == major && minorVersion < minor));
} |
82bc596d-1a7d-482d-aae5-228aab5d1e63 | 3 | public int creatorLoop(Scanner console, HashSet<Horde> entities) throws FileNotFoundException {
// Let the user know that they're in the creation menu now, and launch a Scanner so they can navigate.
System.out.println("Entered Creator. \n Choose an action: \n 1 - Initialize an enemy type from the archives. \n 2 - ... |
d050c16d-afb6-42a4-95ff-e505ecbc3571 | 5 | public void clickRight() {
if ( (grid.hasFailed() == false) && (isRevealed() == false) ) {
if (isFlagged()) {
imageView.setImage(Images.Type.SQUARE.getImage());
if (isMine()) { grid.mineUnflagged(); }
}
else {
imageView.setImage... |
49cb04a0-d10c-46ee-8b6f-51bb6d8ec2db | 4 | private boolean profile(String baseDir, String jobName, String jobDir, String jobId) {
File jobFile = new File(baseDir + jobName + File.separator + jobDir + File.separator + jobId + ".out");
try {
FileInputStream fis = new FileInputStream(jobFile);
ObjectInputStream ois = new ObjectInputStream(fis);
job... |
6bdf71e4-0ad9-43e8-a6ab-3aa7c6e594ab | 3 | public Buchi recognizeEmptyLanguage() {
System.out.print("Checking for empty language...\r");
HashSet<Transition> tr = (HashSet<Transition>) transitionRelation.clone();
HashSet<Integer> ac = (HashSet<Integer>) acceptanceCondition.clone();
Integer numberOfStates = states.size();
FiniteTreesTable ftt = new Fin... |
fd10c4a6-96ae-42bd-8401-0bf3685a9a44 | 6 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof LabelValue)) {
return false;
}
LabelValue bean = (LabelValue) obj;
int nil = (this.getValue() == null) ? 1 : 0;
nil += (bean.getValue() == null) ? ... |
abe61a89-9139-425e-be0b-e9ccb27fc4b3 | 5 | @AfterGroups("Insertion")
@Test(groups = "Two-Three Tree")
public void test23TreeSearch() throws KeyNotFoundException {
Integer count;
Reporter.log("[ ** 2-3 Tree Search ** ]\n");
try {
timeKeeper = System.currentTimeMillis();
for (Integer i = 0; i < seed; i++) {
b23Tree.search(i);
}
Reporter... |
db05ebab-4178-4832-aada-1c54b2478eca | 5 | public int findFirstOccurrence(int [] arrA, int x,int start, int end ){
if(end>=start){
int mid = (start+end)/2;
if((mid==0||(arrA[mid-1]<x)) && arrA[mid]==x){
return mid;
}else if(arrA[mid]<x){
return findFirstOccurrence(arrA, x, mid+1, end);
}else{
return findFirstOccurrence(arrA, x, star... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.