method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e3bf6339-7e7e-423a-8956-71ccb25fe8bb | 4 | private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
if (this.currentState == LauncherState.WAIT_LOGIN
&& !txtUsername.getText().trim().isEmpty()
&& !new String(txtPassword.getPassword()).trim().isEmpty()) {
b... |
fe2e9698-c80a-4a75-8185-5d516a2a8e48 | 6 | private void showHelp(Player play, String page) {
String pLang = PlayerCache.getLang(play.getName());
if(!StringToNumber.isPositiveNumber(page)) {
play.sendMessage(_modText.getJobHelp("nohelp", pLang).addVariables("", play.getName(), page));
return;
}
Int... |
5a013bd8-f930-451f-b334-1733d0337935 | 9 | protected boolean prereqs(MOB mob, boolean quiet)
{
if(mob.isInCombat()&&(mob.rangeToTarget()>0))
{
if(!quiet)
mob.tell(L("You are too far away to perform a deep cut!"));
return false;
}
final Item w=mob.fetchWieldedItem();
if((w==null)||(!(w instanceof Weapon)))
{
if(!quiet)
mob.tell(L("Yo... |
072da033-7402-4874-bf81-6ec443b4252d | 5 | public IntegerOperator getIntegerOperator(String string) {
char[] chars = string.toCharArray();
for(char c : chars) {
if(c == '+') return IntegerOperator.ADD;
else if(c == '-') return IntegerOperator.SUBTRACT;
else if(c == '*') return IntegerOperator.MULTIPLY;
... |
2d9ee6b5-3c08-4b3e-989d-1610ea4ce4a2 | 2 | public void popularCB() {
ArrayList<String> Departamentos = new ArrayList<>();
DepartamentoBO depBO = new DepartamentoBO();
try {
Departamentos = depBO.CMBDepartamento(this.usuarioLogado.getDepartamento().getCodigo());
} catch (SQLException ex) {
JOptionPane.show... |
e83157eb-896e-4896-9387-606fa550e2a1 | 9 | private static String createMessage(final File[] args, final GlobalOptions gopt) {
File temp = null;
BufferedReader reader = null;
try {
temp = createTempFile(args, gopt.getTempDir());
// we now have a temp file with the appropriate text in it. Just
// get the... |
4fdb979c-a5d5-4651-8610-54dac17166d5 | 6 | private static void addKmersToGenes(List<GeneHolder> geneHolderList) throws Exception
{
HashMap<String, FastaSequence> fastaMap = FastaSequence.getFirstTokenSequenceMap(
ConfigReader.getBioLockJDir() + File.separator + "resistantAnnotation" +
File.separator +"refGenome" + File.separator
+ "klebsiel... |
0e1c32ea-2c8c-4711-8fb1-a73ea02969bb | 6 | public void actionPerformed(ActionEvent e)
{
String act = e.getActionCommand();
if (act.equals("ROTATE"))
{
Integer integer = IntegerDialog.getInteger(Resources.getString("TransformMenu.ROTATION"),0,360,0,60);
if (integer != null) applyAction(new Rotate(integer));
return;
}
if (act.equalsIgnoreCa... |
880ec3da-ea12-4c36-81f9-0ba51c1bd72c | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Vec3 other = (Vec3) obj;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) return false;
if (Double.doubleToLongBits(y) != Double.doub... |
418e01ba-464a-4e75-af41-aa5b564a1dc5 | 7 | public synchronized void playSound(String name) {
if (volume == 0) { return; }
int i = 0;
// Search for a unused sound.
while (true) {
String n = name + "#" + i++;
if (sounds.containsKey(n)) {
if (sounds.get(n).isRunning()) {
continue;
} else {
// Found one!
Clip c = sounds.get(n);
... |
fc1caaaf-d654-40db-b5a8-606747ac8774 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Math other = (Math) obj;
if (apply == null) {
if (other.apply != null)
return false;
} else if (!apply.equals(other.apply))
return fa... |
8b0a9b8c-faf8-42f0-a2b3-2de371c5ab2b | 0 | public AlgorithmIdentifierType getKeyDerivationFunc() {
return keyDerivationFunc;
} |
cd021b20-a567-42f0-95cf-4b5c2ccc50c1 | 0 | public String getStartVariable() {
return myStartVariable;
} |
5e92ef42-57b8-467d-8149-1437ff7c32f1 | 1 | private static String getFileContents(String filename)
throws IOException, FileNotFoundException
{
File file = new File(filename);
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = ... |
bb035f8c-5e93-403b-87f4-6f6927b88105 | 6 | protected Log newInstance(String name) throws LogConfigurationException {
Log instance = null;
try {
if (logConstructor == null) {
instance = discoverLogImplementation(name);
}
else {
Object params[] = { name };
instanc... |
5000b1c3-7e3c-4f9e-9077-50a008833ed0 | 5 | @Override
public String getAuthenticationUrl(String account, String service,
String redirectUrl, Map<String, String> authExtra) {
Map<String, String> qparams = new LinkedHashMap<String, String>();
qparams.put("client_id", clientId);
qparams.put("redirect_uri", redirectUrl);
qparams.put("service",... |
ce9c6d2a-582c-40d3-a8c1-ddecd736ea86 | 2 | public static void getPortals( ServerInfo s ) {
ArrayList<Portal> list = portals.get( s );
if ( list == null ) {
return;
}
for ( Portal p : portals.get( s ) ) {
sendPortal( p );
}
} |
493820fc-0055-4683-a1ed-c0642b695cc7 | 1 | @Override
public void run() {
System.out.println(Thread.currentThread().getName()+" Start. Command = "+command);
try {
processCommand();
} catch (IOException ex) {
Logger.getLogger(WorkerThread.class.getName()).log(Level.SEVERE, null, ex);
}
System.out... |
b2a8b45d-1123-41a2-9c12-87dbef95ef1d | 1 | public static void initializeBoundaries() {
Boundaries[] theBoundaries = Boundaries.values();
theBoxes = new BoundaryBox[theBoundaries.length];
for (int i = 0; i < theBoundaries.length; i++) {
theBoxes[i] = theBoundaries[i].getBox();
}
} |
1ec70847-2c23-40e4-8def-a64a4c7261a9 | 5 | private boolean touchRobotRotate() {
boolean toca = false;
for (SimulatorRobot robot : Board.robots) {
if (robot != this) {
ArrayList<Line2D.Double> linies = this.getBoundLinesToRotate();
ArrayList<Line2D.Double> liniest2 = robot.getBoundLines();
... |
bec0156d-4922-459b-a6d9-e87320f73206 | 0 | public void updateInGame(Graphics g){
this.drawHealthBar(g);
} |
9a8317c8-c6c3-48c1-b33e-0fcecb967c8b | 3 | @SuppressWarnings("unchecked")
public static void main(String[] args)
throws Exception
{
float heapSizeMegs = (float)(Runtime.getRuntime().maxMemory() / 1024L / 1024L);
if (heapSizeMegs > 511.0F)
LauncherFrame.main(args);
else
try {
String pathToJar = CCLauncherClient.class.getPro... |
13bf29c2-be1c-4f76-af9f-40ca330c0031 | 1 | public AuthorCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("AuthorCommand has a null CommandParameter");
this.par= par;
} |
011c8b3d-53d2-4aef-83eb-482efc642f43 | 7 | public void loadDictionary(Reader stream){
BufferedReader br = new BufferedReader(stream);
HashMap<String, WordClass> str2class = new HashMap<String, WordGrouper.WordClass>();
str2class.put("L", WordClass.PrefixSmallWord);
str2class.put("R", WordClass.PostfixSmallWord);
str2class.put("S", WordClass.SmallWord)... |
5a467adf-cf27-49a9-a81a-7fdf39298a30 | 3 | public void setAttribute(String nazwa, String wartosc)
{
DataRow parametry = new DataRow();
parametry.setTableName(nazwa);
parametry.addAttribute("name", wartosc);
for(AbstractAttribute atrybut : attributes)
{
if(atrybut.getType().equals(nazwa))
{
... |
ee779744-7389-44e1-b365-53454b67a557 | 4 | public List<Customer> validate(String email, String password) {
List <Customer> outputData = new ArrayList<Customer>();
try
{
// Query DB, add results to output list
ResultSet res = DAO.validate(email, password);
if(null != res)
{
while (res.next()) {
Integer zip = res.getInt("zip");
Str... |
4828078d-2e12-4896-9ada-53c5071a2d6c | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Log other = (Log) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return f... |
0efba407-954b-4129-92a5-438a5ed97da5 | 6 | public boolean willSplit() {
int grade=0;
for(int i=0;i<s.length()-1;i++) {
if(s.charAt(i)==')') {
grade--;
}
else if(s.charAt(i)=='(') {
grade++;
}
else if(grade==0) {
for(char c:split) {
... |
da4b97ef-a78a-46ed-82d8-da5194603552 | 0 | @Test
public void testStartSeleniumServer() throws Exception
{
Common Common1 = new Common();
// Common1.BaseFn();
} |
0f4f264d-39a6-4d50-8dfb-883f7dbf01fa | 3 | @Override
public int hashCode() {
int result = description != null ? description.hashCode() : 0;
result = 31 * result + (attenders != null ? attenders.hashCode() : 0);
result = 31 * result + (date != null ? date.hashCode() : 0);
return result;
} |
fc9a3892-9df3-4f76-a279-fc2b1ada2558 | 8 | public static void main(String[] args) {
int numberOfGifts;
double totalCostOfGifts;
// flag to check if any result is found in first iteration else increase range.
boolean isResultFound = false;
ZapposGetAPIData zapposGetAPIData = new ZapposGetAPIData();
ZapposModifyInputData zapposModifyInputData = new Z... |
b401b781-4ed2-445c-afd0-70998516ecd7 | 3 | private void editTeamButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editTeamButtonActionPerformed
// TODO add your handling code here:
try {
//Get the selected team from the list
int selected = teamList.getSelectedIndex();
teamNameReader se... |
0dd056fb-d1d5-48d4-bc3b-d757f3413b91 | 3 | boolean areNeighborsFree (int row, int col)
{
for (int i = 0; i < fNeighbors.length; i++)
{
int dR = fNeighbors[i][0];
int dC = fNeighbors[i][1];
if(isValidCoord (row + dR, col + dC))
{
if(fField[row + dR][col + dC] == VALUE_SHIP)
... |
f0bafe45-5c63-4041-ba31-d3034e67af3c | 0 | public Hashtable getAttributes() {
return attributes;
} |
9feb34f2-7a1d-4641-a93f-472aaec87104 | 4 | public boolean verifySignature(Serializable obj, byte[] signature, PublicKey pubKey) throws SignatureException
{
try
{
//Signature algorithm initialization
RSAsign.initVerify(pubKey);
//Transform the object to be signed to a byte[]
byte[] bytes = toBytes(obj);
//Verify
ByteArrayInputStream ... |
2e045fc5-f2c2-43ce-b28b-2d1b9e307999 | 2 | String encryptOther(String value){
String symbol;
switch(value){
case " ":
symbol = ".";
break;
case ".":
symbol = "#";
break;
default:
symbol = "?";
break;
}
return symbol;
} |
b0feead0-fb04-4fe9-9518-3ce1b6a52a8a | 6 | public String prepareRegex(String formed) {
if(IVPValue.INTEGER_TYPE.equals(valueType)){
if(formed.length() > 1){
return INTEGER[1];
}else{
return INTEGER[0];
}
}else if(IVPValue.DOUBLE_TYPE.equals(valueType)){
if(IVPValue.DOUBLE_TYPE.equals(valueType)){
if(formed.... |
21d136eb-4204-41c7-a8a9-f9adac15698e | 9 | public EditorMenuBar(final BasicGraphEditor editor)
{
final mxGraphComponent graphComponent = editor.getGraphComponent();
final mxGraph graph = graphComponent.getGraph();
mxAnalysisGraph aGraph = new mxAnalysisGraph();
JMenu menu = null;
JMenu submenu = null;
// Creates the file menu
menu = add(new JMe... |
b9897d4f-5073-4110-b617-703d827a161c | 8 | public ConfigurationQueryManager(
ClientDavInterface connection,
ConfigDataModel localConfiguration,
ConfigurationAuthority localAuthority,
Authentication authentication,
final File foreignObjectCacheFile) {
_connection = connection;
_localConfiguration = localConfiguration;
// Die alte ConfigApp ... |
ff1de991-d049-4ae0-9f63-1ac9a542b221 | 3 | public void updateRange()
{
float gold = player.getResource(core.ResourceType.GOLD)/(float)unit.cost.gold;
float wood = player.getResource(core.ResourceType.WOOD)/(float)unit.cost.wood;
float ore = player.getResource(core.ResourceType.ORE)/(float)unit.cost.ore;
float min = castle.getAvailableToRecruit(unit.lev... |
2b35a842-a8cf-4b0d-8d94-a2336561192a | 9 | public void setNetInput() {
float[] input = new float[Network.inputNs];
Spinner closest = getClosest(this);
Spinner closestSame = getClosestOfSameType(this, true);
Spinner closestDifferent = getClosestOfSameType(this, false);
Food closestFood = globalPropertie... |
288374ad-1bdd-412e-9b4f-14473ae2e475 | 4 | public static void main(String[] args) {
if(args.length < 1) {
System.out.println("No args");
}
for(String arg : args) {
try {
Class<?> c = Class.forName("type_information.ex07." + arg);
} catch (ClassNotFoundException cnfe) {
System.out.println("Class " + arg + " not found");
}
}
} |
a3aa485a-f63f-4946-bd79-840cce9cdfdd | 3 | public int countIncludedString(CharSequence charseq, String str){
if(charseq == null || str == null){
System.out.println("�L��Ȓl���͂��Ă�������");
}
String testedStr = charseq.toString();
int count = 0;
while(testedStr.contains(str)){
count++;
int index = testedStr.indexOf(str);
testedStr = t... |
d2bfee43-2d87-4449-a62a-f84636f2b05c | 7 | public static WarcRecord readNextWarcRecord(DataInputStream in) throws IOException {
// LOG.info("Starting read of WARC record");
StringBuffer recordHeader=new StringBuffer();
byte[] recordContent=readNextRecord(in, recordHeader);
if (recordContent==null) {
// LOG.info("WARC content is null - fil... |
f967701b-e6e8-4bf2-84c3-42cb88f1ab2e | 5 | public Wave27(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 900; i++){
if(i % 5 == 0)
add(m.buildMob(MobID.DODRIO));
else if(i % 4 == 0)
add(m.buildMob(MobID.FEAROW));
else if(i % 3 == 0)
add(m.buildMob(MobID.RATICATE));
else if(i % 2 == 0)
add(m.buildMob(MobID.DODUO)... |
5bad6c3f-e7ee-4e1b-81e9-4c631e914a7f | 9 | private void paint(Graphics2D g2, boolean highlightOn) {
//update the shape in java Path2D object if it changed
if (hasChanged) {
x_points = new int[points.size()];
y_points = new int[points.size()];
for (int i = 0; i < points.size(); i++) {
x_points[... |
94047f3c-150c-42ad-b05c-6043ee538768 | 8 | private double factorialsQuotient(final int[] dividends, final int[] divisors) {
ArrayList<Integer> dividendFactors = new ArrayList<>();
ArrayList<Integer> divisorFactors = new ArrayList<>();
for (int n: dividends) {
dividendFactors = mergeWithFactorialFactors(dividendFactors, n);
... |
86943177-1643-4023-92a0-c7c81b9cafac | 4 | public void loadTileImages() {
// keep looking for tile A,B,C, etc. this makes it
// easy to drop new tiles in the images/ directory
tiles = new ArrayList();
alTiles2 = new ArrayList();
alTiles3 = new ArrayList();
alSpecialTiles = new ArrayList();
char ch = 'A';
... |
3b90feef-2356-4e89-aaea-356ab8aea369 | 7 | public static ArrayList<BankAccount> readBankAccounts(String filename)
{
File file = new File(filename);
if (file.exists())
{
ObjectInputStream ois = null;
try
{
//
// Read the previously stored SecretKey.
/... |
6938c155-04f7-45f0-854e-e74b71f7e65f | 2 | public boolean attack(Character c){
this.adjustHealth(0-c.attack);
if(this.isDead()){
this.die();
return false;
}
c.adjustHealth(0-this.attack);
if(c.isDead()){
c.die();
return true;
}
return false;
} |
f1e780c5-7cd4-472f-8fde-02820d796e36 | 8 | public String editOrder() throws MonkeyTalkFailure{
Application app=new ConnectClass().connect();
try{
EntryNewOrderClass order=new EntryNewOrderClass();
order.cfdMarket=cfdMarket;
order.goodUntil=goodUntil;
order.entryNewOrder();
app.label(cfdMarket).tap(new Mods.Builder().thinktime(5000).bui... |
e32d06bc-d3a4-4c5c-9975-06305a9aa2a7 | 5 | private void expandCluster(){
ArrayList<ArrayList<Integer>> queue = new ArrayList<ArrayList<Integer>>();
// add all in gridLabel to the queue
for (ArrayList<Integer> key : gridLabel.keySet()) {
queue.add(key);
}
while ( queue.size() > 0 ) {
ArrayList<Integer> cell = queue.remove(0);
// all nei... |
019c31f7-295a-450e-bb9d-1e893b9ca570 | 2 | public void setCommandButtonFontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.buttonComFontColor = UIFontInits.COMBUTTON.getColor();
} else {
this.buttonComFontColor = fontcolor;
}
somethingChanged();
} |
bad51421-1fac-44ae-a80f-056184d1ddb2 | 1 | public int readInt(String tag){
long l = 0;
if(!data.containsKey(tag)){
System.out.println("The tag "+ tag + " did not exist.");
return 0;
}
l = (Long)data.get(tag);
return (int)l;
} |
517e59ee-5046-445f-b220-589dab2ffc52 | 3 | public boolean recruitAll(Player player)
{
System.out.println("!! AI: RECRUIT ALL");
return recruitAllFromTier(player, 1) ||
recruitAllFromTier(player, 2) ||
recruitAllFromTier(player, 3) ||
recruitAllFromTier(player, 4);
} |
c52a3590-56cf-42f3-bb6b-c73ee859ed8f | 7 | static void dradb4(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index1, float[] wa2, int index2, float[] wa3, int index3){
int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
t0=l1*ido;
t1=0;
t2=ido<<2;
t3=... |
f7a5621f-2ff7-46f9-a296-a9ae1cba1f64 | 8 | public String toSql(boolean first)
{
StringBuffer sb = new StringBuffer("\n");
// Join Type
switch(joinType) {
case JT_NONE : sb.append(first ? " FROM " : ", "); break;
case JT_INNER : sb.append(" inner join "); break;
case JT_LEFT_OUTER : sb.append(" left outer join "); break;
case JT_RIGHT_OUTER ... |
5ace5f03-9ebc-4557-ab63-a03012baae9c | 7 | public String addBinary(String a, String b) {
char[] rst = new char[Math.max(a.length(), b.length()) +1];
for (int i=0; i<rst.length; i++) rst[i] = 0;
for (int i=0; i<a.length(); i++) rst[a.length() - i - 1] += a.charAt(i) - '0';
for (int i=0; i<b.length(); i++) rst[b.length() - i - 1] += b.charA... |
34300930-02c3-4e5c-8441-1e6e2cafdaa7 | 0 | public void setError(double e)
{
sqError = e;
} |
05d3645f-b9d4-44a8-a89d-1d27fa9e6032 | 3 | public static void main(String[] args){
int number = 156870;
//Create a stack holding all the prime factors of the number that
//is passed to the findPrimeFactors method
StackLinkedList<Integer> list = findPrimeFactors(number);
System.out.print("Prime Factors of "+ numbe... |
8366afea-a9bb-437b-b691-1e6fd181212c | 3 | public void recenter(Location loc)
{
originRow = loc.getRow();
originCol = loc.getCol();
repaint();
JViewport vp = getEnclosingViewport();
if (vp != null)
{
if (!isPannableUnbounded()
|| !(vp instanceof PseudoInfiniteViewport))
... |
d957a817-09a7-44a0-9abc-cdd3bf43dff1 | 0 | public static Dimension getDimensionOfSingleCard() {
return singleCardDimension;
} |
5cd739ce-ede2-44be-b3d5-ad2b2efe6452 | 2 | @Override
public void Connect(Server server) {
this.server = server;
try {
if (!new File("ggs.db").exists())
new File("ggs.db").createNewFile();
Class.forName(DRIVER);
connection = DriverManager.getConnection(PATH);
} catch (Exception e) {
e.printStackTrace();
}
} |
ac0768ad-8b8d-4b59-b15b-e62538771b89 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Skillsforusers)) {
return false;
}
Skillsforusers other = (Skillsforusers) object;
if ((this.skillsforusersPK =... |
449f6046-3503-44ef-a565-db8138703adb | 4 | public void add(int w) {
// Neues Element erzeugen
Elem newElement = new Elem(w);
// Wenn die Liste leer ist, das neue Element als Kopf setzen
if (this.kopf == null) {
this.setKopf(newElement);
}
// Wenn der Wert des neuen Element kleiner als der Kopf... |
e5a6e12b-5300-4e08-912b-8c98ba439538 | 4 | public void sortByName()
{
/* iterator1(i): iterate over hpArray starting at index 0 */
for(int i = 0; i < hpCount - 1; i++)
{
int min = i;
/* dont do anything if theres not at least 2 elements in hpArray */
if(hpCount >= 2)
{
... |
21d793aa-5ba4-43ab-b13f-a359f8e3b006 | 1 | public void writeByteArray(byte[] bytes)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeByteArray = \"" + bytes + "\"");
}
write(CFASL_BYTE_VECTOR);
writeInt(bytes.length);
write(bytes);
} |
07665f0a-f05b-4059-91ff-2911858eb0db | 6 | public AuthStatus init(APIKey key, Player player, LoggerHook loggerHook) {
instance = this;
this.key = key;
this.player = player;
this.loggerHook = loggerHook;
try {
URL url = new URL(SERVER_LOCATION + "/api/" + VERSION + "/auth/login.php?key=" + key.getKey() + "&username=" + player.getName()
+ ... |
69b26449-5c78-459d-9160-9ca2e07716aa | 3 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In create game handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try { // check user login cookie and if valid get params
//String unvalidatedCookie = ex... |
29aa021d-6f46-4556-b56e-9464db45b85b | 6 | private static int applyLengthScore(String passwd)
{
if (passwd.length() < 5) // length 4 or less
{
log.debug("3 points for length (" + passwd.length() + ")");;
return 3;
}
if (passwd.length() > 4 && passwd.length() < 8) // length between 5 and 7
{
log.debug("6 points for length (... |
35d00456-faa9-4250-8514-e85d28a34ec3 | 9 | public static String assignVar(HashMap<String,List<String>> pDictionary) {
resetVars();
// assign the variables
for (int i=0; i < allVars.keySet().size(); i++) {
if (pDictionary.get(allURIs.get(allVars.keySet().toArray()[i])) != null) {
if (allVars.keySet().toArray()[i].equals("dnType")) {defineDnTyp... |
035ee084-f75f-41a1-a574-0bad75d5b57c | 2 | @Override
public Object cycListApiValue() {
if (size() <= 0) {
return CycList.EMPTY_CYC_LIST;
}
CycList<Object> cycList = new CycList<Object>();
for (Iterator<CycSymbol> iter = keySet().iterator(); iter.hasNext();) {
CycSymbol key = iter.next();
cycList.add(key);
final Object v... |
750428e5-baec-4564-acea-c5f9e9e06056 | 4 | private void HandleInput(String s) {
if (HandleMoveCommand(s)) return;
if (HandleItemCommand(s)) return;
if (HandleContainerCommand(s)) return;
if (HandleCreatureCommand(s)) return;
HandleMiscCommand(s);
} |
5c2860b7-497f-4aab-8e55-e9512c92f8af | 7 | private boolean ShouldVictimMove( int rowPosition, int columnPosition )
{
int leftBoundary = ( rowPosition == 0 ) ? 0 : rowPosition - 1;
int rightBoundary = ( columnPosition == world[0].length - 1 ) ? world[0].length - 1 : columnPosition + 1;
int topBoundary = ( columnPosition == 0 ) ? 0 : columnPosition - 1;
... |
4a69ad0c-6f4b-4acb-b437-fdecf3249774 | 4 | public String getSuitAsString() {
switch(suit) {
case SPADES: return "Spades";
case HEARTS: return "Hearts";
case DIAMONDS: return "Diamonds";
case CLUBS: return "Clubs";
default: return "Null";
... |
82775716-c87f-4720-81d3-cadc2d794eb3 | 3 | public void setRight(PExp node)
{
if(this._right_ != null)
{
this._right_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
4b0fc462-6718-4892-9f97-6c877d3ec009 | 4 | private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9)) {
... |
d95b81f8-6749-49ba-aaa9-b905a70cd6a0 | 8 | private HashMap<IZombie, ICoordinates> findMovements() {
HashMap<IZombie, ICoordinates> zombieMap = new HashMap<>();
// check possible movements for every zombie
for (IZombie zombie : getZombies()) {
double minDist = Double.MAX_VALUE;
IPlayer minPlayer = null;
... |
fb40b498-9698-4c2a-81ce-a8b8731427e3 | 5 | private void createTerrain(double zoom){
int octaves = 2;
for(int z = 0; z < chunkWidth; z++) {
for(int x = 0; x < chunkWidth; x++) {
double getnoise = 0;
for(int a = 0; a < octaves - 1; a++){
double frequency = Math.pow(1, a);
getnoise += octave.noise(((double)x) * frequency / zoom,((double)z)... |
ac7f8221-94df-4358-a3b7-4029f1e05f09 | 7 | public void randomisePosition() {
Map<RenderPriority, Set<Entity>> entities = Main.getGamestate().getEntities();
x = 0;
y = 0;
boolean found = true;
while (found) {
found = false;
x = random.nextInt(Main.xLen);
y = random.nextInt(Main.yLen);
for (int i = 0; i <= 4; i++) {
if (entities.conta... |
8ada6297-d794-4a65-9652-aaf8613d250e | 2 | @RequestMapping(value = "/copy/q2q", method = RequestMethod.POST, produces = {MediaType.APPLICATION_JSON_VALUE})
public BeamMeUpMQStandardResponse copyQueueToQueue(RabbitMQRequestParams rabbitMQRequestParams) {
BeamMeUpMQStandardResponse response = new BeamMeUpMQStandardResponse();
try... |
c13d8c7c-847c-4278-8d6f-a800ad6b7100 | 9 | @Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g.clearRect(0, 0, getWidth(), getHeight());
int squareWidth = 50;
int intialPosition = 10;
Image image = null;
String imgRbt = "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAKNUlEQVR42s1ZCUyVZxb9HiDKQ1nksSgIKCggICigwLjhiooLjoJgdIo... |
0d7766d0-5139-420a-9e03-c1ed98c6d5d3 | 6 | public void prove() {
resolution = new Resolution();
if(axioms == null || axioms.size() == 0) {
gui.setProof("Must have at least one axiom");
return;
} else {
for(Axiom axiom : axioms) resolution.addAxiom(axiom);
}
if(theorems == null || theorems.size() == 0) {
gui.setProof("Must have at lea... |
e310505c-816e-4c91-aceb-f153aacd2a61 | 4 | public Controls getControls() {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: getControls() BEGIN");
}
if (test || m_test) {
System.out.println("GameWindow :: getControls() END");
}
return m_controlsControl;
} |
7b093bb2-8757-491c-a615-b1fe6916fee9 | 2 | @Override
public void render()
{
for(int x = 0; x < Game.WIDTH; x+= Tile.TILE_SIZE)
{
for(int y = 0; y < Game.HEIGHT; y+= Tile.TILE_SIZE)
{
g.drawImage(Images.WALL, x, y, Tile.TILE_SIZE, Tile.TILE_SIZE, null);
}
}
g.drawImage(Images.MAZE_TITLE, 228, 20, Images.MAZE_TITLE.getWidth(this) + 128, ... |
eac76e7e-8bc4-4617-bc1f-83422bc3d2e3 | 6 | public int insideCircle(double x, double y){
int size = centers.size();
int newx = (int)x-RADIUS-CLICK_ADJUSTMENT;
int newy = (int)y-RADIUS-CLICK_ADJUSTMENT;
int selected = -1;
try{
for(int i = 0; i < size; i++){
if(((centers.get(i).getX() + 50)>newx &... |
2a1249d5-1229-41fb-8752-a404e3818187 | 7 | 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 fe... |
3f9a0006-f350-48ff-bbb8-b52c61f1ff67 | 6 | @EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (!(event.getBlock().getState() instanceof Sign)) {
return;
}
MarketSign ms = plugin.marketHandler.getMarketSign(event.getBlock());
if (ms == null) {
return;
}
if (ms.getOwner().equals(event.getPlayer().getName())
&& event.getPlay... |
f36c1df9-a850-476e-aff5-e803cedd15e2 | 0 | public void setK(int k) {
this.k = k;
} |
36af22f6-cc23-43c8-9c7a-20c2dbabaf16 | 9 | public void drop(DropTargetDropEvent evt) {
evt.acceptDrop(evt.getDropAction());
Transferable t = evt.getTransferable();
//Clear current drop data and repaint tree
DropData dropData = AppTree.this.currentDropData;
dndEnd();
if(dropData == null) {
... |
bc04fe0e-48a1-479d-9fb7-670e33994d62 | 1 | public AnnotationVisitor visitAnnotation(
final String desc,
final boolean visible)
{
AnnotationVisitor av = super.visitAnnotation(desc, visible);
if (fv != null) {
((TraceAnnotationVisitor) av).av = fv.visitAnnotation(desc, visible);
}
return av;
} |
0c859810-847e-4b64-a000-9e04f4064f9b | 8 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equalsIgnoreCase("Task"))
m_taskList.addTask(m_task);
else if (qName.equalsIgnoreCase("Name"))
m_task.setName(m_elementContent);
else if (qName.equalsIgnoreCase("Description"))
m_task.setD... |
faea099c-d7c5-4889-81ee-5aff5b0fdb4c | 5 | private int[] getHighestProbability() throws InterruptKIException
{
int[] stoneCodes = new int[codeLength];
// Checks if there are no Inputs.
if (mastermind.getRowSize() == 0)
{
// if yes then guess
for (int i = 0; i < codeLength; i++)
{
... |
3d7a1fd0-723b-4429-b189-df9c5e9c0572 | 7 | public static void main(String[] args)
{
int arrayx;
int arrayy;
int y=0;
Scanner sc = new Scanner(System.in);
System.out.println("Number of vars = ");
if (sc.hasNextInt())
{
y = sc.nextInt();
}
arrayy = y;
arrayx = y+1;
double[][] term = new double[arrayx][arrayy];
double r = 0;
for(i... |
8ab21eed-f4c3-4062-86fe-ddf0c7bbf2f3 | 2 | void parseUntil(String delim) throws java.lang.Exception
{
char c;
int startLine = line;
try {
while (!tryRead(delim)) {
c = readCh();
dataBufferAppend(c);
}
} catch (EOFException e) {
error("end of input while look... |
5c6f91c0-26bd-4f1b-b518-df4556d7871d | 4 | protected void moveUp() {
if (this.posY > 0 && !((this.posY-1) == this.enemyPosY && this.posX == this.enemyPosX) && !(BattleBotsGUI.instance.obstacles[this.posX][this.posY-1])) {
this.posY--;
}
} |
8aa246e0-2d80-4739-a643-1dd2e115a846 | 1 | public void loadPropertiesFromFile(File fileName) throws IOException {
FileInputStream in = new FileInputStream(fileName);
Properties properties = new Properties();
properties.loadFromXML(in);
setSize(new Integer(properties.getProperty("Size")));
setXposition(new Integer(propert... |
40d76b3a-4c89-44e7-94bf-2e759e20a555 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
13885898-c83d-47ab-b1e2-00a7a93c3bc3 | 4 | public static void main( String[] args )
{
try
{
StringBuilder sb = new StringBuilder();
sb.append("["+DateFormat.getInstance().format(new Date())+"] ");
for ( int i=0;i<args.length;i++ )
{
if ( !args[i].startsWith("-") )
sb.append( "\""+args[i]+"\"" );
else
sb.append(args[i]);
sb... |
e00c2858-9a3b-41ae-b059-eb0af4669d4c | 8 | static void runTest()
{
final String PATH_OF_NN[] = {
directoryPath + "xor_1.nn",
directoryPath + "xor_2.nn",
directoryPath + "xor_3.nn",
directoryPath + "xor_3_geht.nn"
};
final String PATH_OF_TRAINING_FILE = directoryPath + "ScenarioXOR.csv";
final String PATH_OF_CSV = directoryPath + "re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.