method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c08cc974-0306-468a-8b93-903654624298 | 2 | private void initCumulative() {
cumulative = new int[frequencies.length + 1];
int sum = 0;
for (int i = 0; i < frequencies.length; i++) {
sum = checkedAdd(frequencies[i], sum);
cumulative[i + 1] = sum;
}
if (sum != total)
throw new AssertionError();
} |
3bbc0d1a-5160-4085-b574-cca83f28efc2 | 8 | public static final String crypt(String salt, String original) {
while(salt.length() < 2)
salt += "A";
StringBuffer buffer = new StringBuffer(" ");
char charZero = salt.charAt(0);
char charOne = salt.charAt(1);
buffer.setCharAt(0, charZero);
bu... |
f2c05e01-eb60-4e5c-98e4-2b1ac0462936 | 9 | public static void main(String args[]) {
try {
final String str_sysORTable = "1.3.6.1.2.1.1.9";
final String str_sysOREntry = "1.3.6.1.2.1.1.9.1";
final String str_sysORIndex = "1.3.6.1.2.1.1.9.1.1";
final String str_sysORID = "1.3.6.1.2.1.1.9.1.2";
fi... |
35b06788-ee86-4de0-b461-713276b674ce | 2 | public String boolStrVal() {
if (null == isTrue) {
return "null";
}
if (isTrue) {
return "true";
} else {
return "false";
}
} |
1ac7419e-fecf-4496-a4ca-76057e5dc199 | 4 | private Palos parsePalo(String s) {
if(s.endsWith("d")){
return Palos.diamantes;
}else if(s.endsWith("h")){
return Palos.corazones;
}else if(s.endsWith("c")){
return Palos.treboles;
}else if(s.endsWith("s")){
return Palos.picas;
} re... |
23c461de-1be1-4bf4-9c4c-bf3923a126d9 | 1 | @Override
public void draw(Object obj, Component comp, Graphics2D g2) {
Image finalImage;
if (isConnected) {
finalImage = this.conectedTexture.connectedImage((ConectedTexture) obj);
} else {
finalImage = this.image;
}
int width = finalImage.getWidth(nu... |
cacc7b3d-9047-47c4-bf6a-e3573fe42c40 | 2 | public static boolean isInputDown(GameContainer container, List<Integer> input) {
for (Integer key : input) {
if (container.getInput().isKeyDown(key)) {
return true;
}
}
return false;
} |
92e974dc-8f33-461f-a7b0-eae63e907864 | 2 | public void setCast2(String[] src) {
charCast2 = new Image[src.length];
for (int i = 0; i < src.length; i++) {
try {
charCast2[i] = new Image(src[i]);
} catch (SlickException e) {
System.out.println(e);
}
}
} |
be7738c9-9ff4-43a2-8c68-b764f2aa5fa2 | 9 | public final GalaxyXPreprocessorParser.parameter_return parameter() throws RecognitionException {
GalaxyXPreprocessorParser.parameter_return retval = new GalaxyXPreprocessorParser.parameter_return();
retval.start = input.LT(1);
int parameter_StartIndex = input.index();
Object root_0 = nu... |
2d965697-dfc0-4512-9a61-ebc3a9287ddc | 1 | public void MakeAllPackets()
{
while (packetsCreated < totalNumberOfPackets)
{
//add created packet to packet created queue
packetCreated.add(CreatePacket());
}
} |
525084d7-46e9-4307-a912-513355c1bdd2 | 7 | @Override
public void init() {
// グリッド初期化
_grid = new short[ GRID_Y ][ GRID_X ];
_gridColor = new short[ GRID_Y ][ GRID_X ];
// ファイルパスルート
String filePathRoot = new File( "" ).getAbsolutePath();
// 背景読み込み
ImageIcon bgIcon = new ImageIcon( filePathRoot + "/res/image/bg.png" );
_bgImg = bgIcon.ge... |
451435b8-173e-491a-a924-f743bd6daf1f | 8 | public void omitLessFreq() {
if (name == null) return; // Illegal
int threshold = n_words[0] / LESS_FREQ_RATIO;
if (threshold < MINIMUM_FREQ) threshold = MINIMUM_FREQ;
Set<String> keys = freq.keySet();
int roman = 0;
for(Iterator<String> i = keys.iterator(); i.... |
966a36bc-31d9-4997-8f1e-f5adb1be93f9 | 1 | public void setQuantidade(int quantidade) throws ErroValidacaoException{
if(quantidade < 0){
throw new ErroValidacaoException("A quantidade não pode ser menor que 0");
}else {
this.quantidade = quantidade;
}
} |
f1fe7a85-f043-47fa-8464-aea221efc66a | 4 | public boolean equals (Object other) {
if ( ! (other instanceof MavenVersion))
return false;
MavenVersion that = (MavenVersion) other;
return this.major == that.major &&
this.minor == that.minor &&
this.incremental == that.incremental &&
t... |
dafd409b-9e9b-49c7-b241-2961e033e55a | 2 | public static Strategy getStrategy(String strategyName) {
if("average".equals(strategyName)) {
return new AverageStrategy();
} else if("vacancyRate".equals(strategyName)) {
return new VacancyRateStrategy();
} else {
return new DefaultStrategy();
}
... |
79d3c7b6-e279-42a4-b3d0-cc16d6b5402c | 6 | public void getFriendshipWindmillGraph(mxAnalysisGraph aGraph, int numBranches, int branchSize)
{
if (numBranches < 2 || branchSize < 2)
{
throw new IllegalArgumentException();
}
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
int numVertices = numBranches * branchSize + 1;... |
db2d7755-8cc9-44c5-91c1-25a40644bce5 | 2 | public static Uiswt getInstance() {
if (uniqueInstance == null) {
synchronized (Uiswt.class) {
if (uniqueInstance == null) {
uniqueInstance = new Uiswt();
}
}
}
return uniqueInstance;
} |
f4351da0-2b08-467c-b27a-89c0e755a043 | 1 | public TabStripper(String args[]) {
// Get input from the console
String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: ");
int numOfTabs = ConsoleTools.getIntInput("Enter the number of tabs to strip: ");
String[] fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to ma... |
9be20c37-a061-4832-a397-936975bbbc77 | 2 | @Override
public void setPrerequisites(String prerequisites) {
if(prerequisites == null || prerequisites.isEmpty()) {
this.prerequisites = "none";
}
this.prerequisites = prerequisites;
} |
98be3c19-f044-447d-aa84-397ad6accdda | 7 | public static boolean isInside(Positioned a, Positioned b, boolean notOnTheEdge)
{
if (notOnTheEdge)
{
if (occupySameSpace(a, b))
return true;
if (isInsideInSameHorizontalSpace(a, b))
return true;
if (isInsideInSameVer... |
fccdd589-d5a7-4ccd-a386-3016a40abaa4 | 7 | public LinkedList<Semester> uniformCostSearch()
{
LinkedList<Semester> optimalSemesterList = new LinkedList<Semester>();
if ( directoryOfClasses == null ) {
System.err.println( "Error: directoryOfClasses does not exist");
System.exit(1);
}
// instantiate the root semester, which contains any courses pr... |
b44dbc8c-5a24-48f2-845d-f08a866d59ed | 8 | public void playRound() {
// Reset our players piles (hand and won pile) -- necessary if this is
// not the first game played with these Players.
for (int i = 0; i < players.length; i++)
players[i].resetPiles();
// Create the game piles
this.createGamePiles();
// Increment our dealer.
dealerIndex = (... |
1436fad7-1f4b-4dcc-9f22-8487a32682c9 | 2 | public double hiddenBias(int index) {
if(index < 0 || index >= n)
throw new RuntimeException("given n=" + n + ", illegal value for index: " + index);
return _hiddenBias[index];
} |
81007aae-cbc4-4065-bf71-5f70678ca831 | 2 | @Override
public void check(final FolderConfig folderConfig) {
// folderConfig.getSongs().clear();
String artistString = null;
String user = null;
try {
final long artistId = getApi().resolve(folderConfig.getArtistUrl());
final HttpResponse artistResponse = getApi().get(new Request(String.format(Constant... |
ad4b4928-2b7c-4ca1-a81e-6caafda675b1 | 1 | public boolean hasTarget() {
if (rangeHandler.getPlacablesInRange().isEmpty()) {
return false;
}
return true;
} |
f90a1b3c-9e24-4257-aaba-b0b753b1f4ed | 8 | public static void main(String[] args) throws Exception {
long time = System.currentTimeMillis();
// Loading configuration first
try (FileInputStream fis = new FileInputStream(CONFIG_PATH)) {
logger.info("Loading configuration");
System.getProperties().load(fis);
} catch (Throwable t) {
logger.error(... |
92b9f779-e1a6-468b-88ac-b35d9a1c8bc6 | 4 | @Override
public void update(Observable o, Object arg) {
Integer mode = (Integer) arg;
switch (mode) {
case ApplicationState.MESSAGES_UPDATED:
Messages m = (Messages) o;
DefaultTableModel tableModel = (DefaultTableModel) jTable2.getModel();
... |
18855c73-4fa4-4cc6-b359-5c922f67eb70 | 6 | private int minimax(NeutronBoard nb, int depth)
{
NeutronBoard n_copy;
int best_value=-3000;
if (nb.whoToMove()==NeutronBoard.BLACK) {
best_value=3000;
}
if ((depth==0) || (nb.isGameOver()!=NeutronBoard.NOPLAYER)) {
return NeutronUtil.evaluation(nb);
}
for (String AM... |
19ccac0e-87da-495b-b3c3-2cc85354faf0 | 0 | public String getLinkID() {
return LinkID;
} |
5df89e6c-3663-4dd4-ab28-1f8f63a57349 | 0 | public void setEntradasCollection(Collection<Entradas> entradasCollection) {
this.entradasCollection = entradasCollection;
} |
9e7af057-dae6-4c5b-a46c-ef7656a6ce97 | 3 | @Override
public EnvironnementAbs run(EnvironnementAbs env) {
EnvironnementWator univert = (EnvironnementWator)env;
ArrayList<AgentSwatorAbs> voisins = univert.voisins(pos_x, pos_y);
boolean depalcementPossible = voisins.contains(null);
cycleReproduction++;
int x = pos_x,y = pos_y;
if (depalcementPossible)... |
bd0e5243-cb9c-4b34-bf4f-8556a9542f9d | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
controller.populateMovies();
this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} catch (IOException ex) ... |
0bb6db5c-2eb1-4683-8267-e4fabdcc303b | 4 | @EventHandler(priority = EventPriority.HIGH)
public void InteractAggroMob(EntityTargetEvent event){
final EntityTargetEvent realEvent = (EntityTargetEvent) event;
if(realEvent.getTarget() instanceof Player){
String TargetName = ((Player) realEvent.getTarget()).getName();
Player TargetedPlayer = Bukkit.ge... |
e6e5ab42-7b1e-475e-bef9-664cb2388364 | 0 | public ManifestType createManifestType() {
return new ManifestType();
} |
ab574a9f-be76-4e88-9c4a-f9721d7ddafd | 1 | * @param genFormatList the genFormat argument substitution sequence
*
* @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
*/
@Deprecated
public ... |
c96936d1-f0db-427d-b176-2d42566b0076 | 4 | public void manageEconomy(final User user) {
if (user == null)
return;
try {
// Manage account
final BankAccount acc = Economy.getInstance().getAccount(user);
if (acc == null)
return;
// Check for welfare
double welfare = acc.hasWelfare() ? Economy.getWelfareAmount() : 0.0D;
... |
35ad3db5-8c0d-4438-8441-0da8476ae47d | 8 | private void shoot() {
boolean cur = GUI.whosTurn;
if (this.p == GUI.getPlayer(cur)) { //ei voi ampua omalle alueelle
return;
}
int result;
/*yritys optimoida allaolevaa metodin osiota. ei toimi vielä*/
// result = GUI.getPlayer(cur).shoot(GUI.getPlayer(!cu... |
c7f99a42-6791-4cea-aea9-0e4ea902ddc8 | 6 | public boolean maskContainsRelativePoint(Point relativep, int maskindex)
{
// In case mask is not used (mask == null), always returns true
if (getMask() == null)
return true;
// Checks if the maskindex was a valid number
if (maskindex >= getMask().getImageNumber())
maskindex = getMask().getImageNumb... |
9dc1382f-5889-40b0-bcf3-76acee7c01f6 | 7 | public void handleDeath() {
for (Iterator<NPC> i = NPC.iterator(); i.hasNext();) if (i.next().getDeath()) i.remove();
for (Iterator<Bullet> i = BulletAlly.iterator(); i.hasNext();) if (i.next().getDeath()) i.remove();
for (Iterator<Bullet> i = BulletNPC.iterator(); i.hasNext();) if (i... |
b0ad8d80-585f-4eea-83a4-d3f85ba6558f | 4 | private static char lookChar() { // return next character from input
if (buffer == null || pos > buffer.length())
fillBuffer();
if (buffer == null)
return EOF;
else if (pos == buffer.length())
return '\n';
else
return buffer.charAt(pos);
} |
4f907291-5d9a-4332-8226-bca29f7d0487 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractComponent other = (AbstractComponent) obj;
if (identifier == null) {
if (other.identifier != null)
return false;
} else if (!ide... |
73eaaef9-1270-4cdb-8714-316a1ae1afe8 | 0 | public PopupMenu(JPopupMenu menu){
this.menu = menu;
} |
0367f036-e637-40e4-973e-b0af0ee63e6a | 0 | public NetworkListener(int port) {
this.port = port;
} |
a968c65e-c92f-423d-95aa-5df88309a979 | 4 | public void actionPerformed(ActionEvent e) {
if(forest ==1 && oldMan ==0){
boyY = boyY + velY;
}
if(forest ==1 && oldMan ==1){
GameFile.iLocY = GameFile.iLocY + velY;
}
} |
9c7edf2c-777c-4760-bd92-23931fdd0d78 | 0 | public boolean inSameRankAs(Field otherField) {
return this.distanceBetweenRank(otherField) == 0;
} |
c9d60589-22bd-44de-a991-8f01e6968961 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node other = (Node) o... |
542a2367-bb68-4f1b-b718-bd5c94d30d67 | 5 | private void cmbSearchItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbSearchItemStateChanged
// TODO add your handling code here:
String studentID = "";
String examID = "";
if (cmbExamID.getSelectedItem() != null) {
examID = cmbExamID.getSelectedItem().to... |
e48bd347-3474-4416-adc6-0f074e581a2e | 8 | public Set<String> findSet(String woe_id,String group_id) {
SearchParameters search_parameters = new SearchParameters();
search_parameters.setWoeId(woe_id);
Set<String> user_set = findUserSet(woe_id);
Set<String> result = new HashSet<String>();
PhotoList photo_list = null;
System.out.println("total user:"... |
bbc071fe-6ab0-453d-b275-134cc054abf8 | 2 | public String commonPrefix(PGridPath path) {
if (path == null) {
throw new NullPointerException();
}
int index = 1;
String oPath = path.toString();
while (path_.regionMatches(0, oPath, 0, index)) {
index++;
}
index--;
return path... |
c2776781-d51a-4904-911f-c7228a118443 | 9 | public static String[] getKeyandValue(String line) {
String[] words = Tools.readWords(line);
if (words.length==0 || words[0].charAt(0)==commentChar) {
return new String[] {"",""};
}
String key, value="";
if (words[0].contains("=")) {
String[] subwords = wo... |
98f618e5-4639-4605-8f28-5cecdc019049 | 9 | public PolyCubicSplineFast(Object xArrays, Object fOfX){
this.fOfX = Fmath.copyObject(fOfX);
this.xArrays = Fmath.copyObject(xArrays);
// Calculate fOfX array dimension number
Object internalArrays = Fmath.copyObject(fOfX);
this.nDimensions = 1;
while(!((intern... |
f1da6e3b-d67c-41cf-aaee-733fad2e2c4a | 8 | public Piece selectMonRoi(int tour)
{
Piece monRoi = null;
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
if(this.E.getTableau()[i][j]!=null)
if(this.E.getTableau()[i][j].getClass().getName() == "pieces.Roi")
if((this.E.getTableau()[i][j].getCouleur() == "blanc") && ((tour%2 != 0)) ||
... |
a96d66a8-2c89-4093-a060-c897348586d9 | 7 | public void countNeuralValues(){
int i=0;
int j=0;
int k=0;
for(i=0;i<incomeLayoutNeuronCount;i++){
incomeLayout.get(i).countOutcomeValue();
}
for(i=0;i<hideLayoutNeuronCount;i++){
for(j=0;j<incomeLayoutNeuronCount;j++){
... |
ac0f68ff-cdf9-4079-8673-bdab9b17b10c | 8 | public void handle(SingleUserCrawlingEvent event) {
long uid = event.getOriginalSourceUid();
if (uid > 0) {
try {
weibo4j.model.User user = SinaWeibo.getInstance().getUser(uid);
if (user != SinaWeibo.USER_NOT_FOUND) {
com.julu.weibouser.m... |
2d1fc8c0-0f49-4f53-9eef-a4593c4c6dad | 4 | public static int queryGetInt(HttpRequest req, String key, int def)
{
int ret = def;
String val = null;
if(req.method().equals("GET"))
val = req.queryParam(key);
else if(req.method().equals("POST"))
val = req.postParam(key);
if(val != null)
try
{
ret = Integer.parseInt(val);
}
catch(Num... |
22ad0539-311a-499a-975e-05a7b0aafb28 | 4 | @Override
public Map convertMap(pplgg.Map myMap) {
Tile[][] newMap = new Tile[myMap.getWidth()][myMap.getHeight()];
List<Tile> keys = new ArrayList<Tile>();
for (int x = 0; x < myMap.getWidth(); x++) {
for (int y = 0; y < myMap.getHeight(); y++) {
int type = myMap.getTerrain(x, y);
if (type == 0) {... |
c0e31e4e-08a6-4e5e-94fb-77627a507fcc | 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 Feature)) {
return false;
}
Feature other = (Feature) object;
if ((this.id == null && other.id != null) || (thi... |
50b5d1c5-91b7-410e-bcc4-149cc3e1d40a | 8 | private DPTXlator createTranslator(final int objIndex, final int pid)
throws KNXException, InterruptedException
{
final int ot = getObjectType(objIndex, true);
int pdt = -1;
Property p = (Property) properties.get(new PropertyKey(ot, pid));
// if no property found, lookup global pid
if (p == null && pid < 5... |
07adf10b-56bf-4ad0-b4ba-be5fd4d54851 | 0 | @Override
public void setName(String name) {
this.name = name;
} |
d37394b2-53c3-4185-88bd-86327776c01f | 1 | public final static double roundBidAsk(double number, double tick, boolean bid)
{
// get rid of trailing 00..001s and 99..99s
double raw = Math.round((number) * scale);
long recpTick = Math.round(1 / tick);
// get back to basis, tricky with the tick size due to floating issues
raw /= scale * 1 / recpTick;
// ro... |
9a0fb968-1899-4b45-80d6-d0a4bc2e5f3e | 8 | void setReverb(JSSample sample) {
/*
* Only third sample of multisample sounds has reverb parameters set.
* For now, only positional and directional sounds are reverberated.
*/
int soundType = sample.getSoundType();
int dataType = sample.getDataType();
... |
fa8549e5-2b95-4fda-b6c1-1b5de23861ba | 9 | static void optimize(final File f, final File d, final Remapper remapper)
throws IOException {
if (f.isDirectory()) {
File[] files = f.listFiles();
for (int i = 0; i < files.length; ++i) {
optimize(files[i], d, remapper);
}
} else if (f.get... |
127e5f1a-950d-4a5f-8207-364ecbb84e57 | 4 | public static void makeReports(List<Book> bookL){
StringBuilder data=new StringBuilder();
for(Book b:bookL){
if (b.getQuantity() == 0){
data.append(b.toReport());
data.append("\n");
}
}
try {
FileOutputStream file=new FileOutputStream(new File("report.txt"));
file.write(data.toString().getBy... |
d85df094-2a3d-4cb5-96f1-81ae930e77b1 | 6 | public void startElement(
String namespaceURI,
String simpleName,
String qualifiedName,
Attributes attributes)
throws SAXException {
short currentTag = 0;
String element = simpleName;
if ("".equals(simpleName)) {
... |
841e97e3-8691-4fdc-885a-1f4b0d6c41b1 | 8 | public boolean storeImageFreqsToDb(String imageFileName, long[][] bins, long pixels) {
StopWatch sw = new StopWatch();
sw.start();
StringBuilder sql = new StringBuilder("INSERT INTO frequencies (id_image, r_value, g_value, b_value, frequency, frequency_perc) VALUES (?, ?, ?, ?, ?, ?)");
... |
a7acdbba-c6fe-409a-8659-510121e2d901 | 2 | public static ArrayList<Subcategorias> sqlSelectDos(Categorias cat){
ArrayList<Subcategorias> subcat = new ArrayList();
if(!BD.getInstance().sqlSelect("SELECT sc.nombre, sc.idsubcategorias FROM subcategorias sc INNER JOIN cat_subcat_tit_attr_descr pr ON pr.subcategorias_id = sc.idsubcategorias INNER JOI... |
c8bccb85-78c6-48ac-862a-88df342f4725 | 3 | private void CommandQuickPlay( boolean priority, boolean toStream,
boolean toLoop, String sourcename,
FilenameURL filenameURL, float x, float y,
float z, int attModel, float distORroll,
... |
d8f89fae-90d3-41ed-89ab-e306685af51f | 3 | void hash(){
if(hashed)
return;
MAC macsha1=getHMACSHA1();
if(salt==null){
Random random=Session.random;
synchronized(random){
salt=new byte[macsha1.getBlockSize()];
random.fill(salt, 0, salt.length);
}
}
try{
synchronized(macsha1... |
f7030af7-643f-4b46-8ddb-216ebebc5f29 | 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... |
34c5a9a9-569e-43b3-b322-45983cfb5b51 | 7 | protected void startGame() {
notifyNewGame();
discardCards();
shuffle();
community.clear();
doAntes();
doBlinds();
dealCard(players.get((dealer + 1) % numplayers), false);
dealCard(players.get((dealer + 1) % num... |
38cfc62f-8d3d-45da-999b-70d3aef3c072 | 5 | public static Criteria parseCriteria( Ptg[] criteria )
{
DB dblist = DB.parseList( criteria );
if( dblist == null )
{
return null;
}
Criteria crit = new Criteria( dblist.getNCols(), dblist.getNRows() );
crit.colHeaders = dblist.colHeaders;
crit.rows = dblist.rows;
if( log.isDebugEnabled() )
{
l... |
993e1dd5-829a-4b28-a23f-ce4343e712db | 6 | public void checkTableStructure(TableRegistration table) {
// TODO Update table structure
StringBuilder query = new StringBuilder();
query.append("SELECT * FROM ")
.append(table.getName())
.append(" LIMIT 1");
try {
ResultSetMetaData meta = connection.prepareStatement(query.toString()).executeQuery()... |
76cf2e30-c194-4e12-9040-71bf07ac5031 | 6 | public void DVD() {
pcIncrease();
if ((getXF().get().equals("00") || getXF().get().equals("10")) && (getRF().get().equals("00") || getRF().get().equals("10"))) {
if (SelectRegister().get().equals("00000000000000000000")||SelectRegister().get().equals("10000000000000000000")){
... |
d8035638-b9dd-4961-bdbb-a353425965aa | 6 | private ArrayList<AnchorPiece> getAnchorPieces(Board board) {
ArrayList<AnchorPiece> anchors = new ArrayList<AnchorPiece>();
ArrayList<Piece> opposingPieces = getOpposingNeighbors(board);
for(Piece p : opposingPieces) {
int x = this.getX(), y = this.getY();
int dirX = p.getX() - this.getX()... |
f5b4fbf6-51b8-417d-bdf2-c361805f68c8 | 2 | private void placeButtons() {
createButton(0 + startPointXCoordinate, 40 + startPointYCoordinate, 40,
40, new Runnable() {
public void run() {
MoveAction moveAction = objectTron
.moveAction(Movement.LEFT);
doAction(moveAction);
repaint();
}
}).setImage(loadImage("view/asset... |
d4643cc2-535c-4a6f-bc51-0c75c1c36d2f | 7 | public void makeReactions(final SquirmChemistry chemistry, int n_x, int n_y, SquirmCellSlot cell_grid[][]) {
// collect the unbonded neighbours of this cell (up to 8)
final Vector<SquirmCell> neighbours = new Vector<SquirmCell>();
int tx, ty;
SquirmCellSlot slot;
SquirmCell cell;... |
c69a1c4b-c309-48cd-ac18-37ffaf90b3ba | 5 | @Override
public void actionPerformed(ActionEvent e) {
int numPages = pages.size();
String pageNumMessage;
if(numPages > 1){
pageNumMessage = numPages + " pages.";
}
else{
pageNumMessage = numPages + " page.";
}
String allWords = "";
for(int i = 0; i < pages.size(); i++){
JTextPane curre... |
9eb45ab4-6b81-4cb0-87cd-ac6ee216c934 | 8 | private boolean inPoly(FastVector ob, double x, double y) {
int count = 0;
double vecx, vecy;
double change;
double x1, y1, x2, y2;
for (int noa = 1; noa < ob.size() - 2; noa += 2) {
y1 = ((Double)ob.elementAt(noa+1)).doubleValue();
y2 = ((Double)ob.elementAt(noa+3)).doubleValue();
if (... |
6d87208a-3ab6-412d-9e16-568c1ff21caf | 1 | public ArrayList viewServiceDesc() {
ArrayList temp = new ArrayList();
Query q = em.createQuery("SELECT t from ServiceEntity t");
for (Object o : q.getResultList()) {
ServiceEntity p = (ServiceEntity) o;
temp.add(p.getDescription());
}
return temp;
} |
8abd0649-8029-414a-bbb8-0a02d464e8b0 | 9 | public static int[] findMinMax(int[] arr) {
if( arr == null ){
throw new IllegalArgumentException("Can't find max/min in NULL array");
}
if( arr.length == 0 ){
throw new IllegalArgumentException("Can't find max/min in EMPTY array");
}
if( arr.length < 2 ){
return new int[]{ arr[0], arr[0] ... |
024e6122-b4cc-469a-ba24-94620371cf00 | 6 | public void startClient() {
udpSocket = new UDPSocket(udpPort);
MainClient.clientExecutionService.execute(udpSocket);
try {
socket = new Socket(host, tcpPort);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (UnknownHostE... |
f1daf7db-734e-4d83-8858-9d2b1dd52aa3 | 6 | private static void enqueueCacheEntry(String name, String version, String packCacheLocation, String minecraftVersion, List<String> installationQueue) {
//Get entry location
String entryPath = getCacheEntryPath(name, version, packCacheLocation);
if (entryPath != null) {
... |
2013ab53-ae0b-48ce-9f44-f48873e69f13 | 9 | private static void writePairs( Document dom, MVD mvd,
Element parent, String encoding ) throws Exception
{
Element pParent = dom.createElement( "pairs" );
HashMap<Pair,Integer> parents = new HashMap<Pair,Integer>();
HashMap<Pair,LinkedList<Element>> orphans =
new HashMap<Pair,LinkedList<Element>>();
in... |
3f6147e3-878f-493a-a0e8-187faed90701 | 2 | public static String encodeURIComponent(String s)
{
StringBuilder o = new StringBuilder();
for (char ch : s.toCharArray()) {
if (isUnsafe(ch)) {
o.append('%');
o.append(toHex(ch / 16));
o.append(toHex(ch % 16));
}
el... |
fb91882e-1eb7-4c2f-8938-9e5cd89b30d2 | 5 | public void keyReleased(KeyEvent e) {
int code = e.getKeyCode();
if (code == KeyEvent.VK_LEFT) {
leftPressed = false;
}
else if (code == KeyEvent.VK_RIGHT) {
rightPressed = false;
}
else if (code == KeyEvent.VK_UP) {
upPressed = false;
if (onGround) jumping = false;
if (jumpHold) jumpHold = f... |
7f201b1b-3e8b-4eaf-bab3-a85a2c39e8c7 | 3 | private List<String> getListOfStyles() {
List<String> styles = new ArrayList<String>();
try
{
String baseURL = Options.getInstance().getProperty("cloudURL");
URI rURI = new URI("http", null, baseURL, 80, "/styles/", null, null);
URL url = rURI.toURL();
//URL url = ... |
edca162e-5956-4072-8fbe-7cac110fd2f0 | 4 | public boolean isChunkFullyGenerated(int x, int z) { // if all adjacent
// chunks exist, it
// should be a safe
// enough bet that
// this one is fully
// generated
return !(!doesChunkExist(x, z) || !doesChunkExist(x + 1, z)
|| !doesChunkE... |
e0ac2e00-218b-427a-b6a7-640a51a70ad1 | 8 | public void setCarPositions(ArrayList<CarPosition> carPositions) {
allCars2.clear();
for (CarPosition carPosition : carPositions) {
CarInfo carInfoOld = null;
for (CarInfo car : allCars) {
if (car.color != null && car.color.equals(carPosition.color)) {
... |
f45b9005-624f-454f-ad8b-0e2cf3908e44 | 6 | public double[] getTemperatures(double[] var1, int var2, int var3, int var4, int var5) {
if(var1 == null || var1.length < var4 * var5) {
var1 = new double[var4 * var5];
}
var1 = this.field_4194_e.func_4112_a(var1, (double)var2, (double)var3, var4, var5, 0.02500000037252903D, 0.02500000037252... |
3a271786-89bd-4fd1-9380-d7d3c175d8bf | 2 | public void saveXml(String xmlFileName){
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = factory.newDocumentBuilder();
DOMImplementation domImplementation = db.getDOMImplementation();
Document doc = domImpleme... |
b9f2fde1-a77c-43aa-9ad5-362d75217082 | 5 | @Override
public boolean hasNext() {
if (mNextValid) {
return true;
}
while (mIterator.hasNext()) {
Object obj = mIterator.next();
if (obj == null) {
if (!mOmitNulls) {
mNext = null;
mNextValid = true;
return true;
}
} else if (mContentClass.isInstance(obj)) {
mNext = mCon... |
94dbb002-9329-4dfb-8c9e-dcb7c1158e3b | 7 | public static void deleteDirectory(File path) {
if (path.exists()) {
File[] files = path.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
deleteDirectory(file);
} else {
... |
90874fc1-db66-4a27-9e96-3ac0536becbd | 1 | public PreferenceString getCreateModDatesFormat() {
if (useDocumentSettings()) {
return this.createModDatesFormat;
} else {
return Preferences.getPreferenceString(Preferences.CREATE_MOD_DATES_FORMAT);
}
} |
007a3d65-e616-4ee3-a219-e71c19df1d95 | 9 | public boolean contains(Mark m) {
if((m.top() || m.vmiddle()) && m.left()) {
return m.y < (m.x / 2 + radius / 2);
} else if(m.bottom() && (m.left() || m.middle())) {
return (Math.pow(m.x, 2) + Math.pow(m.y, 2)) < Math.pow(radius, 2);
} else if(m.bottom() && m.right()) {
... |
57326f32-5cff-4845-8d28-36fb2d753cb4 | 4 | static boolean unpackZipTo(Path zipfile, Path destDirectory) throws IOException {
boolean ret = true;
byte[] bytebuffer = new byte[BUFFERSIZE];
ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream(zipfile.toFile()));
ZipEntry zipentry;
while ((zipentry = zipin... |
e79a5030-cdbe-4c34-bdce-c49e0821284c | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
SessionRequestContent req = new SessionRequestContent(request);
ActionCommand command = CommandFactory.defineCommand(req);
String page = command.execute(req... |
01c5c282-98f9-46f5-b429-3aca04114b89 | 2 | public void sendServerMessage (String message) {
for (Map.Entry<String, Socket> user : activeSockets.entrySet()) {
Socket socket = user.getValue();
try {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println("*** [SERVER] " + messa... |
14066a03-0dd1-4267-b383-bf13dc60d617 | 0 | private void sing(String singname) {
System.out.println("唱歌:" + singname);
} |
fb44f97f-c5f5-48d7-bea7-bf5e18f440d6 | 3 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.next();
char[] str = s.toCharArray();
int n = 1 << s.length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
sb = new StringBuilder();
for (int j = 0; j < s.length(); j++) {
if (((i ... |
e26ffc78-5ffb-4295-9695-a3d332b352d9 | 9 | private void parseDayDetails(int i) {
int firstOccurance = 0;
for (int j=i-1; j>=0; j--) {
if (parts[j].equals("next") || parts[j].equals("following") ) {
isCommandDetails[j] = false;
} else {
firstOccurance = j+1;
break;
}
}
if ((firstOccurance > 0)
&& getConnectorWords().contains(par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.