method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
562aceba-7574-4ccb-ad0f-ebace98bc556 | 0 | public void setPersonId(int personId) {
this.personId = personId;
} |
c17d5ddf-4961-45ed-8ce0-11bd3a2c7fe9 | 9 | protected void inTag(final char c)
{
switch(c)
{
case ' ': case '\t': case '\r': case '\n':
if(canStartPiece(bufDex))
{
startPiece(bufDex);
changedTagState(State.BEFOREATTRIB);
}
else
changeTagState(State.START);
return;
case '<': changeTagState(State.BEFORETAG); return;
case '>':
... |
be86e039-8bf9-4de7-baa3-f6a82a67b7e8 | 0 | public SpecialCommand(TotalPermissions p) {
plugin = p;
} |
de26fd05-951d-4970-806c-2b7d8059d0e4 | 3 | public static void executeTasks(List<Task> tasks, final CountDownLatch latch, ExecutorService pool) {
for(final Task t : tasks) {
pool.submit(new Runnable() {
@Override
public void run() {
try {
t.execute();
} catch(Exception e) {
e.printStackTrace();
} finally {
latch.cou... |
ba8e44d3-9cf8-445a-bdc8-1de0e878624c | 1 | public void testMultipliedBy_int() {
Days test = Days.days(2);
assertEquals(6, test.multipliedBy(3).getDays());
assertEquals(2, test.getDays());
assertEquals(-6, test.multipliedBy(-3).getDays());
assertSame(test, test.multipliedBy(1));
Days halfMax = Days.days(In... |
3353d90e-f23b-475e-b917-5b5ebb5c6351 | 7 | public String[] readCmd() throws IOException {
if( chunkLeft > 0 ) throw new IOException("Cannot read command; there are "+chunkLeft+" chunk bytes left to be read");
int lineLength;
do {
lineLength = readLine( cmdBuffer );
} while( lineLength >= 0 && isEntirelyWhitespace( cmdBuffer, lineLength ) );
if( ... |
1c75e17e-564d-409e-9e68-a30f9c968e5c | 3 | public static double range(double[] vals) {
double min = vals[0];
double max = vals[0];
for (double v : vals) {
if (v < min) {
min = v;
}
if (v > max) {
max = v;
}
}
return max - min;
} |
dcfafb7c-eb0f-4ccd-874c-3eb17c52a733 | 1 | private long normalize(IDecimal decimal, int toFactor)
{
if (decimal.getFactor() == toFactor)
{
return decimal.getBase();
}
else
{
return (long) (decimal.getBase() * pow(toFactor - decimal.getFactor()));
}
} |
bcccb457-176a-44d0-bca6-1bedd59733db | 9 | private final String createMsg(
ListResourceBundle fResourceBundle,
String msgKey,
Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null)
msg = fResourceBundle.getString(msgKey);
... |
95d25deb-3a37-4add-824e-2d9cdba583dd | 4 | public static void main(String[] args) {
Properties pr = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(
System.getProperty("user.dir") + "/src/io/test.properties");
pr.load(fis);
for (Object objKey : pr.keySet()) {
String key = (String)objKey;
System.ou... |
f06256a5-11cd-43c0-ad1c-acf140295333 | 2 | public static int getSkillId(String skillName) {
Iterator<Integer> iterator = skillsMap.keySet().iterator();
int skillId = 0;
while(iterator.hasNext()){
int key = iterator.next();
String value = skillsMap.get(key);
if(value.equals(skillName))
skillId = key;
}
return skillId;
} |
6ca59a9a-e300-49f8-9442-b91312d93e79 | 0 | public static void addProcessor(Processor processor){
executor.execute(processor);
} |
938c05ec-3a23-4ee0-b784-1ccba303c401 | 4 | public int[] sensed_cell(int[] p, int direction, Direction sense_dir){
int[] x = new int[2];
switch(sense_dir){
case HERE: x = p;
break;
case AHEAD: x = adjacent_cell(p, direction);
break;
case LEFTAHEAD: x = adjacent_cell(p, Turn(LeftRight.LEFT, direction));
break;
case RIGHTAHEAD: x = adjacent_cell(... |
cd851c93-f900-41e3-ab2f-3563c16fb1f1 | 3 | public void verify(List<T> target) throws PatchFailedException {
if (last() > target.size()) {
throw new PatchFailedException("Incorrect Chunk: the position of chunk > target size");
}
for (int i = 0; i < size(); i++) {
if (!target.get(position + i).equals(lines.get(i))) ... |
7d1db884-081b-4bd5-9bdc-00749779fdbb | 6 | public void inserir(int key){
Nodo nodoAnt = null;
Nodo nodoPos = root;
Nodo novo = null;
while(nodoPos != null && nodoPos.getKey() != key){
nodoAnt = nodoPos;
if(key < nodoPos.getKey()){
nodoPos = nodoPos.getLeft();
}
... |
f6ee9391-c825-4d0a-bd55-66c6a1740fb7 | 6 | public static Complex[] fft (Complex[] x) {
ra.check();
int n = x.length;
if (n == 1) {
return new Complex[] { x[0] };
}
if (n % 2 != 0) {
throw new RuntimeException("N is not a power of 2");
}
Complex[] even = new Complex[n/2];
... |
8cead109-106e-4ec3-8dbe-4b3d6fb86796 | 6 | @Override
public boolean isMoveValid(int srcRow, int srcCol, int destRow, int destCol) {
// TODO Auto-generated method stub
boolean result = false;
//For Black Pawn
if(isWhite == false){
if(((destRow == (srcRow + 1)) && (destCol == srcCol))){
result = true;
}
else{
return result;
... |
bc58b512-55dd-428b-946f-3574ff046006 | 0 | public int read(char[] cbuf, int off, int len) throws IOException {
init();
return internalIn2.read(cbuf, off, len);
} |
2c14045b-bceb-4d8e-8072-df03b39b8f72 | 8 | public void countBagReferences(Instance bag){
int index = 0, referencesIndex = 0;
if(m_TrainBags.numInstances() < m_NumReferences)
referencesIndex = m_TrainBags.numInstances() - 1;
else
referencesIndex = m_NumReferences;
if(m_CitersDebug == true){
System.out.println("-------Reference... |
ed7c1e25-fd42-412c-95dd-49479f27130c | 3 | protected Constructor<? extends ConfigurationSerializable> getConstructor() {
try {
return clazz.getConstructor(Map.class);
} catch (NoSuchMethodException ex) {
return null;
} catch (SecurityException ex) {
return null;
}
} |
7a2cf18d-67fb-4a91-854f-4099a098c2a2 | 1 | public PrintWriter luoKirjoitin(){
try {
PrintWriter kirjoitin = new PrintWriter(tiedosto);
return kirjoitin;
} catch (Exception e) {
System.out.println("Tiedostoa ei löydy!");
}
return null;
} |
9f49d4b0-ac96-457d-a2ae-1dee3b55a9cb | 7 | @EventHandler(priority = EventPriority.HIGHEST)
public void onjoin(PlayerJoinEvent e) {
if (core.getDB().secplayers.containsKey(e.getPlayer().getName())) {
SecretPlayer player = core.getDB().secplayers.get(e.getPlayer().getName());
player.setInitialLocation(e.getPlayer().getLocation());
if (!player.isLogged... |
83efe35f-6b09-448b-a62e-c96d7cbce1ec | 5 | @Override
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) {
return new CompositeContext() {
/**
* Composes the two source Raster objects and places the result in the destination WritableRaster.
*
... |
490e8645-514b-458c-8c83-bfb5a077230c | 0 | private CancelMessage(ByteBuffer buffer, int piece,
int offset, int length) {
super(Type.CANCEL, buffer);
this.piece = piece;
this.offset = offset;
this.length = length;
} |
9161eb6f-4bf8-478a-a2f8-5a4bdddc1a4b | 7 | @Override
public boolean inStartingPosition()
{
if (hasMoved())
return false;
if ((getColor() == ChessPieceColor.WHITE) && (getRow() == 1)) {
return (getColumn() == 3) || (getColumn() == 6);
}
else if ((getColor() == ChessPieceColor.BLACK) && (getRow() == ... |
2569ed4e-8d9f-45dc-83e7-a9a23ac784ca | 9 | protected void printTopWordsDistribution(int topK, String topWordFile) {
Arrays.fill(m_sstat, 0);
System.out.println("print top words");
for (_Doc d : m_trainSet) {
for (int i = 0; i < number_of_topics; i++)
m_sstat[i] += m_logSpace ? Math.exp(d.m_topics[i])
: d.m_topics[i];
}
Utils.L1Normaliza... |
9566dfab-c23c-4b97-bac8-f031362eafc1 | 5 | public void findAvailRec()
{
int logQuantity = 0;
int stoneQuantity = 0;
for (Inventory inventory : inventorys) {
if (inventory.getQuantity() > 0) {
switch (inventory.getItemCode()) {
case 1:
logQuantity = inventory.getQuantity();
break;
case 2:
... |
1ab8e4fa-f8e7-4fa7-8386-051f4d683887 | 0 | @Override
public void componentMoved(ComponentEvent e) {} |
06818a87-d464-456b-ace7-9c982aa89d0f | 8 | private void interpolate(int iLower, int iUpper) {
int dx = (int) Math.floor(txRaster[iUpper]) - (int) Math.floor(txRaster[iLower]);
if (dx < 0)
dx = -dx;
float dy = (int) Math.floor(tyRaster[iUpper]) - (int) Math.floor(tyRaster[iLower]);
if (dy < 0)
dy = -dy;
if ((dx + dy) <= 1)
return;
float tLow... |
9e746856-f085-4a46-a838-e611dc1ca542 | 9 | private boolean checkNorthEastEdge(EdgeLocation normEdgeLocation, ArrayList<Road> roads, int playerIndex) {
HexLocation thisHexLoc = normEdgeLocation.getHexLoc();
HexLocation NEHexLoc = normEdgeLocation.getHexLoc().getNeighborLoc(EdgeDirection.NorthEast);
HexLocation SEHexLoc = normEdgeLocation.getHexLoc().getNei... |
c3597b35-28cd-481f-8466-82076a7c26b4 | 6 | private void splitWord(String word) {
overlapp = "";
if (word == null || word.length() == 0) {
this.first = "";
this.focus = "";
this.last = "";
return;
}
if (word.length() == 1) {
this.first = "";
this.foc... |
fd6d0435-974c-43cc-a085-bb7ce7066b61 | 4 | public static Matrix createSubMatrix(Matrix matrix, int excluding_row, int excluding_col) {
Matrix mat = new Matrix(matrix.getNrows()-1, matrix.getNcols()-1);
int r = -1;
for (int i=0;i<matrix.getNrows();i++) {
if (i==excluding_row)
continue;
r++;
... |
9657b0ee-b807-449e-9d7a-d483d8bf0613 | 3 | * @return this
*/
public Request with(Object... args) {
if (args != null) {
if (args.length % 2 != 0) throw new IllegalArgumentException("need even number of arguments");
for (int i = 0; i < args.length; i += 2) {
add(args[i].toString(), args[i + 1]);
... |
8f974d41-fb10-42b6-a776-fa293ed70fae | 2 | private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
//Toma lo que hay en la caja de texto y se lo asigna al String nombre
String nombre = String.valueOf(txtNombreArchivo.getText());
General g = new General();
if( ... |
1776c519-0701-4f55-b72b-3c0113f598d5 | 4 | @Override
public Status execute(String command) throws MenuException {
switch (command) {
case "N":
return Status.NEW_GAME;
case "B":
return Status.BEST_TIMES;
case "?":
return Status.HELP;
case "Q":
... |
024e8ad9-7baa-4cee-a0e5-00dc971166d2 | 2 | @Override
public void deleteMax() throws EmptyCollectionException,
KeyNotFoundException {
if (treeIsEmpty())
throw new EmptyCollectionException();
Node x = root;
while (x.right != null)
x = x.right;
delete(x.key);
} |
4c4c4cef-ef36-47c2-bc9e-799d48df2bf5 | 4 | public static void go() {
long x = 0;
for (int i = 1; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 10; k++) {
x = i * 100 + j * 10 + k;
if (x == (Math.pow(i, 3) + Math.pow(j, 3) + Math.pow(k, 3))) {
... |
70d2d683-1d25-4180-8b1d-8b539e71b05c | 2 | @Override
public boolean add(Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "INSERT INTO `Timeline_Database`.`Eventnodes` (`owner`, `description`, `display`) VALUES ('%s', '%s', '%s');";
if(item instanceof Eventnode)
{
Eventnode newitem = new Eventnode();
newitem = (Eventnode... |
a5fbfbb4-14a7-4a5b-89c5-abcf3bdecf95 | 1 | private long safeSizeOf(Object key, ICacheable value) {
long result = value.sizeOf();
if (result < 0) {
throw new IllegalStateException("Negative size: " + key + "=" + value);
}
return result;
} |
ba962011-cfa7-4932-b774-fb7a38e05ce1 | 6 | private boolean filter(short a, short b) {
boolean x = a >= 0;
boolean y = b >= 0;
if(x && y) {
return a < b;
}
if(!x && y) {
return a > b;
}
if(x && !y) {
return a + b < 0;
}
... |
e37c98df-4fa1-4f21-862c-05664c74f257 | 2 | public List<Aluno> pesquisaAlunoPeloNome(String nome) {
List<Aluno> listaNomes = new ArrayList<Aluno>();
for (Aluno e : alunos) {
if (e.getNome().indexOf(nome) != -1) {
listaNomes.add(e);
}
}
return listaNomes;
} |
c243048f-aeaa-4fad-bcad-bd0b3424ba38 | 7 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
PypAdmAgend pypAdmAgend;
try {
pypAdmAgend = em.getReference(Py... |
1f97b8fe-4043-4627-933e-a3bf3a89f9f2 | 9 | public void injectPlayer(Player... pl) {
for(Player p : pl) {
if(attachments.get(p.getName()) != null) attachments.put(p.getName(), p.addAttachment(getPlugin()));
for(Entry<String, Boolean> permission : attachments.get(p.getName()).getPermissions().entrySet()) {
if(getPermissions(p.getName()).contains(permi... |
f293d16a-d1a9-4434-a4dd-23e97bb376bf | 2 | public void updateSchema(Class<?> klass) throws SQLException
{
ConnectionWrapper cw = getConnectionWrapper();
try
{
persist.getTableManager().updateTableForClass(klass, cw);
cw.commitAndDiscard();
}
catch (Exception e)
{
// cancel the operation
cw.rollbackAndDiscard();
// re-throw the origin... |
9613e49f-5be6-4300-9fa6-0d7ca2c26b89 | 1 | public static TextShiftStrategy shiftInvardsByPosition(){
return new TextShiftStrategy() {
@Override
public double getShift( TextStrategyParameters parameters ) {
double position = parameters.getPosition();
Point2D normal = parameters.getPath().getNormalAt( position );
if( normal.getY() > 0 ){
... |
c6d332ea-9644-4125-82be-ce29c3b3883d | 3 | public Vector3d abs() {
if(x < 0) x = -x;
if(y < 0) y = -y;
if(z < 0) z = -z;
return this;
} |
27675bcc-4253-44a2-a3b7-3540702c2b1b | 1 | public void addElement(TreeValue value, int id) throws AlreadyExistException{
if (root != null) {
constructTree(root, value, id);
} else {
root = new TreeElement<>(value, id);
}
} |
d9bf438b-63e6-4780-81bb-31794bf9d225 | 2 | private void setSelectedProductComboboxItem(String productName) {
for (String str : comboBoxItems) {
if (str.equals(productName))
productComboBox.setSelectedItem(str);
}
} |
108c031c-cb40-4f4a-ae5b-2239a19b02f1 | 2 | public void logVelocityMessage( int level, String msg )
{
switch ( level )
{
// velocity info messages are too verbose, just consider them as debug messages...
// case INFO_ID:
// log.info( msg );
// break;
case WARN_ID:
... |
b3cc0312-750a-4896-ba4b-6fbc964248b4 | 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... |
b331b042-79a3-4918-87bf-ebc27eb6f59c | 0 | public void setIdPosControlTransacciones(int idPosControlTransacciones) {
this.idPosControlTransacciones = idPosControlTransacciones;
} |
df5171fb-3161-490c-8d8e-8b0dd70f1429 | 1 | private boolean jj_2_12(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_12(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(11, xla); }
} |
09cb21ab-5f86-4d37-8cb6-62a3a8d6aecc | 8 | private void compressStream(CompressionStream stream) {
if (benchmark) startTime = System.currentTimeMillis() ;
// Create the Huffman table.
huffmanTable = new HuffmanTable() ;
// Quantize the stream, compute deltas between consecutive elements if
// possible, and histogram the data length distribution.
stream.... |
66858908-2547-40a1-9082-568926a84b49 | 2 | private String[][] parseLines(List<String> lines) {
int wordsNum = lines.get(0).split("\\s+").length;
String[][] result = new String [lines.size()][wordsNum];
int count = 0;
for(String line: lines) {
String []words = line.split("\\s+");
for(int i=0; i<wordsNum; i+... |
48912fdf-a1cb-4bcb-a116-9e61e7060429 | 7 | public void checkUnits() {
Vector<WargusUnit> units = wp.getUnits();
boolean unactive = true;
for (int u : unitGroups.get(0)) {
for (WargusUnit w : units) {
String status = WargusStateImporter.statusToString(w.getStatus()[0]);
if (status != "idle" && w.getUnitID() == u)
{
unactive = false;
... |
66c92296-e426-4351-9264-d898874c4b08 | 5 | @Override
public float calculateDesire() {
float desire = 0f;
Actor actor = ai.getActor();
if (actor == null) {
return desire;
}
Player p = registry.getPlayerManager().getPlayerById(ai.getPlayer());
//if robot is in aggressive mode, it will alw... |
8e7245cf-6b64-47af-9e37-7e28ffd266cb | 3 | public synchronized void update(long time){
if(frames.size()>1){
animTime+=time;
if(animTime>=duration){
animTime%=duration;
currentFrame=0;
}
while(animTime>getFrame(currentFrame).endTime){
currentFrame++;
}
}
} |
f154d286-d35f-461a-a05e-f9fe3ef41337 | 5 | public Cashpoint openCashpoint(){
boolean opened = false;
Cashpoint cashpoint = null;
if(getOpenCashpoints().size() < 6){
for (int i = 1; i < 7 && opened == false; i++) {
cashpoint = findCashpointByNr(i);
if(cashpoint != null && cashpoint.isOpen() == false){
Thread m = new Thread(cashpoint);
... |
9373ef5e-8bef-4a12-9cf2-e0899fae6f28 | 1 | public void atualizar(Pesquisa pesquisa) throws Exception
{
String sql = "UPDATE pesquisa SET " +
"titulo = ?," +
"orientador = ?," +
"pesquisador_responsavel = ?," +
"ano_submissao = ?," +
"tempo_duracao = ?," +
"tipo = ?," +
"qualificacao = ?," +
"impacto_pesquisa = ?," +
"gerou... |
6e431f80-41bc-4d0c-9712-208e5dc76450 | 9 | public Boolean suoritaKomento() {
String vastaus = io.lueRivi().toLowerCase();
if (vastaus.isEmpty()) {
return true;
}
if (vastaus.equals("sulje")) {
return false;
}
if (vastaus.equals("viite")) {
luoViite();
} else if (vasta... |
c94d0a5a-0fbb-4958-bd44-ea50b73e2e63 | 1 | public void setDirected(boolean directed) {
this.directed = directed;
for (int i = 0; i < edges.getSize(); i++) {
edges.get(i).setDirected(directed);
}
} |
d98bc0b9-5582-4fa4-87b8-150510f13cb3 | 1 | @Override
public void cleanUp() {
// Iterate all of the children layers and remove their events
for (GameLayer gameLayer : gameLayers.values()) {
gameLayer.cleanUp();
}
KeyEventHandler.getInstance().removeEvents(this);
} |
abf6e552-d988-45f3-92e5-429a2aa22020 | 7 | public Transition<TransitionInput> findFirstValidTransitionFromState(State<TransitionInput> tailState, TransitionInput input) {
for(Transition<TransitionInput> transition : transitionsByTail.get(tailState)) {
if(transition.isValid(input)) {
return transition;
}
}
for(CompositeState<TransitionInput> com... |
b0a232c3-e5c3-4419-8cbf-a8c0d6fe9a60 | 2 | @Override
public void mousePressed(MouseEvent event) {
DockContainer dc = getDockContainer();
if (dc.getCurrentDockable() != mDockable) {
dc.setCurrentDockable(mDockable);
dc.acquireFocus();
} else if (!dc.isActive()) {
dc.acquireFocus();
}
} |
ef312d5b-eeb7-4ae7-b7cc-3e2c05ce7fbf | 4 | public Color getSelectedColor(int button)
{
switch (button)
{
case MouseEvent.BUTTON1:
return left;
case MouseEvent.BUTTON3:
return right;
default:
if ((button & (MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != 0) return left;
if ((button & (MouseEvent.BUTTON3_MASK | MouseEve... |
64ed7d0e-a7a9-4044-a8f7-7ccc712342f7 | 0 | public void setpage(byte [] array)
{
data = array;
} |
ae04d729-2aa3-4d52-bedb-63aac0ed119d | 4 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException{
String page;
try {
Criteria criteria = new Criteria();
String login = request.getParameter(JSP_USER_LOGIN);
Validator.validateLogin(login);
criteria.addParam(D... |
0455b4eb-833d-4e1b-9191-94938eb02228 | 5 | private boolean addPosition(KrakenState state, XYLocation kingLocation,XYLocation location,
ArrayList<KrakenMove> list,XYLocation finalLocation){
if (state.distance(kingLocation, location, finalLocation)){
if (state.isEmpty(finalLocation)){
list.add(new KrakenMove(location, finalLocation));
return fa... |
a7caf237-e018-48b8-af74-f01991c90921 | 8 | public void mouseClicked(MouseEvent e) {
if(paused){
if(buttons.get(0).isInside(e.getX(), e.getY())){
paused=false;
leftPressed = false;
rightPressed = false;
firePressed = false;
bombPressed = fals... |
5a9d9e42-f5ed-4e54-ab2f-53375f778e1e | 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... |
589fafe1-25c5-4f57-8dbf-8843e43a6921 | 2 | public void interactClick(int mod) {
if(!isActual()) return;
if (UI.instance.mapview != null) {
UI.instance.mainview.wdgmsg("itemact", JSBotUtils.getCenterScreenCoord(), position(),
mod, gob_id, position());
}
} |
ca81cd13-b3d0-43e4-a5f2-bae6851d1e29 | 1 | public void remove(EntradaBean oEntradaBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oEntradaBean.getId(), "entrada");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("EntradaDao.remove: Error: " + e.g... |
b1919081-b6a7-4a7f-8b8c-13150f3ce304 | 0 | @Column(name = "name")
@Id
public String getName() {
return name;
} |
8447b89c-24be-4c0d-a72d-9d6e8008f571 | 3 | public static String parseFileName(String s) {
String fileName = s;
fileName = fileName.replace('/', File.separatorChar);
fileName = fileName.replace('\\', File.separatorChar);
int i = fileName.lastIndexOf('.');
if (i > 0) {
fileName = fileName.substring(0, i).replace('.', File.se... |
f7e41845-b6df-47f3-a979-5ab588899fc3 | 0 | public void setPgenCounter(byte[] value) {
this.pgenCounter = value;
} |
79c57a2e-e361-418f-8ba3-b6a114ce3dd0 | 2 | public int compareTo(Object o) {
TreeElement other = (TreeElement) o;
if (leaf != other.leaf)
// files come after directories
return leaf ? 1 : -1;
return fullName.compareTo(other.fullName);
} |
8596f96a-07f7-42cc-aabe-90b5204f6b76 | 1 | public JSONArray optJSONArray(int index) {
Object o = opt(index);
return o instanceof JSONArray ? (JSONArray)o : null;
} |
53dbf5c8-5485-4550-8304-5c2c9af88823 | 4 | public void saveReward(int n, ItemStack itemStack)
{
if (!getMain().loot.isConfigurationSection("items." + n))
getMain().loot.createSection("items." + n);
if (itemStack == null)
itemStack = new ItemStack(Material.AIR);
ConfigurationSection data = getMain().loot.getConfigurationSection("items." + n);
d... |
a76fdcb2-dcd4-48c9-b93b-e56946c1c6a6 | 0 | public GroupObject(String name, String header, String footer) {
this.name = name;
this.header = header;
this.footer = footer;
} |
42e909f7-ec93-4476-bece-ae177c6a9250 | 7 | public Set<Integer> lookUp(final String key) {
final int len = key.length();
Set<Integer> result = new HashSet<Integer>();
// no point in checking if
// the word is longer than the longest
// word in the trie or if it is an empty word
if (charBuffer.length < len || len =... |
10230b60-55f1-462a-9114-b8db305f815b | 8 | public static boolean isOneEditDistance(String s, String t) {
int m = s.length(), n = t.length();
if (m > n)
return isOneEditDistance(t, s);
if (n - m > 1)
return false;
boolean firsttime = true;
int i = 0, j = 0;
while (i < m) {
if (s.charAt(i) != t.charAt(j)) {
if (!firsttime)
return fal... |
7c9af0b5-c7a5-4fb1-9dd5-ecad0f7c4e52 | 9 | public static int[][] reconstructQueue(int[][] people) {
if (people == null || people.length <= 1) {
return people;
}
Arrays.sort(people, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
return o1[0] == o2[0] ? o1[1] - o2[1] : o1[0] - o2[0];
}
});
int n = people.len... |
f585ddf3-6cc7-49a5-ac0e-2d14748ef05f | 2 | private static void returnPalindromes() {
setProvenPalindromes(new ArrayList<Integer>());
for (Integer integer : getProductOfThreeDigitIntegers()) {
if (isItPalindrome(integer)) {
getProvenPalindromes().add(integer);
}
}
} |
50c0b83d-8665-43e7-88fe-975fc2262e02 | 0 | public String getDescription() {
return description;
} |
8e5b2973-bcb2-4d5e-aa29-9a240b329ea3 | 7 | protected static InetAddress convertBindAddress(String value) throws Exception {
InetAddress retval=null;
Util.AddressScope addr_scope=null;
try {
addr_scope=Util.AddressScope.valueOf(value.toUpperCase());
}
catch(Throwable ex) {
}
... |
dc745848-2494-4d80-86e4-594a4a351b9e | 1 | @Test
public void jsonTransformEquality() throws InvalidJSONException, JSONException {
Position p1 = new Position(42.123, 45.456);
Position p2 = null;
p2 = new Position(p1.toJSON());
assertTrue((p1.getLatitude() == p2.getLatitude()) && p1.getLongitude() == p2.getLongitude());
} |
79413b6d-8070-4b9f-8b7c-47654ba2f400 | 5 | public void setCurrentFrameID(String id) {
int i = 0;
for (TextureFrame tex : textures) {
if (tex.id.equals(id)) {
break;
}
i++;
}
if (animationType == EnumAnimationType.STATE_RENDERED && i < textures.length) {
TextureFrame ... |
70c2ce7f-aaeb-41be-9f34-5d784bb9540d | 3 | public void setToIdentityMatrix() {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
m[i][j] = (i == j) ? 1 : 0;
} |
e4128ab2-7fe0-45e3-8c03-01aeee04ea54 | 3 | @Override
protected void afterEnteredFocus(FocusChangeDirection direction) {
if(items.isEmpty())
return;
if(direction == FocusChangeDirection.DOWN)
selectedIndex = 0;
else if(direction == FocusChangeDirection.UP)
selectedIndex = items.size() - 1;
... |
a47f4be9-a228-407c-8a60-2a95f05036fb | 7 | @SuppressWarnings({ "unchecked", "rawtypes" })
public static FieldGrammar<?> get(Field field) throws SecurityException, NoSuchMethodException
{
if(CharSequence.class.isAssignableFrom(field.getType()))
{
Regex annotation_regex = field.getAnnotation(Regex.class);
if(null != annotation_regex)
... |
d57bd943-e4e6-45fe-96bb-72c945a0ee71 | 5 | public Object getValue(ObjectFields of) {
switch (of.getType()) {
case "integer":
return of.getIntval();
case "long":
return of.getLongval();
case "double":
return of.getFloatval();
case "date":
retur... |
5c83c6ca-febb-470e-8cc3-b90566411b65 | 5 | private int parseInstruction(String line, int i)
{
//retrieve the instruction code from the string
String instr = getToken(line, i);
//Check for empty token (syntax error)
if (instr.length() == 0)
{
System.out.println("\nERROR (line " + m_lineNum + "): Empty toke... |
6e5e50f2-9e39-43f1-b111-06115417992b | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
c3c8ecd0-c304-4aef-a7c1-28638d049b2d | 2 | @Override
public void startObstacle(List<Element> elements, Element e) {
if (isActive() && e instanceof Player)
forceFieldConnection.incrementPlayerTrappedCount(((Player) e));
} |
58218701-139b-4690-801d-1442684f7ed1 | 2 | private void deleteGoal(int x, int y)
{
for(int i=0; i<Goals.size(); i++)
{
if(Math.sqrt(((x-Goals.elementAt(i)[0])*(x-Goals.elementAt(i)[0])) + ((y-Goals.elementAt(i)[1])*(y-Goals.elementAt(i)[1]))) <= 10)
{
Goals.remove(i);
return;
}
}
} |
39ef53ee-0731-4d09-91f7-440aa695ab10 | 3 | public int declareWinner() {
int winner;
if (redFood > blackFood) {
winner = 2;
} else if (blackFood > redFood) {
winner = 1;
} else if (blackFood == redFood) {
winner = 0;
} else {
winner = -1;
}
// Calculates winne... |
bce248ba-d33c-4fb5-83b0-210a59325eb3 | 0 | public CardsTesterJPanel() {
loadAllCardImagesAndSetUpCardDimensions();
addPanelsOfComponents();
addMouseListener(this);
reset();
} |
f1954cb5-bc5a-47ff-b1b1-d1acdc742205 | 3 | public int[] fetchStats()
{
Scanner sc = getFile();
if (sc == null) return null;
int total = 0;
int[] count = new int[precision];
while (sc.hasNextLine())
{
double ratio = getRatio(sc.nextLine());
if (ratio == 1) count[pre... |
33150e0e-86be-4947-a90f-a2d8c8f1a2dc | 3 | public boolean amatch(String ln, Int i) {
logger.fine("SEmult amatch() called on " + ln.charAt(i.get()));
boolean metMin = minimum == 0; // if 0 minimum, already met minimum.
for (int j=minimum; j<maximum && i.get()<ln.length(); j++) {
if (!target.amatch(ln, i))
break;
// else at least one matched, so w... |
a440de0e-16dd-4feb-b480-d3295319cab4 | 3 | private void searchJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchJButtonActionPerformed
String searchStr = inputJTextField.getText();
String searchCriteria = (String) searchCriteriaJComboBox.getSelectedItem();
infoJTextArea.setText(""); // clear the f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.