method_id
stringlengths 36
36
| cyclomatic_complexity
int32 0
9
| method_text
stringlengths 14
410k
|
---|---|---|
08af4cde-e133-4799-b717-adeb0aaea125 | 5 | private static void checkArgs() {
for (int i = 0; i < arguments.length; i++) {
if (arguments[i].contains("noLauncher")) doLauncher = false;
if (arguments[i].contains("noIntro")) doIntro = false;
if (arguments[i].contains("debug")) DEBUG = true;
if (arguments[i].contains("mute")) MUTE = true;
//if (arguments[i].contains("noFullScreen")) doFullscreen = false; // At the current time Fullscreen is not an option
}
} |
a8e80a84-8299-4999-b1b1-7df6905ab0ec | 3 | private boolean jj_3R_19() {
if (jj_scan_token(RETURN)) return true;
if (jj_3R_76()) return true;
if (jj_scan_token(SEMICOLON)) return true;
return false;
} |
a63f7bf2-0f0c-4356-ab2d-05a293c0c33c | 7 | private void txtcedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcedulaKeyTyped
char caracter = evt.getKeyChar();//Validacion del campo cedula
if (caracter >= '0' && caracter <= '9' || caracter == 8 || caracter == KeyEvent.VK_BACK_SPACE || caracter == KeyEvent.VK_CAPS_LOCK || caracter == KeyEvent.VK_SHIFT) {
} else {
evt.consume();
}
if (txtcedula.getText().length() >= 10) {
evt.consume();
}
}//GEN-LAST:event_txtcedulaKeyTyped |
c346bcd4-ff99-4055-b5a2-ec8158841ba8 | 6 | public static int insertMstxInfo(String info_title, String info_dis, String info_lon, String info_lat, String uid,
String info_sort, int info_price, int where, String mshotelName) {
int mid = MstxDao.getMaxNumber("mstx_info");
MstxDao.updateMaxNumber(3);// 将该字段值加1
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con
.prepareStatement("insert into mstx_info(mid,info_title,info_dis,info_lon,info_lat,uid,info_sort,info_price,hotel_name) values(?,?,?,?,?,?,?,?,?)");
if (where == 2) {// 手机来的
pstmt.setInt(1, mid);
pstmt.setString(2, info_title);
pstmt.setString(3, info_dis);
pstmt.setDouble(4, Double.parseDouble(info_lon));
pstmt.setDouble(5, Double.parseDouble(info_lat));
pstmt.setInt(6, Integer.parseInt(uid));
pstmt.setInt(7, Integer.parseInt(info_sort));
pstmt.setInt(8, info_price);
pstmt.setString(9, mshotelName);
} else {
pstmt.setInt(1, mid);
pstmt.setString(2, info_title);
pstmt.setString(3, info_dis);
pstmt.setDouble(4, Double.parseDouble(info_lon));
pstmt.setDouble(5, Double.parseDouble(info_lat));
pstmt.setInt(6, Integer.parseInt(uid));
pstmt.setInt(7, Integer.parseInt(info_sort));
pstmt.setInt(8, info_price);
pstmt.setString(9, mshotelName);
}
pstmt.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (con != null) {
con.close();
con = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return mid;
} |
f34bf061-5e38-4883-ab2b-fae2f258c0f3 | 1 | public static Object[] run(String query) throws ClassNotFoundException, SQLException {
System.out.println(query);
if (true) return null;
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/Forum?user=root&password=1234");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
return new Object[]{};
} |
100f8bb1-a687-4b11-92b7-e84c30491916 | 1 | public double repeatNFoldCrossValidation(Matrix features, Matrix labels, int n, int repetitions){
double mseTotal = 0.0;
long seed = System.currentTimeMillis();
for (int i = 0; i < repetitions; i++) {
Matrix shuffledFeatures = features.shuffle(new Random(seed));
Matrix shuffledLabels = labels.shuffle(new Random(seed));
mseTotal += this.nFoldCrossValidation(shuffledFeatures, shuffledLabels, n);
}
return mseTotal / repetitions;
} |
7518e1f5-88ef-4c7c-87e0-25e7603929b5 | 3 | public List<R> getResults() {
Iterator<TaskItem<R,C>> items = iterator();
List<R> results = new ArrayList<R>();
while(items.hasNext()) {
TaskItem<R,C> item = items.next();
if(item.future.isDone()) {
try {
results.add(item.future.get());
} catch(Exception e) {
throw new RuntimeException(e);
}
items.remove();
}
}
return results;
} |
fb293296-f04b-4bda-a52b-2c12abf17df6 | 4 | public static void main(String[] args) {
// TODO code application logic here
//10. Дан двумерный массив целых чисел. Сформировать одномерный
//массив, каждый элемент которого равен наибольшему по модулю
//элементу соответствующего столбца двумерного массива.
System.out.println("*** Задание 10 ***");
int count_line = 3;
int count_column = 8;
int[][] arr = new int[count_line][count_column];
int[] abarr = new int[count_column];
for (int line = 0; line < arr.length; line++) {
arr[line] = fillRandomInt(count_column, -10, 10, 1);
}
//////////
int num=0;
for (int j = 0; j < arr[0].length; j++) {
for (int[] arr1 : arr) {
if (Math.abs(arr1[j]) >= num) {
abarr[j] = arr1[j];
}
num = Math.abs(arr1[j]);
}
}
show(arr);
System.out.println("");
show(abarr);
} |
c52ff6b2-6f93-48dc-b717-12fc38130aa5 | 0 | public void addMessage(IMessage message) {
history.add(message);
setChanged();
notifyObservers(ModelNotification.MESSAGE_RECEIVED);
} |
94381d0c-e2f9-4c4a-9ee2-30ad17e72a4a | 6 | public PlaySound(GbAudio audio) {
int[] samples = audio.samples;
int[] soValues = audio.soValues;
if (samples.length != soValues.length * 2)
throw new IllegalArgumentException("samples length " + samples.length + " does not match twice so length " + soValues.length);
if (soValues.length < 1)
throw new IllegalArgumentException("need at least 1 set of samples.");
System.out.println("create PlaySound with " + soValues.length + " sample pairs.");
inputMap.put(40, getSampleOrPadding(samples, 0) ^ 0xf);
for (int i = 0; i < 15; i++) {
inputMap.put(60 + 60*i, toJoypadInput2(getSampleOrPadding(samples, 2*i + 1)));
inputMap.put(76 + 60*i, toJoypadInput2(getSampleOrPadding(samples, 2*i + 2)));
}
int curCycles = 1520;
for (int i = 0; i < soValues.length; i++) {
inputMap.put(curCycles, toJoypadInput2(soValues[i]));
inputMap.put(curCycles + 36, toJoypadInput2(getSampleOrPadding(samples, 2*i + 31)));
inputMap.put(curCycles + 52, toJoypadInput2(getSampleOrPadding(samples, 2*i + 32)));
inputMap.put(curCycles + 884, i+1 < soValues.length ? 1 : 0);
curCycles += 912;
}
cycleCount = curCycles + 28;
if (cycleCount != getCycleCount(soValues.length))
throw new RuntimeException("cycle count " + cycleCount + "does not match calculation of " + getCycleCount(soValues.length));
} |
709d34a2-b8f7-4fc9-9e20-66df6ad76eae | 4 | private void autonomousScoreFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_autonomousScoreFocusLost
// TODO add your handling code here:
try{
Integer.parseInt(autonomousScore.getText());
}
catch(Exception e){
autonomousScore.setText("0");
}
if((Integer.parseInt(autonomousScore.getText())) == 0 ){
}else if((Integer.parseInt(autonomousScore.getText()))>0){
autonomous.setSelected(true);
}else if((Integer.parseInt(autonomousScore.getText()))<0){
autonomousScore.setText("0");
}
}//GEN-LAST:event_autonomousScoreFocusLost |
8d4ecdc6-63dd-48ad-9d3c-000b7fb58061 | 8 | public void stop() {
// Pass on to upstream beans
if (m_trainingProvider != null && m_trainingProvider instanceof BeanCommon) {
((BeanCommon)m_trainingProvider).stop();
}
if (m_testProvider != null && m_testProvider instanceof BeanCommon) {
((BeanCommon)m_testProvider).stop();
}
if (m_dataProvider != null && m_dataProvider instanceof BeanCommon) {
((BeanCommon)m_dataProvider).stop();
}
if (m_instanceProvider != null && m_instanceProvider instanceof BeanCommon) {
((BeanCommon)m_instanceProvider).stop();
}
} |
aaf29c0c-2e53-40f8-9ea7-115becb8fff1 | 9 | public Wave07(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 75; i++){
if(i < 5){
if(i % 2 == 0)
add(m.buildMob(MobID.RATTATA));
else
add(m.buildMob(MobID.PIDGEY));
}
else if (i > 5 && i < 45){
if(i % 2 == 0)
add(m.buildMob(MobID.PIDGEY));
else
add(m.buildMob(MobID.SPEAROW));
}
else if(i > 45 && i < 72){
if(i % 2 == 0)
add(m.buildMob(MobID.MANKEY));
else
add(m.buildMob(MobID.SANDSHREW));
}
else
add(m.buildMob(MobID.JIGGLYPUFF));
}
} |
56a2a56a-da9e-404c-8cae-80939cef1e96 | 5 | public void euthanize() {
ArrayList<Fish> magikarps = new ArrayList<Fish>();
for (Fish a : fishies) {
if (a.getAge() == a.getMaxAge()) {
a.setHealth(0);
if (a instanceof Magikarp) {
magikarps.add(a);
}
}
}
if (magikarps.size() > 0) {
for (int x = 0; x < magikarps.size(); x++) {
fishies.add(new Gyarados(magikarps.get(x).getX(),
magikarps.get(x).getY(),
bounds));
}
}
} |
87990619-6935-4013-9792-05047dcc81e5 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Jogador other = (Jogador) obj;
if (posicao == null) {
if (other.posicao != null)
return false;
} else if (!posicao.equals(other.posicao))
return false;
return true;
} |
49c1d8f6-9036-46dd-995e-362765a66b05 | 3 | @Override
public double get(int i, int j) {
outOfBound(i - 1, j - 1);
for (Element e : elems) {
accessCount += 1; // access auf das Element
if (e.getI() == i && e.getJ() == j) {
return e.getValue();
}
}
return 0.0;
} |
a6b90ad7-f354-47fa-acb4-9383bd4b7a0d | 8 | @Override
public boolean equals(Object that) {
if (that == null) {
return false;
}
if (that.getClass() != this.getClass()) {
return false;
}
SpriteElement thatSprite = (SpriteElement) that;
return this.mAlignX == thatSprite.mAlignX && this.mAlignY == thatSprite.mAlignY
&& this.mToOponent == thatSprite.mToOponent && this.mImagePath.equals(thatSprite.mImagePath)
&& this.mIndex == thatSprite.mIndex && this.mScale == thatSprite.mScale && this.mVariableName.equals(thatSprite.mVariableName);
} |
e69650eb-5869-4b77-8fc4-621d7affc85d | 3 | public static IautosStatusCode getByDesc(String desc) {
if (null == desc) {
throw new IllegalArgumentException(
"IautosStatusCode desc is null");
}
for (IautosStatusCode iautosStatusCode : IautosStatusCode.values()) {
if (iautosStatusCode.getDesc().equals(desc)) {
return iautosStatusCode;
}
}
throw new IllegalArgumentException(desc
+ " match non IautosStatusCode");
} |
78febfba-aaf5-4007-9a66-8849c9cbb8ca | 9 | protected int computeScore () throws IncompatibleScoringSchemeException
{
int[] array;
int rows = seq1.length()+1, cols = seq2.length()+1;
int r, c, tmp, ins, del, sub, max_score;
// keep track of the maximum score
max_score = 0;
if (rows <= cols)
{
// goes columnwise
array = new int [rows];
// initiate first column
for (r = 0; r < rows; r++)
array[r] = 0;
// calculate the similarity matrix (keep current column only)
for (c = 1; c < cols; c++)
{
// set first position to zero (tmp hold values
// that will be later moved to the array)
tmp = 0;
for (r = 1; r < rows; r++)
{
ins = array[r] + scoreInsertion(seq2.charAt(c));
sub = array[r-1] + scoreSubstitution(seq1.charAt(r), seq2.charAt(c));
del = tmp + scoreDeletion(seq1.charAt(r));
// move the temp value to the array
array[r-1] = tmp;
// choose the greatest (or zero if all negative)
tmp = max (ins, sub, del, 0);
// keep track of the maximum score
if (tmp > max_score) max_score = tmp;
}
// move the temp value to the array
array[rows - 1] = tmp;
}
}
else
{
// goes rowwise
array = new int [cols];
// initiate first row
for (c = 0; c < cols; c++)
array[c] = 0;
// calculate the similarity matrix (keep current row only)
for (r = 1; r < rows; r++)
{
// set first position to zero (tmp hold values
// that will be later moved to the array)
tmp = 0;
for (c = 1; c < cols; c++)
{
ins = tmp + scoreInsertion(seq2.charAt(c));
sub = array[c-1] + scoreSubstitution(seq1.charAt(r), seq2.charAt(c));
del = array[c] + scoreDeletion(seq1.charAt(r));
// move the temp value to the array
array[c-1] = tmp;
// choose the greatest (or zero if all negative)
tmp = max (ins, sub, del, 0);
// keep track of the maximum score
if (tmp > max_score) max_score = tmp;
}
// move the temp value to the array
array[cols - 1] = tmp;
}
}
return max_score;
} |
139c37ac-09b9-45ee-941c-fa10ef9ad849 | 0 | private String getNameTypeObj(String objName) {
return objName.substring(nameGameWorld.length());
} |
4509b658-8765-4522-881c-35a50d716b65 | 3 | @Override
public void render(Drawer drawer) {
for (int x = 0; x < tileColumns; x++) {
for (int y = 0; y < tileRows; y++) {
if (tiles[x][y] != null) {
drawer.draw(tiles[x][y], (x * tileWidth) + getRenderableX(), (y * tileHeight) + getRenderableY());
}
}
}
} |
6cfa3f74-fa98-4619-9c3e-9721409929ac | 0 | public void countTail(){
//for(int i = 0; i < m.length;i++){
//if(m[i].equals("Tail")){
countT++;
//}
//}
} |
f3d45263-9862-448f-8699-5f904785b69a | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i != m_classIndex)) {
FString.append((m_starting[i] + 1));
didPrint = true;
}
if (i == (m_starting.length - 1)) {
FString.append("");
}
else {
if (didPrint) {
FString.append(",");
}
}
}
return FString.toString();
} |
741030f1-bd4d-4722-9fe1-fefce65512d0 | 0 | public ViewHandler() {
mainPage = new MainPage("Computer Test Programe");
mainPage.setJMenuBar(new CbtMenuBar());
} |
dc3b2efb-dc33-4378-bb81-3f5084fb99f6 | 6 | private static String codeAnswerAux(String answer,String question){
question=question.replace("[???]", answer);
MainInfo.submittedQuestion = question;
log.finer("\n"+question);
try {
try {checkForbiddenKeyWords(answer);}
catch (Error e) {
return "Wrong! Try again.\n You are trying to do something that is forbidden\n" +
getStackTrace(e);
}
try{balancedParentesis(answer,0);}
catch(Error e){
return "Wrong! Try again.\n Have you used a large amount of open parentesis?"
+ "Otherwise, you could find the following message useful:\n"+getStackTrace(e);
}
catch(RuntimeException e){
return "Wrong! Try again.\nYou are only allowed to"
+ " use answers with balanced parentesis."
+ "There was a parsing error:\n"+getStackTrace(e);
}
try {
System.out.println("ready to create class");
ClassLoader cl = InMemoryJavaCompiler.compile(Arrays.asList(
new InMemoryJavaCompiler.SourceFile("Exercise", question)
));
//cl.setDefaultAssertionStatus(true);
System.out.println("created class");
RunningUtils.runMainStrictSecurity(cl, "Exercise",5000);
System.out.println("created class and run");
return "";//TODO: generate good feedback
} catch (CompilationError e) {
return "Wrong! Try again.\nThere was a compilation error:\n"+getStackTrace(e);
} catch (InvocationTargetException e) {
return "Wrong! Try again.\nThere was an exception:\n"+getStackTrace(e.getCause());
}
}catch(Throwable e){
return "Unrecognized error, you may find this message useful:\n"+getStackTrace(e);
}
} |
b8287a65-168e-4565-ad87-a59e639645f0 | 2 | public Map<String, Groop> getGroopMap()
{
if (groops.size() == 0)
try
{
execute();
}
catch (SQLException e)
{
e.printStackTrace();
}
return groops;
} |
0dda9e20-5382-41cb-a8f0-cd5fc3c4276e | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = sb.length() - 3;
if (i >= 0 && sb.charAt(i) == ']' &&
sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') {
sb.setLength(i);
return sb.toString();
}
}
} |
58b139f3-2d41-4a00-abc2-26c2463dcaf3 | 2 | public String encrypt(String plainTextStr) {
final byte[] cipherTextBytes;
final Cipher cipher;
final SecretKeySpec SKSAESKey;
final int blockSize;
final byte[] ivBytes;
final SecureRandom random;
final IvParameterSpec iv;
final byte[] ivWithCipherTextBytes;
final byte[] plainTextBytes = plainTextStr.getBytes(UTF8Charset);
final String cipherTextBase64Str;
// TODO clean correct/cleanup try/catch
try {
cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SKSAESKey = new SecretKeySpec(AESKey, "AES");
blockSize = cipher.getBlockSize();
ivBytes = new byte[blockSize];
random = SecureRandom.getInstance("SHA1PRNG");
random.nextBytes(ivBytes);
iv = new IvParameterSpec(ivBytes);
cipher.init(Cipher.ENCRYPT_MODE, SKSAESKey, iv);
cipherTextBytes = cipher.doFinal(plainTextBytes);
ivWithCipherTextBytes = new byte[ivBytes.length + cipherTextBytes.length];
System.arraycopy(ivBytes, 0, ivWithCipherTextBytes, 0, blockSize);
System.arraycopy(cipherTextBytes,
0,
ivWithCipherTextBytes,
blockSize,
cipherTextBytes.length);
cipherTextBase64Str = DatatypeConverter.printBase64Binary(ivWithCipherTextBytes);
return cipherTextBase64Str;
} catch (InvalidKeyException e) {
System.out.println("Bad pass phrase: " + e);
return null;
} catch (GeneralSecurityException e) {
System.out.println("Error while encrypting: " + e);
return null;
}
} |
3a42b260-0058-48f8-8d12-71c979b309fd | 4 | private Case getNextCase() {
Case tete = this.listeCasesSerpent.getFirst();
switch(this.directionActuelle) {
case VERS_LE_HAUT :
return new Case(tete.getPosX(), tete.getPosY()-1);
case VERS_LA_DROITE :
return new Case(tete.getPosX()+1, tete.getPosY());
case VERS_LE_BAS :
return new Case(tete.getPosX(), tete.getPosY()+1);
case VERS_LA_GAUCHE :
return new Case(tete.getPosX()-1, tete.getPosY());
}
return null;
} |
52bb4f6f-b1cf-4366-806c-0c4f199ab803 | 8 | public void update() {
super.update();
if (level.player != null) {
int xd = level.player.x - x;
int yd = level.player.y - y;
Rectangle r3 = level.player.getBounds();
Rectangle r2 = getBounds();
//if (xd * xd + yd * yd < 50 * 50) {
//if(!intersects(level.player.x,level.player.y,(level.player.x + 16),(level.player.y + 16))){
if (!r3.intersects(r2)) {
xa = 0;
ya = 0;
if (xd < 0) xa = -1;
if (xd > 0) xa = +1;
if (yd < 0) ya = -1;
if (yd > 0) ya = +1;
}
else{
xa = 0;
ya = 0;
level.player.gethurt();
}
//}
if(xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walking = false;
}
//System.out.println("alien: " + health);
}
} |
160b8fa7-69bb-49f2-9e9e-f84f8676d1c2 | 5 | public static TileFlags swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigValue) {
return swigValues[i];
}
}
throw new IllegalArgumentException("No enum " + TileFlags.class + " with value " + swigValue);
} |
4a2feb69-e2bd-41cd-b2e2-5bab0994952c | 1 | protected void addLine(String line) {
if (line == null) {
IllegalArgumentException iae = new IllegalArgumentException("The line must not be null!");
Main.handleUnhandableProblem(iae);
}
this.uiFileLines.add(line);
} |
292ff19f-2b7e-4e3f-89f3-ea94b77d5ee2 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
return false;
return true;
} |
17db8478-e8ec-4f24-87cd-b40c6f9f204e | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 56
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 56
// [, line 58
bra = cursor;
// substring, line 58
among_var = find_among(a_0, 3);
if (among_var == 0)
{
break lab1;
}
// ], line 58
ket = cursor;
switch(among_var) {
case 0:
break lab1;
case 1:
// (, line 59
// <-, line 59
slice_from("i");
break;
case 2:
// (, line 60
// <-, line 60
slice_from("u");
break;
case 3:
// (, line 61
// next, line 61
if (cursor >= limit)
{
break lab1;
}
cursor++;
break;
}
continue replab0;
} while (false);
cursor = v_1;
break replab0;
}
return true;
} |
a101f5df-11a0-4bdb-a7c5-c20ed3ef0a20 | 3 | public String toStringPositionPossible()
{
// affiche le tableau des positions possible les & represente les cases possibles
int cpt = 0;
StringBuffer res = new StringBuffer("");
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
{
if (cpt == 8)
cpt = 0;
cpt++;
res.append(PositionPossible[i][j]);
}
return res.toString();
} |
2f9d03b9-6a6e-4d13-80bf-4628965cadc3 | 0 | public boolean isActive() {
return isActive;
} |
dfadb141-e733-4648-a596-0128182d68f6 | 8 | private static void generateSearchMethod(ClassFile cf,
Class beanType,
BeanProperty[] properties)
{
MethodInfo mi;
{
TypeDesc[] params = {TypeDesc.OBJECT, TypeDesc.OBJECT};
mi = cf.addMethod(Modifiers.PUBLIC, "hasPropertyValue", TypeDesc.BOOLEAN, params);
}
mi.markSynthetic();
CodeBuilder b = new CodeBuilder(mi);
LocalVariable beanVar = b.getParameter(0);
b.loadLocal(beanVar);
b.checkCast(TypeDesc.forClass(beanType));
b.storeLocal(beanVar);
LocalVariable valueVar = b.getParameter(1);
// If search value is null, only check properties which might be null.
b.loadLocal(valueVar);
Label searchNotNull = b.createLabel();
b.ifNullBranch(searchNotNull, false);
for (BeanProperty bp : properties) {
if (bp.getType().isPrimitive()) {
continue;
}
b.loadLocal(beanVar);
b.invoke(bp.getReadMethod());
Label noMatch = b.createLabel();
b.ifNullBranch(noMatch, false);
b.loadConstant(true);
b.returnValue(TypeDesc.BOOLEAN);
noMatch.setLocation();
}
b.loadConstant(false);
b.returnValue(TypeDesc.BOOLEAN);
searchNotNull.setLocation();
// Handle search for non-null value. Search non-primitive properties
// first, to avoid object conversion.
// Params to invoke Object.equals.
TypeDesc[] params = {TypeDesc.OBJECT};
for (int pass = 1; pass <= 2; pass++) {
for (BeanProperty bp : properties) {
boolean primitive = bp.getType().isPrimitive();
if (pass == 1 && primitive) {
continue;
} else if (pass == 2 && !primitive) {
continue;
}
b.loadLocal(valueVar);
b.loadLocal(beanVar);
b.invoke(bp.getReadMethod());
b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT);
b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params);
Label noMatch = b.createLabel();
b.ifZeroComparisonBranch(noMatch, "==");
b.loadConstant(true);
b.returnValue(TypeDesc.BOOLEAN);
noMatch.setLocation();
}
}
b.loadConstant(false);
b.returnValue(TypeDesc.BOOLEAN);
} |
bcd4d734-d762-4941-88ef-aa3a95c8e206 | 6 | public static boolean canCarry(Actor carries, Actor actor) {
if (carries == null || actor == null) return false ;
for (Mobile m : actor.aboard().inside()) {
if (m instanceof Suspensor) {
final Suspensor s = (Suspensor) m ;
if (s.passenger == actor) {
if (s.followed == carries) return true ;
return false ;
}
}
}
return true ;
} |
51e1cf99-aa64-4092-86e0-f2c8634e223b | 6 | public static void transferSynonyms(Stella_Object oldobject, Stella_Object newobject) {
{ List originatedprops = Logic.originatedPropositions(oldobject);
{ LogicObject synonym = null;
Cons iter000 = Logic.getSynonyms(oldobject);
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
synonym = ((LogicObject)(iter000.value));
{ boolean foundP000 = false;
{ Proposition prop = null;
Iterator iter001 = Logic.allTrueDependentPropositions(synonym, Logic.SGT_PL_KERNEL_KB_SYNONYM, false);
loop001 : while (iter001.nextP()) {
prop = ((Proposition)(iter001.value));
if (Stella_Object.eqlP((prop.arguments.theArray)[0], oldobject) &&
(((prop.arguments.theArray)[1] == synonym) &&
(!originatedprops.membP(prop)))) {
foundP000 = true;
break loop001;
}
}
}
if (foundP000) {
Logic.objectSurrogate(synonym).surrogateValue = newobject;
}
else {
Logic.objectSurrogate(synonym).surrogateValue = null;
}
}
}
}
}
} |
d83e7d4a-8e06-47fe-bc97-e42048570183 | 1 | @Override
public void addUmlDiagramListener( UmlDiagramListener listener ) {
if( listener == null ) {
throw new IllegalArgumentException( "listener must not be null" );
}
umlDiagramListeners.add( listener );
} |
01fc98a3-70e6-44c1-8a24-6cc533e5a93d | 3 | private ByteBuffer decodeStream(Set<String> filterLimits) throws IOException {
ByteBuffer outStream = null;
// first try the cache
if (decodedStream != null && filterLimits.equals(decodedStreamFilterLimits)) {
outStream = (ByteBuffer) decodedStream.get();
}
// no luck in the cache, do the actual decoding
if (outStream == null) {
stream.rewind();
outStream = PDFDecoder.decodeStream(this, stream, filterLimits);
decodedStreamFilterLimits = new HashSet<String>(filterLimits);
decodedStream = new SoftReference(outStream);
}
return outStream;
} |
e80bee9e-77e9-4f62-a0f9-569c283541c0 | 2 | public LocalInfo findSlot(int slot) {
for (int i = 0; i < count; i++)
if (locals[i].getSlot() == slot)
return locals[i];
return null;
} |
faddb8cc-dbf8-4736-a311-9189945f5cbe | 4 | public void executeSetMethod(Object instance, Method method, Object value) {
if(method == null)
return;
try {
method.invoke(instance, value);
} catch (IllegalArgumentException e) {
System.err.println("<ClassInspect> Failed to execute SET Method <" + method.getName() + ">. Arguments passed to method is wrong.");
} catch (IllegalAccessException e) {
System.err.println("<ClassInspect> Failed to execute SET Method <" + method.getName() + ">. Method isn't marked as public.");
} catch (InvocationTargetException e) {
System.err.println("<ClassInspect> Failed to execute SET Method <" + method.getName() + ">. Exception: \n" + e.getMessage());
}
} |
d3c298c7-ae71-4152-aba2-8189192b44f8 | 4 | public void searchEngineMenu1(DataSource ds) {
System.out.println("\n"
+ "Enter Name or health care number of patient: ");
Scanner s1 = new Scanner(System.in);
String patient_info = s1.nextLine();
try {
ResultSet rs = ds.searchEngineInfo(patient_info);
int counter = 0;
while (rs.next()) {
if (counter == 0) {
System.out
.println("HEALTH CARE NO \t PATIENT NAME \t TEST NAME \t TEST DATE \t RESULT");
}
System.out.println(rs.getInt(2) + "\t\t" + rs.getString(1)
+ "\t\t" + rs.getString(8) + "\t\t"
+ rs.getDate("test_date") + "\t"
+ rs.getString("result"));
counter ++;
}
if (counter == 0) {
System.out.println("Nothing.");
}
} catch (SQLException e) {
}
} |
57b0aa34-353c-412e-a7f2-3281860a8513 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void PlayerDamage(EntityDamageEvent e) {
if (e.getCause() == DamageCause.FALL) {
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity().getWorld()
.getName())) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (PermissionHandler.has(p, PermissionNode.NOFALL)) {
e.setDamage(0);
return;
}
}
}
}
} |
48d13938-4c06-4656-a302-43d3072f883d | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
new GZIPInputStream( new FileInputStream( filePath)))) :
new BufferedReader(new FileReader(new File(filePath
)));
String nextLine = reader.readLine();
int numDone =0;
while(nextLine != null)
{
StringTokenizer sToken = new StringTokenizer(nextLine, "\t");
String sample = sToken.nextToken().replace(".fastatoRDP.txt.gz", "");
String taxa= sToken.nextToken();
int count = Integer.parseInt(sToken.nextToken());
if( sToken.hasMoreTokens())
throw new Exception("No");
HashMap<String, Integer> innerMap = map.get(sample);
if( innerMap == null)
{
innerMap = new HashMap<String, Integer>();
map.put(sample, innerMap);
}
if( innerMap.containsKey(taxa))
throw new Exception("parsing error " + taxa);
innerMap.put(taxa, count);
nextLine = reader.readLine();
numDone++;
if( numDone % 1000000 == 0 )
System.out.println(numDone);
}
return map;
} |
abc2ce3c-50c7-43d5-80ce-62bda507256c | 0 | private List<ISocketServerConnection> getConnections() {
return connections;
} |
a3f0b91e-caf4-40fa-9f39-bc90c91d0217 | 0 | public Milk(String brand, Integer price, Integer volume) {
this.brand = brand;
this.volume = volume;
this.price = price;
init();
} |
92104cab-2d97-4bf4-9810-3f0eda5e77f6 | 9 | void remove() {
final int oldn = n;
n -= k;
if (k > n) {
k = n;
indices = new int[k];
for (int i = 0; i < k; ++i) {
indices[i] = i;
}
} else if (n == k) {
if (indices[0] == 0) {
for (int i = 0; i < k - 1; ++i) {
indices[i] = i;
}
indices[k - 1] = k - 2;
} else {
for (int i = 0; i < k; ++i) {
indices[i] = i;
}
}
} else {
final int emptyRightSpots = oldn - k - indices[0];
if (emptyRightSpots < k) {
indices = new int[++k];
for (int i = 1; i < k; ++i) {
indices[i] = i;
}
} else {
for (int i = 1, j = indices[0] + 1; i < k; ++i, ++j) {
indices[i] = j;
}
}
--indices[k - 1];
}
} |
8b33031f-ac04-446a-8e1b-aef27d972a49 | 6 | static void orderHand(Hand testHand)
{
while (true){
for (int x = 1; x < testHand.size();x++){
if (testHand.get(x).getValue() < testHand.get(x-1).getValue())
{
Card card1 = testHand.get(x);
Card card2 = testHand.get(x-1);
testHand.setElementAt(card2, x);
testHand.setElementAt(card1, x-1);
}
}
int count = 0;
for (int x = 1; x < testHand.size();x++){
if (testHand.get(x).getValue() < testHand.get(x-1).getValue())
count++;
}
if (count == 0) break;
}
} |
4d7910b1-f072-4851-b3eb-a71279981dc2 | 5 | @Override
public int span(int row, int column) {
switch (column) {
case 0:
SpanInfo si1 = columnMap.get(0).get(row);
return si1.num;
case 1:
case 2:
case 3:
case 6:
SpanInfo si2 = columnMap.get(2).get(row);
return si2.num;
default:
return 1;
}
} |
872de60e-892b-48e4-b815-f350b6d20071 | 1 | public int romanToInt(String s) {
int value =0;
for(int i =0; i< s.length();i++){
System.out.println(s.charAt(i));
value += getValue(s,i);
}
return value;
} |
683ba2bc-3a58-4d48-b632-6025a32cec3b | 6 | public static void enemyMeleeAttackPlayer(Enemy me, Polygon p)
{
boolean[] hits = {false, false, false, false};
boolean contact = false;
if(p == null)
{
//System.out.println("fuck");
}
if(intersectionOf2Shapes(p, CoreClass.mainCharacter.getUpBox()))
{
hits[0] = true;
contact = true;
}
if(intersectionOf2Shapes(p, CoreClass.mainCharacter.getDownBox()))
{
hits[1] = true;
contact = true;
}
if(intersectionOf2Shapes(p, CoreClass.mainCharacter.getRightBox()))
{
hits[2] = true;
contact = true;
}
if(intersectionOf2Shapes(p, CoreClass.mainCharacter.getLeftBox()))
{
hits[3] = true;
contact = true;
}
if(contact == true)
{
System.out.println("enemy hit");
CoreClass.mainCharacter.attacked(me.getAttack(), hits);
}
} |
3e6e7da4-f58e-40ce-9aef-42fa30a3f06f | 4 | public void getNeighbors(int x, int y){
int reps = culture[x][y].getParameter("HoodSize");
if(reps == 0){return;}
int[] info = new int[reps];
for(int d = 0; d <= reps-1; d++){
int tempx = checkAddress("X", culture[x][y].getParameter("NextX"));
tempx = mothership.checkLoc("X", tempx);
int tempy = checkAddress("Y", culture[x][y].getParameter("NextY"));
tempy = mothership.checkLoc("Y", tempy);
if(tempx == -1 || tempy == -1){info[d] = 0;}
else{info[d] = mothership.state[tempx][tempy];}
}
culture[x][y].setNeighbors(info);
} |
ce0e0fd2-d326-43ea-a202-1b3ebe6dfe73 | 8 | @Override
protected void processpacketforward(SimEvent ev) {
// search for the host and packets..send to them
if (uplinkswitchpktlist != null) {
for (Entry<Integer, List<NetworkPacket>> es : uplinkswitchpktlist.entrySet()) {
int tosend = es.getKey();
List<NetworkPacket> hspktlist = es.getValue();
if (!hspktlist.isEmpty()) {
// sharing bandwidth between packets
double avband = uplinkbandwidth / hspktlist.size();
Iterator<NetworkPacket> it = hspktlist.iterator();
while (it.hasNext()) {
NetworkPacket hspkt = it.next();
double delay = 1000 * hspkt.pkt.data / avband;
this.send(tosend, delay, CloudSimTags.Network_Event_UP, hspkt);
}
hspktlist.clear();
}
}
}
if (packetTohost != null) {
for (Entry<Integer, List<NetworkPacket>> es : packetTohost.entrySet()) {
List<NetworkPacket> hspktlist = es.getValue();
if (!hspktlist.isEmpty()) {
double avband = downlinkbandwidth / hspktlist.size();
Iterator<NetworkPacket> it = hspktlist.iterator();
while (it.hasNext()) {
NetworkPacket hspkt = it.next();
// hspkt.recieverhostid=tosend;
// hs.packetrecieved.add(hspkt);
this.send(getId(), hspkt.pkt.data / avband, CloudSimTags.Network_Event_Host, hspkt);
}
hspktlist.clear();
}
}
}
// or to switch at next level.
// clear the list
} |
3aa13895-bcfd-431b-94d9-c3db48ff87fc | 4 | public static void main(String[] args) {
for (int z = 997; z >= 335; z--) {
for (int y = (1000 - z - 1); y + z <= 999 && ((1000 - (y + z)) < y); y--) {
int x = 1000 - (y + z);
if (x*x + y*y == z*z) {
System.out.println(x * y * z);
}
}
}
} |
f817faf2-4695-4875-ac1f-23d1d8cbdcb9 | 0 | public ArrayList<Account> getAccounts(){ return accountsCatalog; } |
0a0bdf7b-8b3f-44c5-a650-acc401220129 | 9 | @Override
public List<Environmental> removeSellableProduct(String named, MOB mob)
{
final Vector<Environmental> V=new Vector<Environmental>();
final Environmental product=removeStock(named,mob);
if(product==null)
return V;
V.addElement(product);
if(product instanceof Container)
{
DoorKey foundKey=null;
final Container C=((Container)product);
for(final ShelfProduct SP : storeInventory)
{
final Environmental I=SP.product;
if((I instanceof Item)&&(((Item)I).container()==product))
{
if((I instanceof DoorKey)&&(((DoorKey)I).getKey().equals(C.keyName())))
foundKey=(DoorKey)I;
((Item)I).unWear();
V.addElement(I);
storeInventory.remove(SP);
((Item)I).setContainer(C);
}
}
if((C.isLocked())&&(foundKey==null))
{
final String keyName=Double.toString(Math.random());
C.setKeyName(keyName);
C.setDoorsNLocks(C.hasADoor(),true,C.hasADoor(),C.hasALock(),false,C.defaultsLocked());
final DoorKey key=(DoorKey)CMClass.getItem("StdKey");
key.setKey(keyName);
key.setContainer(C);
V.addElement(key);
}
}
return V;
} |
d3785f7b-a755-4552-b3fc-b8fff2bbf805 | 0 | @Override
public void close() {
hide();
} |
c707a9c9-9c74-45e6-b044-4ceed3b8d452 | 7 | public int compareTo(Object arg0) {
DataRow row = (DataRow) arg0;
DataHeader header = getTable().getHeader();
DataColumn column;
int result = 0;
if (header.isDefaultSort()) {
for (int i = 0; i < header.getColumnCount(); i++) {
column = header.getColumn(i);
if (column.isSorted()) {
result = header.compareColumnValues(i, column.isSortDescending(), getValue(i), row.getValue(i));
if (result != 0)
break;
}
}
} else {
column = header.getResortedColumn();
int i = column.getPosition();
result = header.compareColumnValues(i, column.isResortedDescending(), getValue(i), row.getValue(i));
if (result == 0 && column.isSecondaryResort()) {
boolean secondaryResortDescending = column.isSecondaryResortDescending();
i = column.getSecondaryResortColumnIndex();
column = header.getColumn(i);
if (column != null) {
result = header.compareColumnValues(i, secondaryResortDescending, getValue(i), row.getValue(i));
}
}
}
return result;
} |
ae51a779-511e-44f6-966e-dc8cbec78aef | 8 | @Test
public void testIterator() {
ThriftyList<Integer> list = new ThriftyList<Integer>();
ListIterator<Integer> i = list.listIterator();
try {
i.next();
Assert.fail();
} catch (NoSuchElementException e) {
}
try {
i.remove();
Assert.fail();
} catch (IllegalStateException e) {
}
int testCount = 100;
i = list.listIterator();
for (int j = 0; j < testCount; j++) {
i.add(j);
}
for (int j = testCount - 1; j >= 0; j--) {
Assert.assertEquals(j, i.previousIndex());
Assert.assertEquals(Integer.valueOf(j), i.previous());
}
for (int j = 0; j < testCount; j++) {
Assert.assertTrue(i.hasNext());
Integer o = list.get(j);
Assert.assertEquals(j, i.nextIndex());
Assert.assertEquals(o, i.next());
i.remove();
Assert.assertEquals(testCount - 1, list.size());
i.add(o);
Assert.assertEquals(testCount, list.size());
Assert.assertEquals(o, i.previous());
i.next();
}
int arbitraryIndex = testCount / 2;
Integer arbitraryValue = -1;
i = list.listIterator(arbitraryIndex);
i.next();
i.set(arbitraryValue);
for (int j = 0; j < testCount; j++) {
if (j == arbitraryIndex) {
Assert.assertEquals(arbitraryValue, list.get(j));
continue;
}
Assert.assertEquals(Integer.valueOf(j), list.get(j));
}
i = list.listIterator(list.size());
for (int j = list.size() - 1; i.hasPrevious(); j--) {
Integer o = list.get(j);
Assert.assertEquals(j, i.previousIndex());
Assert.assertEquals(o, i.previous());
i.remove();
Assert.assertEquals(testCount - 1, list.size());
i.add(o);
Assert.assertEquals(testCount, list.size());
Assert.assertEquals(o, i.previous());
}
} |
a505f02e-a4ab-4d69-919f-b70c7237aaf3 | 8 | protected void generateRowData(RowDetails rowDetails) {
List<Column> columns = rowDetails.getTable().getColumns();
List<Object> cellValues = new ArrayList<Object>();
//If column is configured as 'generates own data', then there would
//be less number of cell values in the row. We need to fill those
//missing cell values with null before asking call back to generate
//the data. This is to make sure column index reference is consistent.
int skippedColumns = 0;
for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
Column column = columns.get(columnIndex);
CellDetails cellDetails = new CellDetails(rowDetails, columnIndex - skippedColumns);
cellDetails.setColumn(column);
if (column.isGeneratesOwnData()) {
cellValues.add(null);
skippedColumns++;
} else {
Object cellValue = null;
if (rowDetails.getRow() instanceof BeanRow) {
BeanRow beanRow = (BeanRow) rowDetails.getRow();
cellValue = beanRow.getCellValue(column.getName());
} else {
//If there are less number of cells added to the row than there are columns,
//we would assume rest of the cells as nulls.
if (rowDetails.getRow().getCellValues().size() > cellDetails.getColumnIndex()) {
cellValue = rowDetails.getRow().getCellValue(cellDetails);
}
}
if (cellValue == null) {
cellValue = options.getNullString();
}
cellValues.add(cellValue);
}
}
rowDetails.getRow().setCellValues(cellValues);
//Go ahead and ask the call back to generate the data for such column.
//After generating the data, go ahead and ask the callback to override if
//applicable.
for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
CellDetails cellDetails = new CellDetails(rowDetails, columnIndex);
Object cellValue = null;
Column column = columns.get(columnIndex);
if (column.isGeneratesOwnData()) {
if (column.getCellValueGenerator() == null) {
throw new RuntimeException("Column " + column + " configured as own data generator but callback is not configured.");
}
cellValue = column.getCellValueGenerator().generateCellValue(cellDetails);
} else {
cellValue = rowDetails.getRow().getCellValue(cellDetails);
}
cellDetails.setCellValue(cellValue);
rowDetails.getRow().setCellValue(columnIndex, cellValue);
}
} |
64ab6847-7175-4a32-900e-aae35830424a | 3 | public boolean contains(int x, int y) {
return (x > this.x && x < this.width + this.x && y > this.y && y < this.height + this.y);
} |
2a696b00-3d4e-47c6-ab52-895cc111ba22 | 6 | public void startIteration() {
// has timestep been changed?
if (sim.getTimeStep() != savedTimeStep) {
setParams();
}
v = Math.sin(freqTime) * maxV;
freqTime += frequency * 2 * pi * sim.getTimeStep();
frequency = frequency * fmul + fadd;
if (frequency >= maxF && dir == 1) {
if ((flags & FLAG_BIDIR) != 0) {
fadd = -fadd;
fmul = 1 / fmul;
dir = -1;
} else {
frequency = minF;
}
}
if (frequency <= minF && dir == -1) {
fadd = -fadd;
fmul = 1 / fmul;
dir = 1;
}
} |
b33db6ef-696b-46fe-b1d4-df3fab0fe6bc | 7 | private boolean shouldBeSwapped(int index1, int index2){
if (index1>=size() || index1<0 || index2>=size() ||
index2<0)
return false;
E object1 = theHeap.get(index1);
E object2 = theHeap.get(index2);
//Causes issues if one of them is null
if (object1 == null || object2 == null)
return false;
//This line is key, because it takes into account whether or not
//this heap is a Min-Heap or Max-Heap using the Ternary operator.
return 0<object1.compareTo(object2)*(isMax ? 1:-1);
} |
b2f3f81d-8a76-4021-885d-4013c052e928 | 0 | public int getSequence_Id() {
return sequence_Id;
} |
02c48a8d-719b-40ed-adb6-355fce890954 | 7 | @Override
public void draw(Graphics g) {
if (_card.isVisible(_playerID)) {
Rectangle bounds = new Rectangle(_bounds);
if (bumpUp) {
bounds.y += 5;
}
g.setColor(Color.white);
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(Color.black);
g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
String suite = _card.getSuit();
String value = _card.getValue();
g.setFont(_font);
switch (suite) {
case "hearts":
g.setColor(Color.RED);
g.drawString("♥", bounds.x + 4, bounds.y + 20);
g.drawString(value, bounds.x + 4, bounds.y + 40);
break;
case "diamonds":
g.setColor(Color.RED);
g.drawString("♦", bounds.x + 4, bounds.y + 20);
g.drawString(value, bounds.x + 4, bounds.y + 40);
break;
case "spades":
g.setColor(Color.BLACK);
g.drawString("♠", bounds.x + 4, bounds.y + 20);
g.drawString(value, bounds.x + 4, bounds.y + 40);
break;
case "clubs":
g.setColor(Color.BLACK);
g.drawString("♣", bounds.x + 4, bounds.y + 20);
g.drawString(value, bounds.x + 4, bounds.y + 40);
break;
case "joker":
g.setColor(Color.BLACK);
g.drawString("J", bounds.x + 4, bounds.y + 20);
g.setColor(Color.red);
g.drawString("O", bounds.x + 4, bounds.y + 34);
g.setColor(Color.BLACK);
g.drawString("K", bounds.x + 4, bounds.y + 48);
g.setColor(Color.red);
g.drawString("E", bounds.x + 4, bounds.y + 62);
g.setColor(Color.BLACK);
g.drawString("R", bounds.x + 4, bounds.y + 76);
break;
}
} else {
g.drawImage(_backImg, _bounds.x, _bounds.y, _bounds.width, _bounds.height, null);
}
} |
b9fe82ce-1b9d-476f-9730-d075069581ed | 9 | private long readLong_slow (boolean optimizePositive) {
// The buffer is guaranteed to have at least 1 byte.
position++;
int b = niobuffer.get();
long result = b & 0x7F;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (b & 0x7F) << 7;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (b & 0x7F) << 14;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (b & 0x7F) << 21;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (long)(b & 0x7F) << 28;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (long)(b & 0x7F) << 35;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (long)(b & 0x7F) << 42;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (long)(b & 0x7F) << 49;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (long)b << 56;
}
}
}
}
}
}
}
}
if (!optimizePositive) result = (result >>> 1) ^ -(result & 1);
return result;
} |
60424302-1bf8-4682-aa4b-f5d7c94b107c | 9 | private void colchete() {
// <colchete> ::= “[“ <inteiro> “]” <colchete> | λ
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[1].equals(" [")) {
contadorColchete++;
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[0].equals("Numero Inteiro")) {
numeroDoVetor = numeroDoVetor.concat(tipoDoToken[1]+":");
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[1].equals(" ]")) {
this.colchete();
}
} else {
errosSintaticos.erroFimDeArquivo(tipoDoToken[3], tipoDoToken[1], "atribuição");
zerarTipoToken();
}
}
else{
System.out.println("DEVERIA SER UM NÚMERO INTEIRO DENTRO DO CAMPO DE UM VETOR");
}
} else {
errosSintaticos.erroFimDeArquivo(tipoDoToken[3], tipoDoToken[1], "atribuição");
zerarTipoToken();
}
} else {
if(contadorColchete>0){
if(existeParametro == 0){
listaParametro.add(geraIDVar + ":"+ tipoDoParametro + ":"+ nomeDoParametro + ":" + contadorColchete + ":" + numeroDoVetor + ":" + " ");//colocar outro simbolo separando os numeros
}
}else{
if(existeParametro == 0){
listaParametro.add(geraIDVar + ":"+ tipoDoParametro + ":"+ nomeDoParametro + ":" + "zero" + ":" + " ");
}
}
tipoDoParametro = " ";
nomeDoParametro = " ";
parametro = parametro.concat(geraIDVar + ":");
contadorColchete = 0;
numeroDoVetor = " ";
geraIDVar++;
existeParametro = 0;
return;
}
} else {
errosSintaticos.erroFimDeArquivo(tipoDoToken[3], tipoDoToken[1], "atribuição");
zerarTipoToken();
}
} |
1f2598fc-8251-4cfd-9dec-d733cf796716 | 2 | public ArrayList<Object> subarray_as_ArrayList(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
ArrayList<Object> arrayl = new ArrayList<Object>(end-start+1);
for(int i=start; i<=end; i++)arrayl.add(array.get(i));
return arrayl;
} |
332d58c9-3aa9-44ed-a4e2-6906c62beb6e | 7 | private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{ boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file list
int i = 0;
while( !ok && i < flavors.length )
{
// BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
// Is the flavor a file list?
final DataFlavor curFlavor = flavors[i];
if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
curFlavor.isRepresentationClassReader()){
ok = true;
}
// END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
i++;
} // end while: through flavors
// If logging is enabled, show data flavors
if( out != null )
{ if( flavors.length == 0 )
log( out, "FileDrop: no data flavors." );
for( i = 0; i < flavors.length; i++ )
log( out, flavors[i].toString() );
} // end if: logging enabled
return ok;
} // end isDragOk |
1632f5de-7d9d-46c6-a1cf-5f1a8d6c7776 | 3 | void checkType(int index, Class<?> value) {
if ((value != null) && (value != types.get(index))) {
throw new ColumnFormatException();
}
} |
0f4a12ff-a0d3-47c1-a959-e02bd8bcc3e3 | 1 | public BitOutputStream(OutputStream out) {
if (out == null)
throw new NullPointerException("Argument is null");
output = out;
currentByte = (byte) 0;
numBitsInCurrentByte = 0;
} |
a20f26eb-a881-4c75-b8e6-fec8022ab8d7 | 8 | public static void main(String[] args) {
Result result;
result = JUnitCore.runClasses(BetTest.class);
System.out.println("Classe Bet: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Bet: " + failure.toString());
}
result = JUnitCore.runClasses(CardComparatorTest.class);
System.out.println("Classe CardComparator: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe CardComparator: " + failure.toString());
}
result = JUnitCore.runClasses(CardTest.class);
System.out.println("Classe Card: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Card: " + failure.toString());
}
result = JUnitCore.runClasses(DeckTest.class);
System.out.println("Classe Deck: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Deck: " + failure.toString());
}
result = JUnitCore.runClasses(GameTest.class);
System.out.println("Classe Game: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Game: " + failure.toString());
}
result = JUnitCore.runClasses(HandTest.class);
System.out.println("Classe Hand: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Hand: " + failure.toString());
}
result = JUnitCore.runClasses(PlayerTest.class);
System.out.println("Classe Player: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Player: " + failure.toString());
}
result = JUnitCore.runClasses(TurnTest.class);
System.out.println("Classe Turn: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Turn: " + failure.toString());
}
} |
813112e3-4656-47ba-bfbe-e07fc9593783 | 5 | public com.quickserverlab.quickcached.client.CASValue gets(String key, long timeoutMiliSec)
throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException{
com.quickserverlab.quickcached.client.CASValue value = null;
try{
OperationFuture <CASValue<Object>> f = getCache().asyncGets(key);
try {
CASValue<Object> cv = (CASValue<Object>) f.get(timeoutMiliSec, TimeUnit.MILLISECONDS);
if(cv != null){
value = new com.quickserverlab.quickcached.client.CASValue(cv.getCas(), cv.getValue());
}else{
throw new com.quickserverlab.quickcached.client.MemcachedException("Object not found");
}
}catch(InterruptedException ie){
throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
}catch(ExecutionException ee){
throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
}catch(java.util.concurrent.TimeoutException te){
throw new TimeoutException("Timeout "+ te);
}finally{
f.cancel(false);
}
}catch(IllegalStateException ise){
throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
}
return value;
} |
bfefb4e6-a096-47cc-8691-88683fbf30bc | 5 | @Override
public void bfs(String label, Function<Vertex, Vertex> action) {
Vertex v = getVertex(label);
if (v.wasVisited() == false) {
v.setVisited(true);
action.apply(v);
pQueue.add(v);
}
JList<Vertex> listOfAdjacent = getEdges(mapOfVerticeIndex.get(v.getLabel()));
for (Vertex neighbor : listOfAdjacent) {
if (neighbor.wasVisited() == false) {
neighbor.setVisited(true);
action.apply(neighbor);
pQueue.add(neighbor);
}
}
if (pQueue.isEmpty())
return;
pQueue.remove();
if (pQueue.isEmpty())
return;
bfs(pQueue.peek().getLabel(), action);
} |
2bbcc999-5dc7-43ed-ad26-30ab5a372351 | 2 | protected int loadShader(String filename, int type) {
StringBuilder shaderSource = new StringBuilder();
int shaderID = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
shaderSource.append(line).append("\n");
}
reader.close();
} catch (IOException e) {
System.err.println("Could not read file.");
e.printStackTrace();
System.exit(-1);
}
shaderID = GL20.glCreateShader(type);
GL20.glShaderSource(shaderID, shaderSource);
GL20.glCompileShader(shaderID);
return shaderID;
} |
8e66a33b-72ea-41b5-b09b-4459b967cd7c | 5 | public void doWork() {
Thread thread1 = new Thread(new Runnable() {
public void run() {
for (int i = 0; i < 10; i++) {
try {
increment(Thread.currentThread().getName());
} catch (InterruptedException ex) {
Logger.getLogger(Worker.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
thread1.start();
Thread thread2 = new Thread(new Runnable() {
public void run() {
for (int i = 0; i < 10; i++) {
try {
increment(Thread.currentThread().getName());
} catch (InterruptedException ex) {
Logger.getLogger(Worker.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
thread2.start();
/**
* Join Threads: Finish until thread finishes execution, then progress
* the code Reminder: your method is also a thread so without joining
* threads System.out.println("Count is: " + count); will work
* immediately. Join does not terminate Thread 2, just progress of the
* code stops until Threads terminate.
*/
try {
thread1.join();
thread2.join();
} catch (InterruptedException ignored) {}
System.out.println("Count is: " + count);
} |
e36311ad-1f48-46aa-90e7-676176d4ecde | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
IntegerSequenceSweep other = (IntegerSequenceSweep) obj;
if (from != other.from) {
return false;
}
if (param == null) {
if (other.param != null) {
return false;
}
} else if (!param.equals(other.param)) {
return false;
}
if (step != other.step) {
return false;
}
if (to != other.to) {
return false;
}
return true;
} |
07e23e34-9fcd-48f5-818d-eae9487edd25 | 1 | public Item removeBefore(DNode<Item> nd)
{
if (nd.prev == head)
return null;
return remove(nd.prev);
} |
83374bc9-1f64-4d8f-8bb9-6e29bbafeb0f | 1 | private void check(boolean val) {
if (!val) {
throw new IllegalArgumentException();
}
} |
c03631b6-ae18-41e7-a1b9-aed8ea32abd4 | 5 | void setCodeValues(HTreeNode root){
/* Does nothing if root node is null. */
if (root == null)
return;
/* Checks if the root is null. */
if (root != null)
{
/* Checks if the left subtree is null. */
if (root.getLeft() != null)
/* Set code of left subtree node to 0. */
root.getLeft().setCode(0);
/* Explore the left subtree. */
setCodeValues(root.getLeft());
/* Checks if the right subtree is null. */
if (root.getRight() != null)
/* Set code of right subtree node to 1. */
root.getRight().setCode(1);
/* Explore the right subtree. */
setCodeValues(root.getRight());
/* Checks if both subtrees are null. */
if (root.isLeafNode())
return;
}
} |
1dd2d5c0-f3cc-4989-9d2a-9d11ab59a653 | 9 | public Modules()
{
this.list = new ArrayList<String> ();
String packageName = "jmxattacks";
File file = new File(Modules.class.getProtectionDomain().getCodeSource().getLocation().getPath());
// Test if program is launched from jar file
String path = file.getPath();
boolean test = path.matches(".*\\.jar$");
if (test == true)
{
packageName = packageName.replaceAll("\\." , "/");
try
{
JarInputStream jarFile = new JarInputStream(new FileInputStream (path));
JarEntry jarEntry;
while(true)
{
jarEntry=jarFile.getNextJarEntry ();
if(jarEntry == null)
{
break;
}
if((jarEntry.getName ().startsWith (packageName)) && (jarEntry.getName ().endsWith (".class")) )
{
//this.list.add (jarEntry.getName().replaceAll("/", "\\.").substring(0, jarEntry.getName().lastIndexOf(".")).split("\\.")[1]);
this.list.add (jarEntry.getName().replaceAll("/", "\\.").substring(0, jarEntry.getName().lastIndexOf(".")));
}
}
}
catch( Exception e)
{
e.printStackTrace ();
}
}else
{
String targetPackage = "jmxattacks";
String targetPackagePath = targetPackage.replace('.', '/');
String targetPath = "/"+targetPackagePath;
URL resourceURL = Modules.class.getResource(targetPath);
String packageRealPath = resourceURL.getFile();
File packageFile = new File(packageRealPath);
for (File classFile : packageFile.listFiles())
{
String fileName = classFile.getName();
if (fileName.endsWith(".class"))
{
String className = fileName.substring(0, fileName.lastIndexOf("."));
className="jmxattacks."+className;
this.list.add(className);
}
}
}
if (this.list.contains("jmxattacks.Attack")) this.list.remove("jmxattacks.Attack");
} |
763420e7-17bc-470f-adca-34bc8966f6a5 | 6 | public static void main(String[] args) throws Exception
{
HashSet<Integer> set = new HashSet<Integer>();
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getChinaDir() + File.separator +
"Kathryn_update_NCBI_MostWanted" + File.separator + "otuModel_pValues_otu.txt"
)));
reader.readLine();
for(String s = reader.readLine(); s != null; s = reader.readLine())
{
if( ! s.startsWith("\"unRarifiedRichness") && ! s.startsWith("\"shannon") )
{
int anInt= Integer.parseInt(s.split("\t")[0].replaceAll("X" , "").replaceAll("\"", ""));
if( set.contains(anInt))
throw new Exception("No");
set.add(anInt);
}
}
System.out.println(set.size());
List<Integer> list =new ArrayList<Integer>(set);
Collections.sort(list);
for( int x=0; x < list.size() -1 ;x++)
{
if( list.get(x+1) - list.get(x) != 1)
System.out.println("Gap " + list.get(x) + " " + list.get(x+1));
}
reader.close();
} |
e94665b2-84a5-411f-9845-116781ab851d | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
DeliveryPacket packet = deliveryPackets.get(rowIndex);
if (columnIndex == DELIVERY_PACKET_ID) {
return packet.getId();
} else if (columnIndex == MEMBER_NAME) {
return packet.getMember().getFullName();
} else if (columnIndex == EVENT) {
return packet.getEvent();
} else if (columnIndex == DELIVERY_DATE) {
return packet.getDeliveryDate();
} else if (columnIndex == EXPECTED_RETURN_DATE) {
return packet.getExpectedReturnDate();
} else {
logger.warn("Попытка получить значение которое не существет из списка выдач. "
+ "Строка: " + rowIndex + ", столбец: " + columnIndex);
return null;
}
} |
864909f1-a1de-4462-954f-aec08a79b1f2 | 1 | @Override
public String toString() {
return (Platform.isWindows() ? '/' : '-') + mNames[0];
} |
d2784561-3ba7-4cef-9224-cfd749e320ce | 6 | public Integer isResult(boolean win, boolean lose, boolean cut) {
// 0 - win
// 1 - lose
// 2 - cut
Integer num = 2;
if ( win == true
&& lose == false
&& cut == false ){
num = 0;
} else if ( lose == true
&& win == false
&& cut == false ){
num = 1;
} else {
num = 2;
}
return num;
} |
93727387-f09f-4f84-9b1a-5d579a9003e1 | 4 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
if (bc[0] == null) {
bc[0] = new BallCollection(0, 0, 5, 5, 20, 20, new Color[] { device
.getSystemColor(SWT.COLOR_GREEN) });
bc[1] = new BallCollection(50, 300, 10, -5, 50, 10,
new Color[] { device.getSystemColor(SWT.COLOR_BLUE) });
bc[2] = new BallCollection(250, 100, -5, 8, 25, 12,
new Color[] { device.getSystemColor(SWT.COLOR_RED) });
bc[3] = new BallCollection(150, 400, 5, 8, 35, 14,
new Color[] { device.getSystemColor(SWT.COLOR_BLACK) });
bc[4] = new BallCollection(100, 250, -5, -18, 100, 5,
new Color[] { device.getSystemColor(SWT.COLOR_MAGENTA) });
}
for (int j = 0; j < bc.length; j++) {
for (int i = 0; i < bc[j].prevx.size(); i++) {
Transform transform = new Transform(device);
transform.translate(((Float) bc[j].prevx.get(bc[j].prevx.size()
- (i + 1))).floatValue(), ((Float) bc[j].prevy
.get(bc[j].prevy.size() - (i + 1))).floatValue());
gc.setTransform(transform);
transform.dispose();
Path path = new Path(device);
path.addArc(0, 0, bc[j].ball_size, bc[j].ball_size, 0, 360);
gc.setAlpha(255 - i * (255 / bc[j].capacity));
gc.setBackground(bc[j].colors[0]);
gc.fillPath(path);
gc.drawPath(path);
path.dispose();
}
}
} |
2a87bea0-151e-41ed-855f-d4b3deb86756 | 2 | public Object[] getValues()
{
for (int i = 0; i < editors.length; i++)
if (editors[i] != null)
values[i] = editors[i].getValue();
return values;
} |
fcb31ccc-f8df-4ff9-88f7-3f70cca487c5 | 7 | @Override
public boolean setObject(String name, JOSObject<?, ?> value) {
boolean n = this.getObject(name) == null;
srcJOSCompound comp = this;
String[] path = name.split("\\\\");
if(path != null && path.length >= 1){
srcJOSCompound ccomp = comp;
srcJOSCompound parrent = comp;
for(int i = 0 ; i < path.length - 1 ; i++){
ccomp = (srcJOSCompound) ccomp.getCompound(path[i]);
if(ccomp == null && parrent != null){
ccomp = new srcJOSCompound(parrent);
parrent.DATA.put(path[i], ccomp);
}
parrent = ccomp;
}
ccomp.DATA.put(path[path.length - 1], value);
}else{
comp.DATA.put(name, value);
}
return n;
} |
827bdf0e-8a38-4c23-8cb2-c3ef92df679f | 7 | public void supprimerLignes() {
int i, j, k;
boolean full;
for (i = 0; i < hauteur; i++) {
full = true;
for (j = 0; j < largeur; j++) {
if (tab[j][i] == 0) {
full = false;
}
}
if (full == true) {
for (k = i; k > 0; k--) {
for (j = 0; j < largeur; j++) {
tab[j][k] = tab[j][k - 1];
}
}
for (j = 0; j < largeur; j++) {
tab[j][0] = 0;
}
}
}
} |
c0ae821a-3f40-41c5-9034-2d5f9d8e8539 | 1 | private BufferedReader readFile(){
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader(fileName);
br = new BufferedReader(fr);
}catch(FileNotFoundException ex){
ex.printStackTrace();
}
return br;
} |
83be8d7e-225b-42cf-97a6-db0ecb64bd0a | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
ArrayList<Integer> list = new ArrayList<Integer>();
int size = 0;
do {
line = in.readLine();
if (line == null || line.length() == 0)
break;
int n = Integer.parseInt(line.trim());
list.add(n);
Collections.sort(list);
size++;
double median = 0;
if(size%2==0){
median = (list.get(size/2)+list.get((size/2)-1))/2;
System.out.println((int)Math.floor(median));
}else
System.out.println(list.get(size/2));
} while (line != null && line.length() != 0);
System.out.print(out);
} |
a3a1c7cb-bc08-45c8-bec5-6e68f1ee1873 | 0 | public HandlerList getHandlers() {
return handlers;
} |
ea480723-a751-46f8-9690-860b04ebd262 | 6 | @Override
public void animatedEntityTick(double time) {
// tick lifetime, kill if expired
lifeTime += time;
if(lifeTime >= def.lifeTime){
kill(null);
return;
}
// move to target
loc.travelTo(targetLoc, time * def.speed, true);
// if target is reached, deal damage and kill self
if(loc.hammingDistanceTo(targetLoc) < 0.1f){
if(attacker.def.damageRadius > 0){
GameCtrl.get().dealAreaDamage(targetLoc, attacker, instantEffects, timedEffects);
} else {
if(target != null){
GameCtrl.get().dealDamage(target, attacker, instantEffects, timedEffects, rotation);
}
}
kill(null);
} else {
rotation = loc.getRotationTo(targetLoc);
}
// emit particles
for(int i=0; i<particleCooldowns.length; i++){
particleCooldowns[i] -= time;
while(particleCooldowns[i] <= 0){
particleCooldowns[i] += def.particleCooldowns[i];
GameCtrl.get().addParticle(def.particleFactories[i], loc.clone(), rotation + 180f);
}
}
} |
b528b42f-100d-4001-9641-30b7ba8fe8bd | 0 | public final int getOffsize() { return offsize; } |
8125a27a-5409-4dbe-9a68-2fa1e30de86b | 6 | public void setImgPath_PWBtn(Path img, Imagetype type) {
switch (type) {
case MOUSEFOCUS_KEYFOCUS: // HD simplified
this.imgPWBtn_KFocMFoc = handleImage(img, UIResNumbers.PWBTN_KFOCMFOC.getNum());
if (this.imgPWBtn_KFocMFoc == null) {
this.imgPWBtn_KFocMFoc = UIDefaultImagePaths.PWBTN_KFOCMFOC.getPath();
deleteImage(UIResNumbers.PWBTN_KFOCMFOC.getNum());
}
break;
case PRESSED:
this.imgPWBtn_Pre = handleImage(img, UIResNumbers.PWBTN_PRE.getNum());
if (this.imgPWBtn_Pre == null) {
this.imgPWBtn_Pre = UIDefaultImagePaths.PWBTN_PRE.getPath();
deleteImage(UIResNumbers.PWBTN_PRE.getNum());
}
break;
case DEFAULT:
this.imgPWBtn_Def = handleImage(img, UIResNumbers.PWBTN_DEF.getNum());
if (this.imgPWBtn_Def == null) {
this.imgPWBtn_Def = UIDefaultImagePaths.PWBTN_DEF.getPath();
deleteImage(UIResNumbers.PWBTN_DEF.getNum());
}
break;
default:
throw new IllegalArgumentException();
}
somethingChanged();
} |
09d832de-4b11-47ce-a633-372e3bdb333b | 4 | public void setFieldValue(_Fields field, Object value) {
switch (field) {
case WHAT:
if (value == null) {
unsetWhat();
} else {
setWhat((Integer)value);
}
break;
case WHY:
if (value == null) {
unsetWhy();
} else {
setWhy((String)value);
}
break;
}
} |
98635937-da70-4b56-80ab-7637b23b96fe | 2 | public static String padToMax(String pValue, int padLength)
{
String text = "";
if (pValue != null)
{
text = pValue;
}
while (text.length() < padLength)
{
text += " ";
}
return text;
} |
831868da-52a6-4870-b8bd-c00c58dc8bc9 | 8 | static int f(int cant, int usados, int ant) {
if(cant>M)
return 0;
if(mem[cant][usados][ant]>-1)
return mem[cant][usados][ant];
int result=0;
if(usados==(1<<N)-1)
result++;
for(int i=0;i<N;i++)
if((cant==0&&i!=0)||(cant>0&&abs(ant-i)==1))
result=(result+f(cant+1,usados|(1<<i),i)%1000000007)%1000000007;
return mem[cant][usados][ant]=result;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.