method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1a172d61-3698-4f74-ae89-d522f93a2f9b | 1 | @SuppressWarnings("unchecked")
@Override
public String displayQuestion(int position) {
ArrayList<String> questionList = (ArrayList<String>) question;
String questionStr = questionList.get(0);
StringBuilder sb = new StringBuilder();
sb.append("<span class=\"dominant_text\">" + position + ".</span>\n");
sb.ap... |
3fdd9e5d-6c98-4c06-bb82-ba1c96e48f82 | 0 | public void setjTextFieldDateRapport(JTextField jTextFieldDateRapport) {
this.jTextFieldDateRapport = jTextFieldDateRapport;
} |
89ee783c-6cd6-41ef-86d5-3bf4bce254df | 2 | public Object getObjectFromLocation(int x, int y)
{
ZElement elem = chercheElement(x, y);
if (elem != null)
return elem;
ZLien lien = chercheLien(x, y);
if (lien != null)
return lien;
return null;
} |
43a83505-a87d-4a52-87ee-76f8ae18c1a4 | 9 | private void updateStatusToFitWithChanges(Anime animeBefore, Anime animeAfter) {
int nbWatchedBefore = animeBefore.getWatched_episodes();
int nbWatchedAfter = animeAfter.getWatched_episodes();
int total = animeAfter.getEpisodes();
if(nbWatchedBefore != nbWatchedAfter) {
... |
e559add0-402c-45d7-b163-00afcda7e845 | 6 | public double EV() {
double ev = 0;
double ev_fold;
double ev_check;
double ev_raise;
switch(nodeType) {
case SHOWDOWN :
// if it's a showdown node, ev is based and chance of winning and amount bet
double winPossibility = gameInfo.opponentModel.winPossibility(actionHistory, gam... |
8791ff79-86cb-418c-b91b-1d8acdd283b7 | 3 | public static boolean deleteLine(String fileName, int lineNumber) {
fileName = "Data/" + fileName + ".txt";
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
StringBuffer sb = new StringBuffer();
String line;
... |
1ea6e398-cdd9-438e-90c2-cf40b703f250 | 3 | @Override
public CategoryModel addCategory(CategoryModel category)
throws WebshopAppException {
if (isValidCategory(category, "ADD_CATEGORY")) {
try (Connection conn = getConnection()) {
String sql = "INSERT INTO categories (name, staff_responsible)"
+ "VALUES (?, ?)";
try (PreparedStatement p... |
bdd91ce6-c4c8-4a4d-903b-8e8ea9536032 | 1 | @Override
public int getDurationPerQuestion() {
int questions = getFinishedQuestions();
int duration = getDuration();
return questions != 0 ? duration / questions : duration;
} |
5d322d2e-15bd-4c8c-a3f4-2c98699b6e50 | 8 | private String createChart(
String title
, String projectID
, String siteID
, String gradeLevel
, String subjectArea
) {
StringBuilder str = new StringBuilder();
String chartName = "";
switch(subjectArea... |
8d6543be-5bee-4261-a6fd-7d7024d9e492 | 1 | @Test
public void addUser(){
Connection conn = null;
Statement statement = null;
try{
conn = JDBCUtils.getConnection();
statement = conn.createStatement();
statement.executeUpdate("INSERT INTO table_user VALUES(null,'Lucy',22,'云南省昆明市五华区世纪生活园')");
}catch (Exception e) {
e.printStackTrac... |
3ad23a79-aba8-421f-bdfb-4249ed4a0b17 | 0 | public static int getOffset(String string, int characterOff) {
return string.length() * characterOff;
} |
0dceefe2-f881-4460-927a-7dcea4fa8990 | 0 | public void instalowanieOprogramowania(){
System.out.println("Instaluje oprogramowanie...");
} |
ec4de009-d97f-4937-8f56-0c7b93bb7d4a | 1 | public RemoveListenerExample() {
JPanel panel = new JPanel();
panel.setLayout(null);
add = new JButton("+");
add.setBounds(40, 30, 80, 25);
buttonlistener = new ButtonListener();
active = new JCheckBox("Active listener");
active.setBounds(160, 30, 140, 25);
active.addItemListener(new ItemListener()... |
4ee535c5-202d-48a4-bb84-2a0613675ee2 | 8 | private void rotateAndPosition(int posX, int posY, int angle)
{
if (angle != 0 && angle != 90 && angle != 180 && angle != 270)
{
throw new RuntimeException();
}
posX += angle == 90 ? 128 : angle == 180 ? 85 : 0;
posY += angle == 180 ? 128 : angle == 270 ? 85 : 0;
GL11.glPushMatrix();
GL11.glTranslat... |
f4818192-3e56-4bc2-a3ce-f6bbacdef2aa | 1 | public void write(final int data) throws BITalinoException {
try {
os.write(data);
os.flush();
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace(System.err);
throw new BITalinoException(BITalinoErrorTypes.LOST_COMMUNICATION);
... |
53e42648-5894-41df-8ef9-e59ba4e01589 | 1 | public void testCompareTo() {
DateMidnight test1 = new DateMidnight(TEST_TIME1_UTC);
DateMidnight test1a = new DateMidnight(TEST_TIME1_UTC);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareTo(test1));
assert... |
d499dbd4-4086-4225-8096-4da1b7fa38d2 | 0 | @Test
public void testGetGoogle() throws Exception {
final Properties[] configs = new Properties[] {
new Properties(),
};
configs[0].setProperty("type", "No");
String site = "www.google.com";
String expected_substring = "domain=.google.com";
// site = "... |
8e92fc42-3f36-4078-9a0d-ae3dcb4c8f37 | 9 | private Context nextContext() {
Context next = new Context(context);
Options options = Options.instance(context);
Assert.checkNonNull(options);
next.put(Options.optionsKey, options);
PrintWriter out = context.get(Log.outKey);
Assert.checkNonNull(... |
4d0b5c5e-0827-4325-aac0-7b7bbd7e0de9 | 6 | public boolean dessus(int x, int y){
boolean res = false;
if (type==RECTANGLE){
int e =(epaisseur+1)/2;
res = dansRectangle(x1-e,y1-e,x1+x2+e,y1+y2+e, x,y);
}
if (type==ELIPSE){
int e =(epaisseur+1)/2;
res = dansEllipse(x1-e,y1-e,x1+x2+e,y1+y2+e, x,y);
//res = dansEllipse(x1-e,y1-e,x1+x2+e,y1+y2... |
e7ce3c86-0e35-4898-bbeb-2dbe83db789e | 2 | void a3(boolean raining, boolean floodWarning) {
boolean gateOpen = false;
if (raining && floodWarning) {
gateOpen = true;
}
} |
a87c871b-a0d8-44f2-994f-cac94defb84c | 0 | public List<AIScreen> getScreensList() {
return screensList;
} |
7a2a1bef-f38a-4e1e-86a5-3851f00d7436 | 8 | public static long toAmount(String price)
{
if(price.charAt(0) == '$')
price = price.substring(1);
index = price.indexOf(".");
if(index == -1)
price = price + "00";
else if(index == price.length()-1)
price = price.substring(0,price.length()-1) + "00";
else if(index == 0 && price.length() == 2)... |
a114edf0-426d-4cda-9df1-41168142018a | 8 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int r = -1;
int a = 1,b = 2,c=3;
boolean ready = false;
if (n<3){
for (int i = 1 ; i < 99 ; i ++ ){
... |
4a92ddbc-63c4-43fd-9f67-ea4b02996aee | 8 | private void actualizarJugador() {
boolean bandera=false;
TesoroGrafico unTesoroGrafico;
int i;
limpiarJugador();
Map<String,String> uno=new HashMap();
jugadorActivo = juego.getJugadorActivo();
jLDude.setIcon(new javax.swing.ImageIcon(getClass().getResource("/munc... |
026811a4-57e6-4801-9266-c3b11ca37146 | 5 | public static Container getContainer(String containerName) throws WebConfigException{
if(containerName == null){
throw new WebConfigException("we can not find init-param named \"container\" in web.xml");
}
if(!supportThisTypeContainer(containerName)){
throw new WebConfigException("container name is wrong... |
01c900f2-e9c8-4fbe-ab2f-061292e7a9f1 | 7 | public static void drawLine(LedGraphics lg, Point A, Point B) {
if (A.x == B.x || A.y == B.y) {
double x, y, w, h;
x = A.x;
y = A.y;
w = B.x - A.x;
h = B.y - A.y;
if (w < 0) {
// x = B.x;
w = -w;
}
if (h < 0) {
// y = B.y;
h = -h;
}
w++;
h++;
lg.drawRect((int) Mat... |
56232da6-938c-44bc-ac1b-cd9db99c8c40 | 5 | static final void method3030(int i, OpenGlToolkit var_ha_Sub2) {
anInt6999++;
if (Class337.anObject4177 == null) {
Class59_Sub1_Sub2 class59_sub1_sub2 = new Class59_Sub1_Sub2();
byte[] is = class59_sub1_sub2.method562(128, 128, (byte) 121, 16);
Class337.anObject4177 = Class179.getDirectByteBuffer(is);
... |
da15be74-78ab-4b8a-95c4-90e4574445ff | 6 | private void jBListarIncidentesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBListarIncidentesActionPerformed
// TODO add your handling code here:
int tipo = combo_comuna_reporte.getSelectedIndex();
if (tipo != 0) {
Comuna codigocomuna = controlador.buscarComu... |
f560aea8-9a97-4224-9091-639b34c805b2 | 3 | public E get(int index) {
if (index < mElements.size()) {
return mElements.get(index);
} else if (mUpdating) {
return null;
} else {
/* Need a new page if it exists */
if (this.hasNextPage())
fetchNextPage();
else
notifyListeners(null);
return null;
}
} |
a8c93186-ad1b-43c8-88d0-3353d7411e40 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (ADown ? 1231 : 1237);
result = prime * result + (BDown ? 1231 : 1237);
result = prime * result + downCooldown;
result = prime * result + (leftDown ? 1231 : 1237);
result = pri... |
1b76c9f3-422b-4d00-86de-145d21c79069 | 1 | public void requestCard(Deck deck) {
log.debug("[Player] Just to check that Player.recieveCard() has just been called."); // Debugging
// line
card[cardCount] = deck.dealCard();
log.debug("[Player] The Deck has just dealt a card to player by player"); // Debugging
// ... |
9872d7c6-d03c-427e-94a5-ff576508bc33 | 7 | public static void main(String[] args) {
int W = 10;
int[] w = new int[] {0,1,2,5,7,2,1,2,4,6};
int[] v = new int[] {0,1,3,5,2,5,6,4,5,5};
int items = w.length - 1;
int[][] A = new int[w.length][W+1];
for (int i = 1; i < w.length; i++) {
for (int j = 0; j <= W; j++) {
A[i][j] = ... |
10a2d6e9-a76a-4b14-8634-7b9dbc079c3b | 2 | public static String hexToString(byte[] bytes) {
StringBuffer buff = new StringBuffer();
for (int i=0; i<bytes.length; i++) {
int val = bytes[i];
val = val & 0xff; // remove higher bits, sign
if (val<16) buff.append('0'); // leading 0
buff.append(Integer.toString(val, 16));
}
return buff.toString()... |
19d228b4-2c65-4933-a709-b4c03e2c80a2 | 0 | public void setPopUsuario(String popUsuario) {
this.popUsuario = popUsuario;
} |
a307ed7a-2dab-4861-b1b1-9674c98e1c8a | 5 | public static Collection<? extends Bean> attachParentBeansFromMethods(Set<Bean> beansCollection){
Map<Bean,Bean> map = new HashMap<Bean, Bean>();
Set<Bean> beansWithParents = new HashSet<Bean>();
for (Bean beanFromCollection : beansCollection) {
for (Bean beanInjected : beanFromCol... |
894b1c67-63bb-4c99-ba01-2e630b301b6a | 0 | public Integer getIdPrueba() {
return idPrueba;
} |
371739bf-e5eb-4572-9a40-33873a45fc36 | 4 | @Override
public void clear() {
if (data != null) {
for (ROVector3f v : data) {
v.setX(0f);
v.setY(0f);
v.setZ(0f);
}
}
if (originalData != null) {
for (ROVector3f v : originalData) {
v.setX(0f);
v.setY(0f);
v.setZ(0f);
}
}
setRotation(0f);
setScale(1f);
} |
c3879453-7772-438a-940e-7a9b0ad8a615 | 7 | public ContentRange( String bytesUnit,
long firstBytePos,
long lastBytePos,
long instanceLen )
throws NullPointerException,
IllegalArgumentException {
super();
if( bytesUnit == null )
throw new NullPointerException( "Cannot create Content-Range wrappers with null-bytesUnit." );
if( !byte... |
6aeb7ad8-0590-4ee7-8ada-c08825e99c86 | 7 | public static void resultPlotter(File resFile, int[] dataNum, double[][] classifiedModels) throws Exception{
stopWatch("Writing: " + resFile.toString());
//ʏo
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(resFile));
BufferedWriter bw = new BufferedWriter(osw);
bw.write("Time");
for(in... |
bc99d41b-451e-4420-bbdc-33b6604151e5 | 9 | public ArrayList<ArrayList<String>> select(String table, String columns, String where, String args) throws SQLiteException {
String query = "SELECT " + columns + " FROM " + table;
if (where.trim().length() > 0) {
query += " WHERE " + where;
}
SQLiteStatement st = _db.prepare(query);
String[] parameters;... |
be2ea6ed-52b1-40c0-a3a6-d87187334da6 | 9 | private boolean canJump()
{
for(int i = 0; i < LARGURA; i++)
{
for(int j = 0; j < ALTURA; j++)
{
if(pieces[i][j] != null)
{
if(vezDoJogadorClaro() && pieces[i][j].isLight() && pieceCouldJumpToFrom(i, j).size() > 0)
return true;
else if(vezDoJogadorEscuro() && pieces[i][j].isDark() && ... |
d7c50911-5db4-43d2-b4ce-20b76e7544a6 | 9 | public static Perturbation[] generateAll(String type, Molecule m, int flexMolResNum[], int resCount){
ArrayList<Integer> startRes = new ArrayList<Integer>();//Molecule residue numbers to start perturbations at
int numPerts = 0;
//Look for any sets of resCount residues in a row in flexMolResNum... |
f01c8e05-df30-4b15-b835-c61367fdb36b | 4 | @Override
public String toString(){
String str = "";
str += "[";
for(int i = 0; i < x; i++){
for(int j = 0; j < y; j++){
str += mat[i][j];
if(j < y-1){str += ",";}
}
if(i < x-1){str += ";";}
}
str += "]";
... |
38bb9222-7a46-4d46-bb3a-980741293c5f | 2 | public static List<Apple> filterApples(List<Apple> inventory, Predicate<Apple> predicate){
List<Apple> filteredApples = new ArrayList<>();
for (Apple apple : inventory) {
if(predicate.test(apple)) {
filteredApples.add(apple); //Added only if the passed predicate matches the c... |
4d6b1410-efff-4056-b146-8d1b00eb5d71 | 9 | private String evaluateWhichABondFunction(final String clause) {
if (clause == null || clause.equals(""))
return null;
if (!(model instanceof MolecularModel))
return null;
MolecularModel mm = (MolecularModel) model;
int nab = mm.bends.size();
if (nab <= 0)
return null;
int i = clause.indexOf("(");
... |
a218f8c0-f70c-4957-bc87-4e24af7841d7 | 3 | public static double demoVote(Territory t) {
ArrayList<Player> ps = t.getPlayers();
int total = 0;
int yes = 0;
double j = 0;
for (int i=0; i<ps.size();i++) {
if (ps.get(i).getName().substring(0,2).equals("cp")) {
j = indVote();
ps.get(i).vote((int)j);
yes += j;
total++;
}else {
yes ... |
9ca16728-9cd0-4b80-9d4c-ff20b0fbf662 | 0 | @Test
public void determineHighestStraight_whenHandContainsJto7_returnsJackHighStraight() {
Hand hand = findHighestStraight(sixFlushWithStraight());
assertEquals(HandRank.Straight, hand.handRank);
assertEquals(Rank.Jack, hand.ranks.get(0));
} |
528e7561-ba24-4c5f-906d-e00c61bd3764 | 2 | public ArrayList<Producto> selectAllProducto(){
ArrayList<Producto> productos = new ArrayList<Producto>();
try {
Statement comando=connection.createStatement();
ResultSet r = comando.executeQuery("select * from Productos");
boolean especial = false;
while (... |
326b2af3-234e-49ff-a3c2-138871457607 | 0 | protected CurvedArrow arrowForTransition(Transition transition) {
return (CurvedArrow) transitionToArrowMap.get(transition);
} |
f2a3860c-0336-4112-a640-b0697f6d469b | 8 | private final int tokenizeProlog()
throws IOException, EmptyTokenException, EndOfPrologException {
for (;;) {
try {
int tok = Tokenizer.tokenizeProlog(buf, bufStart, bufEnd, this);
currentTokenStart = bufStart;
bufStart = getTokenEnd();
return tok;
}
catch (EmptyTokenException e) {
if ... |
9ebf391f-bef8-4dfe-99ee-ffc23132b95f | 9 | public static Type valueOf(int aCode) {
switch (aCode) {
case 0: return DISCONNECT;
case 1: return CONNECT;
case 2: return HEARTBEAT;
case 3: return MESSAGE;
case 4: return JSON_MESSAGE;
case 5: return EVENT;
... |
5644d4a9-04f2-4bbb-96b1-2bb66d88b27e | 0 | public int getId() {
return id;
} |
fdfd65c0-166c-4c5e-a596-029977c09367 | 1 | public static void updateInterlocuteur(int id,int idcommercial, int idville, int idservice, String nom, String prenom, String email) throws SQLException {
String query;
try {
query = "UPDATE INTERLOCUTEUR set ID_COMMERCIAL=?,ID_VILLE=?,ID_SERVICE=?,INTNOM=?,INTPRENOM=?,INTEMAIL=? WH... |
b10a000b-84b2-43be-962b-4c753843d8ee | 1 | public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ? (JSONObject)o : null;
} |
70fa40a0-4c9a-4750-a375-1d2fd3428fc4 | 2 | private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
try {
getDeviceInfo = false;
adbController.dispose();
} catch (IOException ex) {
logger.log(Level.ERROR, "An error occurred while attempting to dispose of ADBController... |
724e449f-cae7-412d-b38a-69cfb8b4f03f | 1 | public void garbageCollect() {
// Reset the heap allocation pointer to the start of toSpace:
hp = 0;
// Forward any objects that are pointed to by a, b, c, or d.
// These are the "roots" for our garbage collection.
a = forward(a);
b = forward(b);
c = forward(c);
d = forward(d);
// ... |
9803526f-a98e-4969-a2dd-66b38e1f4801 | 5 | private void updateEquipment(String id, String location, String member_id,
String date, String cost){
this.equipment.setID(id);
this.equipment.setLocation(location);
if(!member_id.equals("") && !member_id.equals("N/A")){
this.equipment.setLoan(true, member_id);
this.loanButton.setText("Return Equipmen... |
88cf491d-c068-45b2-bbf6-83d71dbc1683 | 2 | public void originalProbabilityPlot(){
if(!this.initializationDone)this.initialize();
double[][] data = PlotGraph.data(2,this.nData);
data[0] = this.gaussianOrderMedians;
data[1] = ((new ArrayMaths(this.standardizedOriginalData)).sort()).array();
data[2] = this.gaussianOrderMedi... |
412c7d8c-0faf-452b-a7d4-ce8e482ffcb2 | 5 | public void removeMassSpringNetwork() {
for (int i = masses.size() - 1; i >= 0; i--) {
if (masses.get(i).getType() == NETWORK) {
masses.remove(i);
}
}
for (int i = springs.size() - 1; i >= 0; i--) {
Spring spring = springs.get(i);
... |
9b8daf42-505f-4d13-a46c-1c284c209013 | 6 | public void cargarArbol() {
//inicializo el arbol
inicializarArbol();
//cargo las cuentas hijo
r_con.Connection();
int count = 0;
int aux = 0;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
parent1 = (De... |
b7cc3ae4-5ee1-4e18-bf62-26b076847bdc | 6 | public Walker(TileMap tm, int startingAction, String s){
super(tm);
moveSpeed = .3;
maxSpeed = 1;
fallSpeed = 0;
maxFallSpeed = 0;
width = 30;
height = 34;
cwidth = 30;
cheight = 34;
health = maxHealth = 1;
damage = 1;
invincible = false;
if(s.equals("right")){
facingRight = tru... |
3e47d622-78e1-494c-8377-320b6cec54fa | 4 | public static int dps2pdf(String srcPath, String destPath) {
File file = new File(srcPath);
if (file.exists()) {
ComThread.InitMTA();
ActiveXComponent dps = null;
try {
dps = new ActiveXComponent("WPP.Application");
Dispatch presentations = dps.getProperty("Presentations")
.toDispatch();
... |
4ed717f3-d935-4543-a754-246a7f1dfec5 | 4 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int MoveX = Main.DecodeInt();
int MoveY = Main.DecodeInt();
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
if(Main.Data.T... |
21eda6b4-6193-493d-878f-1900927084ff | 9 | public void sendMail(Map<String, Object> context) {
System.out.println(" :: SEND MAIL ::" + context);
boolean smtpUseSSLFlag = true;
String smtpUser = null;
String smtpPassword = null;
String from = (String) context.get("from");
String subject = (String) context.get("subject");
String smtpHost = null;/... |
94dd96c5-7328-4d21-9d0a-1757a344b901 | 9 | public int divide(int dividend, int divisor) {
int ans=0;
boolean sign=true;
if((dividend>0&&(divisor<0)) || (dividend<0&&divisor>0)){
sign=false;
}
long a=dividend;
long b=divisor;
if(a<0)a=-a;
if(b<0)b=-b;
while(a>=b){
int multi=1;
long... |
2a192ac1-d2dd-44d0-9f8a-c6bea28c8ad8 | 2 | private void playMedia() {
if(!LockedPlaylistValueAccess.lockedPlaylist) {
mediaPlayer.play();
if(isPaused == true) {
isPaused = false;
}
}
} |
e445b593-5b08-4729-8c0c-d9649c181984 | 5 | int getBits(int n) {
bitCount += n;
int val = 0;
int pos = bufferIndex;
if (pos + n < BUFFER_SIZE) {
while (n-- > 0) {
val <<= 1;
val |= ((buffer[pos++] != 0) ? 1 : 0);
}
} else {
while (n-- > 0) {
... |
3de80460-fa71-401f-8bfc-95b0c4fbb1bb | 2 | private void initBar() {
ButtonGroup group = new ButtonGroup();
JToggleButton button = null;
Iterator it = tools.iterator();
KeyStroke key;
while (it.hasNext()) {
Tool tool = (Tool) it.next();
button = new JToggleButton(tool.getIcon());
buttonsToTools.put(button, tool);
button.setToolTipText(tool.... |
b815cf0f-9d1d-4de6-81c8-547541547890 | 2 | public List<Release> getReleases(IRepositoryIdProvider repository, int start, int size) throws IOException {
String id = getId(repository);
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_RELEASES);
PagedReques... |
65fea117-8d25-4554-b4b4-ae74931cbd95 | 5 | public void CheckKey()
{
if(Greenfoot.isKeyDown("right"))
{
//direction = 1;
moveRight();
}
if(Greenfoot.isKeyDown("left"))
{
//direction = -1;
moveLeft();
}
if((Greenfoot.isKeyDown("up") || Green... |
40cecd9e-ddbe-41c0-a973-1a21705c0ac0 | 8 | public String contentIn(String l, String r, int i) {
if (parenNotMatch(r))
return "";
if (content[i] == null)
return "";
for (String c : content[i]) {
if (l.equals(c))
return "";
}
if (series[i] == null)
return "";
for (String s : series[i]) {
if (s.isEmpty())
continue;
Pattern p =... |
64c47fb3-7b14-41c1-a477-4d19df934647 | 6 | private void initGraphics() {
Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans"
barColor = getSkinnable().getBarColor();
barGradient = new ConicalGradient(new Stop(0.0, Color.TRANSPARENT),
... |
136984ef-61a5-440b-858b-a34e30397cb8 | 5 | private Class<?>[] createParamClassArray( JSONRPCRequest request )
throws JSONException,
JSONRPCException {
if( request.getParams() == null || request.getParams().isNull() )
return null;
if( request.getParams().isArray() ) {
return this.createParamClassArrayFromJSONArray( request.getParams().a... |
92150ba9-f5dd-4739-9346-62f7b207abc8 | 9 | int insertKeyRehash(int val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look un... |
e7726b3b-7252-49bb-a2ae-399e5250da1f | 8 | @Override
public void learnFromInstance(Instance inst, HoeffdingTree ht) {
this.observedClassDistribution.addToValue((int) inst.classValue(),
inst.weight());
if (this.listAttributes == null) {
this.numAttributes = (int) Math.floor(Math.sqrt(inst.numAtt... |
997f44ba-ee11-49e8-b37e-cc64b9c83f7c | 0 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String firstStr = in.readLine();
String secondStr = in.readLine();
isAnagram(firstStr, secondStr);
} |
44963751-ef7d-4520-90c6-76dcc38e5ed4 | 4 | public String getSuitAsString() {
switch ( suit ) {
case SPADES: return "Spades";
case HEARTS: return "Hearts";
case DIAMONDS: return "Diamonds";
case CLUBS: return "Clubs";
default: return "Joker";
}
} |
7f5c9ed2-b2ef-4344-9688-382524c714b0 | 1 | private static String fillString( String in, int len )
{
String out = new String(in);
while ( out.length() < len )
out = " " + out;
return(out);
} |
17ccd853-220f-430b-8dcf-973554365757 | 3 | public static void supprimerCategorie(Categorie categorie, Utilisateur utilisateur) {
if (!categorie.peutSupprimer(utilisateur))
throw new InterditException("Vous n'avez pas les droits requis pour supprimer cette catégorie");
EntityTransaction transaction = CategorieRepo.get().transaction()... |
1ac78e4b-5c3a-4398-bce4-34d0ce431851 | 7 | private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
... |
a967869d-9b06-410f-8c56-9c84ce33b5a2 | 4 | public void showMenu(CommandSender sender) {
sender.sendMessage("=======================");
for (String header : getHeader()) {
sender.sendMessage(header);
}
for (int i = 0; i < size(); i++) {
if (i == getIndex()) {
sender.sendMessage(" * " + get(i... |
23f1b0a2-53a7-4fa6-b09b-520d766832cb | 4 | @Override
public Tipo validarSemantica() throws Exception {
Tipo izq,der;
izq=izquierdo.validarSemantica();
der=derecho.validarSemantica();
if (izq instanceof TipoInt || der instanceof TipoFloat){
if (der instanceof TipoInt || der instanceof TipoFloat ){
r... |
2b04b374-e5e4-49d2-8aff-1d045be32701 | 4 | private int[] getResList()
{
Object[] resList = super.getLocalResourceList();
int resourceID[] = null;
// if we have any resource
if ((resList != null) && (resList.length != 0))
{
resourceID = new int[resList.length];
for (int x = 0; x < resList.length; x++)
... |
80e99ec1-26ed-450b-9aef-2ea6e5b1b892 | 9 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (StringTokenizer st; (st = new StringTokenizer(in.readLine()))!=null;) {
int a = parseInt(st.nextToken());
int b = parseInt(st.nextT... |
7d18c66d-bf96-431f-8176-aa4e71980669 | 0 | public ConcreteColleagueB(String name) {
super(name);
} |
ac79fbeb-b663-4aff-afde-1c91b1263b45 | 7 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
67130f12-147e-4d8f-8d3d-c777f53a6469 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof State)) return false;
State state = (State) o;
if (id != state.id) return false;
if (code != null ? !code.equals(state.code) : state.code != null) return false;
if (name != nu... |
18e71e97-c1f8-4ea7-8fd0-a6190be0f69f | 5 | private void loadAssetFileAsGAF() {
try {
File cache = new File(GameApplication.getGameDir() + File.separator + "assetCache");
if (!cache.exists()) {
cache.mkdirs();
}
FileInputStream in = new FileInputStream(assetFile);
FileOutputStre... |
eefb7455-2314-40ff-86bc-f340c0d6d391 | 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 Endereco)) {
return false;
}
Endereco other = (Endereco) object;
if ((this.idEndereco == null && other.idEndere... |
d0370a0f-2cb6-4ccc-ba5c-d71dd77ae73e | 3 | public void updateMarket(boolean init){
// randomly assign new news
//for (int j = 0; j < stocks.size(); j++) // FOR TESTING
// System.out.println(stocks.get(j).getTicker());
Random r = new Random();
if (r.nextInt(5) == 1 && !news.empty() && init)
applyNews();
priceUpdate();
update... |
d466d2e3-7f15-4165-8ed9-1288e7d46f80 | 7 | private void setLabel() {
if (modelClass == null || modelID == -1)
return;
String text = Modeler.getInternationalText("ScriptConsole");
if (text == null)
text = "Script Console";
text += ": ";
if (modelClass.equals(PageMolecularViewer.class.getName())) {
text += "Molecular Viewer";
}
else if (mod... |
1b6e30d4-0f82-4ea2-8f1d-32e015fb5304 | 1 | public final void pause() {
if (paused.compareAndSet(false, true)) {
synchronized (this) {
notify();
}
}
} |
b0c20643-b45c-47f4-894f-8856198a632b | 0 | public int getId() {
return this.id;
} |
f9c8226b-f2da-4285-b3eb-940265b9320e | 1 | @Test
public void testDecryptBlock() {
byte[] key = ByteHelper.convertBinaryStringToByteArray("1010011010111000011110011110100111011001100111111001100101110010".replace(" ", ""));
byte[][][] subKeys = new byte[][][] { KeyCalculator.generateSubKeys(key) };
byte[][][] reversedSubKeys = reverse... |
6c12b1d4-3821-4d75-80eb-af6c81b1a5f6 | 8 | public boolean addPlayer(Player player, Team team) {
if (team == null || player == null || ((redSpawn == null && team == Team.RED) || (blueSpawn == null && team == Team.BLUE)))
return false;
SuperBaseBattlePlayer superBaseBattlePlayer = new SuperBaseBattlePlayer(player, team);
return superBaseBattlePlayer.tele... |
84a8c318-a0f5-4d5b-8de6-5f46bc5e27bd | 0 | public void setPassword(String password) {
this.password = password;
} |
d8c5dc70-b394-475a-afec-e72413439b94 | 6 | public void phonemeChange(int from, String front, String back, int ftag, int btag, int phoneme) {
TNODE node = null;
int size = 0;
boolean x, y;
int next;
int nc_idx;
// searches the system dictionary for the front part
node = systemDic.fetch(front.toCharArray());
if (node != null && node.info_list !... |
038c4755-f9ef-41b0-abf6-d4b35b4550e1 | 0 | public void setjComboBoxPracticien(JComboBox jComboBoxPracticien) {
this.jComboBoxPracticien = jComboBoxPracticien;
} |
4362304c-c703-4832-83a5-f6be6bcb665c | 6 | public boolean writeHash(ByteBuffer buf, long hash) {
int size = getSize(hash);
if (size == -1) {
if (buf.remaining() < 9) {
return false;
}
add(hash);
buf.put((byte) 0);
buf.putLong(hash);
return true;
}
int prefix = (int) (hash >>> 56);
if ((prefix & 0xFC) == 0) {
if (buf.remaining(... |
269d9f0e-6ac3-4196-9b02-a39f7dd142c6 | 3 | public int validarDatos(String coleccion, String titleno, String ruta, String urlOlib, String urlDspace) throws ClassNotFoundException, SQLException{
modelo.Conectar conn = new modelo.Conectar("","");
// 1 = todo ok
// 2 = ruta mala
// 3 = colección mala
// 4 = emisión mala
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.