method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1d072b3b-4245-4bc7-aa9d-764311e864ed | 9 | @Override
public boolean make(PublicGameBoard board) {
BoardCoordinate c = _target.location();
int v = -1;
boolean exp = board.isExpanded();
int nv = (exp)? NUM_VERTICES_EXP:NUM_VERTICES;
Map<Integer, List<Integer>> x_gr = (exp)? X_GROUPS_EXP:X_GROUPS;
Map<Integer, List<Integer>> y_gr = (exp)? Y_GROUPS_EXP... |
ac6ae065-13ca-4cb1-94b8-bf15a319ab6b | 7 | public void NoiFile() {
FileInputStream fi = null;
FileOutputStream fo = null;
byte[] buffer;
String tenfile = fInfo.getTenfile().replace(".torrent", "");
LogFile.Write("#BEGIN NoiFile(): " + tenfile);
try {
fInfo.kiemTraVaTaoThuMuc(ThongTinC... |
ebb6dda8-91b7-47ed-9944-b50e25e53234 | 7 | private void generateRegions(){
for (int i = 0; i < size * .75; i ++){
// the ternary operator guarantees one of each region type and then the rest are random
int type = (i < 6) ? i : (int) (Math.random() * 6);
regions.add(new Region(type));
}
ArrayList<Tile> regionSeeds = new ArrayList<>();
while (... |
149988fa-c732-4d39-8d15-ed7b6ea8c052 | 9 | boolean sub(char[] t, int k, int ind){
//割り当てが終わったら式の評価ができる
if(ind==t.length){
id = 0;
s = exs.get(k).str[0];
double ex1 = exp();
if(ex1==1<<28)return false;
id = 0;
s = exs.get(k).str[1];
double ex2 = exp();
if(ex2==1<<28)return false;
//両辺が等しいとき、次の等式の評価に進む
if(Math.abs(ex1-ex2)<1e-6)r... |
c7e41d14-cf57-4c89-9d52-81cc8e279f7f | 3 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
if(e.getMessage() instanceof PrivateMessage) {
PrivateMessage pm = (PrivateMessage) e.getMessage();
int toId = pm.getToId();
PrivateMessage newPM = new PrivateMessage(userId, username, pm.getMessa... |
a047f1fc-561d-473f-9e24-f8cffd3ef0f1 | 7 | public boolean isInscrito(String matricula, String semestre) {
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
String sql = null;
int bandera = 0;
try {
con = EscolarConnectionFactory.getInstance().getConnection();
sql = "select ag.matricula from alumnos_x_grupo ag, g... |
fdb184e0-e463-4c1f-a230-4836fcaa11f1 | 7 | private int getNorm(Method m) {
String methodName = m.getName();
Class<?>[] argumentTypes = m.getParameterTypes();
int totalNorm = 0;
if (!referenceMethodName.equals(methodName)
|| referenceMethodArgumentTypes.length != argumentTypes.length) {
... |
4fe8e2a7-33ec-41d8-9662-6001270e2e6c | 2 | public static void triangle1(String s) {
char c[] = s.toCharArray();
for (int i = 0; i < c.length; i++) {
System.out.println();
for (int j = 0; j <= i; j++) {
System.out.print(c[j]);
}
}
} |
92a224a4-17f1-4665-8032-de008d9073cb | 7 | public final synchronized void paint(Graphics graphics) {
anInt18++;
if (this == Class348_Sub40_Sub9.anApplet_Sub1_9169 && !Class26.aBoolean384) {
BufferedRasterizer.aBoolean4726 = true;
if (Class367_Sub4.aBoolean7320 && (-Class348_Sub12.aLong6748 + Class62.getCurrentTimeMillis() ^ 0xffffffffffffffffL) < -1... |
ab690465-cdf5-49c9-80be-899190d569ce | 9 | @Override
public void Draw(Graphics2D g2d)
{
switch (gameState)
{
case PLAYING:
game.Draw(g2d, mousePosition());
break;
case GAMEOVER:
//...
break;
case MAIN_MENU:
g2d.drawImage(weatherVaneM... |
4b6b9f73-5f1c-4473-9b5f-9629770c8399 | 7 | static String toText (String s)
{ int m=s.length();
H.clear();
for (int i=0; i<m; i++)
{ char c=s.charAt(i);
if (c=='&')
{ if (find(s,i,"<"))
{ H.append('<');
i+=3;
}
else if (find(s,i,">"))
{ H.append('>');
i+=3;
}
else if (find(s,i,"""))
{ H.append('\"');
... |
9000c797-3afa-49ee-b6e5-7d4397c88377 | 5 | private void cityTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cityTextFieldKeyTyped
cityLabel.setForeground(Color.black);
int strLength = cityTextField.getText().length();
char c = evt.getKeyChar();
if (strLength == 30 || !(Character.isAlphabetic(c) || c == KeyEvent.... |
82caf9eb-c1cc-4a3a-8522-272ba1174436 | 4 | public void writeStartElement(String name)
{
try
{
if (lastElement == Elements.OPEN_TAG || lastElement == Elements.ATTRIBUTE)
{
xmlWriter.write(">\n");
}
else if (lastElement != Elements.STRING)
{
xmlWriter.w... |
074dd9bd-e8ce-443a-a48c-9044e011aa60 | 3 | public void setImage(){
switch(getStyle()){
case 1:
sprite = ResourceManager.getImage(TowerGame.SPRITESHEET_TELEPORTER_OFF);
break;
case 2:
//Will be an already on teleporter, need to find out how to add that animation
break;
case 3:
break;
}
} |
52ae26c1-3aee-4896-83bb-f7106d40f3c8 | 0 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
rtn.put("rtnCode", this.getRtnCode(200));
rtn.put("aNotification", Notification.nextSync(session.getActiveUserId()));
return rtn;
} |
8c7fc05e-5b9d-4771-9b61-f3a71f8b2a9b | 4 | public synchronized String finaliseQuiz(QuizServer quizAccess){
Iterator<Quiz> quizIterator=null;
Quiz quizToBeFinalised =null;
String winnerDetails=null;
try{
int qid=0;
System.out.println("Enter a quiz id to finalise:");
int quizId = Integer.parseInt(bufferedReader.readLine());
Set<Quiz> quizLi... |
41f221dc-b169-4b07-b72a-03d9f7ed65b8 | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
* The difference between this impl. and the previous is that, rather
* than creating and retaining a ma... |
1919239a-17e5-474e-89ed-a10eb49b48f2 | 2 | public void EvaluateHistory(GameHistory historyToEvaluate){
historyList.add(historyToEvaluate);
Iterator<BoardState> turnHistoryIterator = historyToEvaluate.getStateList();
int totalTurns = historyToEvaluate.getNumberOfBoardStates();
boolean wasLastTurnWin = historyToEvaluate.calculateLastStateWin();
... |
5f216a08-243a-4997-960a-1c4f888e8786 | 3 | public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
try {
tm.checkServerTrusted(chain, authType);
} catch(CertificateException e) {
Object[] answer = {"Proceed", "Exit"};
int ret = JOptionPane.showOptionDialog(null,
e... |
cc322bfe-e4e5-44df-97e3-d5f009a6ac44 | 6 | public int[] displayStatistics() {
int statistics[] = new int[5];
int total_launched_missiles = 0;
int total_destroyed_missiles = 0;
int total_missiles_hit = 0;
int total_destroyed_launchers = 0;
int total_damage = 0;
int size_launcher = getMissileLaunchers().size();
int size_missiles;
Launcher l;
... |
58fe704c-75ed-4f28-9847-a3c0341b6432 | 2 | public double[] sumRows() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
double data[][] = getDataRef();
double[] result = new double[nRows];
for (int r = 0; r < nRows; r++) {
result[r] = 0;
for (int c = 0; c < nCols; c++) {
... |
13676bc3-8577-4a35-97f2-b17f6124721b | 5 | @Override
protected void move()
{
super.move();
//Logger.debug("Pixel coordinates: "+this.getPixelX()+" ("+this.getX()+") / "+this.getPixelY()+" ("+this.getY()+")", "Component.move");
this.border.setPosition(this.getPixelX(), this.getPixelY());
if(this.xsb != null) this.xsb.setPosition(this.getPixelX()+Set... |
3511b914-cb53-461d-83b2-b58ea23c8839 | 1 | public void draw(Graphics g) {
for (int i=0; i < edges.size(); i++) {
edges.get(i).draw(g);
}
} |
7a6b0e41-1a5a-4815-a378-4d6ffb1d2a61 | 7 | public void runInstaller(String installer) {
ProcessBuilder builder = new ProcessBuilder(installer, "/S");
try {
//for Windows XP:
builder.start().waitFor();
} catch (Exception e) {
try {
//for Windows 8:
if (System.getProperty("os.version").equals("6.2"))
{
File file = new File(install... |
5557712e-425a-4020-bb27-89cec7f03ab3 | 2 | public void accept(final MethodVisitor mv) {
int[] keys = new int[this.keys.size()];
for (int i = 0; i < keys.length; ++i) {
keys[i] = ((Integer) this.keys.get(i)).intValue();
}
Label[] labels = new Label[this.labels.size()];
for (int i = 0; i < labels.length; ++i) {
labels[i] = ((LabelNode) this.labels... |
1c80706a-6ce0-42c2-99ef-df945d2f0bbe | 9 | @Override
protected void Load() {
if (world != null) {
int[] pixels = world.getPixels();
width = world.getWidth();
height = world.getHeight();
tiles = new Tile[width][height];
if (pixels != null) {
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int col = pixels[x +... |
f6d45265-060a-479f-a221-ce3eb98ff71b | 2 | public static <K extends Comparable<? super K>, V > Map<K, V>
sortByKey( Map<K, V> map )
{
List<Map.Entry<K, V>> list =
new LinkedList<Map.Entry<K, V>>( map.entrySet() );
Collections.sort( list, new Comparator<Map.Entry<K, V>>()
{
public int compare( Map.Entry<K, V> o1, Map.Entry<K, V> o2 )
{
retu... |
f5c389cd-fb6e-45f2-902f-12a61a9f6f4e | 6 | private static void addDirectoryToCompileList(File dir, List<File> list) {
File[] files = dir.listFiles();
assert files != null;
for (File f : files) {
if (!f.isDirectory()) {
int code = checkAndAddFile(list, f);
if (code == 0) {
M... |
75debf4e-c146-40c2-a523-794bfc60ebfb | 8 | public Object evaluate(ArrayList<Context1> pila) throws Exception{
if ((Boolean)condicion.evaluate(pila)==true)
{
System.out.println("Se cumple la condicion");
for (Evaluator e: lista)
{
if (e!=null)
{
if(e instanceof ReturnEvaluator)
{
bandera = true;
re... |
ef097c03-4aed-465e-ab11-a41c88ca64b0 | 7 | public static void main(String[] args) {
try {
_11_StormyInning si = new _11_StormyInning();
si.atBat();
} catch (PopFoul e) {
System.out.println("Pop foul");
} catch (RainedOut e) {
System.out.println("Rained out");
} catch (BaseballException e) {
System.out.println("Generic baseball exception")... |
1d905baf-93a4-470c-80bc-f9a63de74e50 | 3 | public Li(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "type":
type = Type.parse(this, v);
break;
case "value":
value = Value.parse(this, v);
break;
}
... |
8b9f5b20-eb8b-4a53-a219-d3a623dd3199 | 4 | public void agregarproducto(producto p) {
Conexionbd.conexion bd;
bd = new Conexionbd.conexion();
bd.conectarBase();
try {
Proveedor pr= new Proveedor();
pr = p.getProvee();
// if(pr==null)
// System.out.print("coso");
... |
5765ccb1-fdb8-490e-9a25-d85b18e79069 | 5 | private boolean checkMonopoly()
{
if (group.size() == 2)
{
if (group.get(0).owner == group.get(1).owner) return true;
}
else if (group.size() == 3)
{
if (group.get(0).owner == group.get(1).owner &&
group.get(1).owner == group.get(2).owner) return true;
... |
00e8a137-ea33-44ef-a739-9d67da45c809 | 2 | public void load(String url) {
if(!loadedFiles.contains(url)) {
try {
inputStream = new DataInputStream(new FileInputStream(url));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
loadedFiles.add(url);
run();... |
62b7ee18-5f14-4cb3-9b0d-faefccba284b | 8 | GenericResidueTemplates() throws Exception {
FileInputStream is = new FileInputStream( EnvironmentVars.getDataDir().concat(grFilename) );
BufferedReader bufread = new BufferedReader(new InputStreamReader(is));
String curLine = null, tmpName = null;
int dumPresent = 0;
numGRs = 0;
grResidues = new Residue[M... |
c1f28d12-3886-40b8-9c5a-02f45d315de3 | 0 | @Override
public void componentHidden(ComponentEvent e) {
// TODO Auto-generated method stub
} |
3b8331da-a4e6-41ce-a690-1c26e04509b6 | 8 | private void updateDebugProfilerName(int par1)
{
List var2 = Profiler.getProfilingData(this.debugProfilerName);
if (var2 != null && var2.size() != 0)
{
ProfilerResult var3 = (ProfilerResult)var2.remove(0);
if (par1 == 0)
{
if (var3.name.l... |
e5a193ef-949d-406e-b377-295a818c8ac7 | 8 | private void doMessage(final OfflinePlayer oPlayer, final VoteHistory vote) {
if (!plugin.getPluginConfig().isShowBroadcast()) {
return;
}
List<String> translatedList = new ArrayList<String>();
if (vote.hasEcon() && vote.hasItem()) {
List<String> msgList = plugin.... |
5c072b74-ad5d-4c5e-9e1b-b177d453db8c | 0 | @Override
public byte[] generate(int targetLength, int preferredPadding) {
return new byte[0];
} |
154bdb1b-70b2-4b30-98f0-d4759c94ea85 | 9 | private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
String agcoopCompany = "maininterface.ViewCompany";
String agcoopMember = "maininterface.ViewMember";
String agcoopSupplier = "maininterface.ViewSupplier";
String agcoopNo... |
4da73ad5-14f2-4734-b666-b52f6b963d0d | 2 | public static int getIntFromString(String input) {
int retVal = 0;
Integer n = getIntegerFromString(input);
if (n != null)
retVal = n.intValue();
else if (input != null)
retVal = input.hashCode();
return retVal;
} |
ce233342-485d-41fb-a741-e6334502cd32 | 9 | private Expression minus( List<Expression> args, String caller ) {
boolean ints = true;
boolean intsOrDecimals = true;
if ( args.size() < 2 ) {
System.err.println("- expected at least two arguments and got " + args.size() );
return new Void();
}
for ( int i... |
1249b353-20dd-4768-89c6-7010e7c4d464 | 8 | public static void main( String[] args )
{
System.out.println( "NanoHTTPD 1.0 (c) 2001 Jarno Elonen\n" +
"(Command line options: [port] [--licence])\n" );
// Show licence if requested
int lopt = -1;
for ( int i=0; i<args.length; ++i )
if ( args[i].toLowerCase().endsWith( "licence" ))
{
lopt = i;... |
dbb11c42-d17b-4db1-b405-e2a640c4a01d | 3 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long activeUserId = session.getActiveUserId();
long appointmentId = Long.valueOf(params.get("id"));
Appointment a = Appointment.findById(appointmentId);
if(a==null){
rt... |
920905e2-1366-4b8a-bcf3-1d3b53d786d9 | 7 | private void updateMinMax (Instance instance) {
// for (int j = 0; j < m_numAttribs; j++) {
try {
for (int j = 0; j < instance.numValues(); j++) {
if ((instance.attributeSparse(j).isNumeric()) &&
(!instance.isMissingSparse(j))) {
if (Double.isNaN(m_minArray[instance.index... |
10358347-e6a9-44c3-95be-a44315b3ab8e | 8 | public Set<Map.Entry<Byte,Double>> entrySet() {
return new AbstractSet<Map.Entry<Byte,Double>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TByteDoubleMapDecorator.this.isEmpty();
}
p... |
7b4e6a91-35f3-40bc-8d48-9ddba52ed58a | 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;
} |
18657fa5-c558-4520-bf65-3d85f0197d93 | 1 | public void init(boolean forEncryption, KeyParameter params)
{
if(params instanceof KeyParameter)
{
workingKey = ((KeyParameter) params).getKey();
setKey(workingKey);
return;
}
throw new IllegalArgumentException("in... |
77d6a9c7-6a5f-41f4-969a-bed8c4c414c6 | 9 | protected Color getGapColor(int tabIndex) {
if (isTabOpaque() || tabIndex == tabPane.getSelectedIndex()) {
if ((tabIndex >= 0) && (tabIndex < tabCount)) {
Color tabColors[] = getTabColors(tabIndex, tabIndex == tabPane.getSelectedIndex(), false);
if (tabColors != null ... |
98a0fed5-7fcc-45a1-a72a-b2d3c348f5a0 | 1 | InsnListIterator(int index) {
if(index==size()) {
next = null;
prev = getLast();
} else {
next = get(index);
prev = next.prev;
}
} |
5eab4169-79aa-4937-b339-f8fadc4ad2e1 | 7 | public byte[] decodeMIO0Block(byte[] array, int baseAddress) {
int mapByte = 0x80;
int outputSize = Utils.readInt(array, baseAddress + 4);
int mapLoc = baseAddress + 16;
int compLoc = baseAddress + Utils.readInt(array, baseAddress + 8);
int rawLoc = baseAddress + Utils.readInt(array, baseAddress + 12);... |
ecc91cf9-5dd2-473f-91b4-b410716a88e9 | 3 | private void initMenu()
{
JMenu [] menu = new JMenu[4];
menu[0]= new JMenu("File");
menu[1]= new JMenu("Edit");
menu[2]= new JMenu("Execute");
menu[3] = new JMenu("Settings");
JMenuItem jmiOpen = new JMenuItem("Open");
JMenuItem jmiSave = new JMenuItem("Save"... |
1438b9b6-77cb-4627-9da4-76de5f2443c9 | 1 | public void testMinus_Weeks() {
Weeks test2 = Weeks.weeks(2);
Weeks test3 = Weeks.weeks(3);
Weeks result = test2.minus(test3);
assertEquals(2, test2.getWeeks());
assertEquals(3, test3.getWeeks());
assertEquals(-1, result.getWeeks());
assertEquals(1, Weeks... |
c3892be1-efa8-462d-aed9-e9ecea321296 | 5 | public static List<Long> getIds(final Map<Long, String> qcIdNames,
final List<String> qcNames)
{
List<Long> ids = new ArrayList<Long>();
List<String> qcNameCopies = new ArrayList<String>();
qcNameCopies.addAll(qcNames);
for (Map.Entry<Long, String> me : qcId... |
8c09cb3a-ed58-4f9c-b2fa-08b22d2b4f10 | 3 | @WebMethod(operationName = "ReadBranch")
public ArrayList<Branch> ReadBranch(@WebParam(name = "bra_id") String bra_id) {
Branch bra = new Branch();
ArrayList<Branch> bras = new ArrayList<Branch>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!bra... |
d39bce47-865c-4e59-9d84-566459c3c3d8 | 2 | protected void saveGameState(Command command)
{
if(undo_index != undoList.size())
{
//override the available redos
for(int i = undoList.size(); i > undo_index; i--)
{
//remove the saved state
undoList.remove(i-1);
}
}
undoList.add(command);
undo_... |
e5b8ce22-cfcb-4ab8-bc58-ea0087a8ebdf | 5 | public static List<Goal> applyBackwards(Formula conclusion, Theorem t) {
ArrayList<Goal> list = new ArrayList<Goal>();
if(!conclusion.getClass().equals(Implies.class)) {
for(Formula k : t.getKnowledge()) {
if(Or.class.isInstance(k)) {
Or f = (Or) k;
if(!(t.inKnowledge(f.left()) || t.inKnowledge(f.... |
bb53b1aa-de57-4630-8bad-d0e622cb52d4 | 2 | public String loginPlayerToServer(String username, String x, String y) {
// Attempt to write out to the server
// And receive the server's response.
try
{
outToServer.println("LOGIN " + username + " " + x + " " + y); // Write data out to server
String replyFromServer = inFromServer.readLine();
if(repl... |
21379d6a-a42a-4e6e-9cfc-192fc2b1e8ea | 0 | public void decoder(int[] octets_data){
} |
d6570a7e-695d-47a5-ba64-d1fdb72996eb | 9 | public void update(double delta) {
if (toggleDelay.over(delta) && toggleKey.isDown()) {
toggleDelay.reset();
toggleVisibility();
}
if (!isShowing()) {
return;
}
boolean canMove = moveDelay.over(delta);
if (canMove && upKey.isDown()) {
getCurrentMenu().move(-1);
moveDelay.reset();
}
if (... |
9ef4f98b-24bb-4915-8232-8fb58f874469 | 0 | public static void loadFile(String imageURL, String dir, String fileExt){
LoadNetFile lf = new LoadNetFile();
String[] splits = imageURL.split("/");
lf.setLoadData(
imageURL,
dir, splits[splits.length-1] + fileExt);
lf.startLoad();
} |
aaeb8f26-a22c-4fa3-8463-53db60bdc1c7 | 6 | public void addInterface(HardwareInterface<? extends Message> iface)
throws Exception {
if (iface.getNode() != this)
throw new Exception("Interface already belongs to another host");
if (ifaces.contains(iface))
throw new Exception("Host already contains this interface [" + iface + "]");
ifaces.... |
e8dca877-927f-474a-a513-d2e8ec11777c | 2 | public boolean has(Class cl)
{
boolean has = false;
for(AbstractMatter e : list)
{
if(e.getClass().getSuperclass() == cl)
{
has = true;
}
}
return has;
} |
ed3a26b7-913a-4b77-830f-7d4022a109d3 | 0 | public static void IntroduzDados(){
String valor, descricao;
valor=JOptionPane.showInputDialog("Insira o valor da despesa:");
descricao=JOptionPane.showInputDialog("Insira a descrição da despesa:");
} |
b1f4337d-3405-4129-bba3-765ea0775674 | 2 | public void pin( int frameNo ) throws InvalidFrameNumberException
{
if ((frameNo < 0) || (frameNo >= (int)mgr.getNumBuffers())) {
throw new InvalidFrameNumberException (null, "BUFMGR: BAD_BUFFRAMENO.");
}
(mgr.frameTable())[frameNo].pin();
state_bit[frameNo].state = Pinned;
} |
664aada5-2c2e-45bb-a0cf-8ea02a9da377 | 8 | private void showTP() {
Object o = logic.showTPStatus();
if (o instanceof Feedback) {
JOptionPane.showMessageDialog(null, ((Feedback) o).getContent());
} else if (o instanceof TPDeptVO) {
if (((TPDeptVO) o).isCommitted) {
lb.setLabelText(((TPDeptVO) o).fileName);
lb.setForeground(Color.BLUE);
lb... |
77ce6b60-5b00-4914-82be-a6cfc603a1e0 | 0 | public void setAccessToken_secret(String accessToken_secret) {
this.accessToken_secret = accessToken_secret;
} |
ef5a4ebb-540e-4611-b635-b8e32f73f6d8 | 3 | @Override
public List<Tyopaiva> haeTyopaivat(Calendar alku, Calendar loppu) {
ArrayList<Tyopaiva> loydetytTyopaivat = new ArrayList<>();
Calendar d = alku;
d.set(Calendar.DATE, alku.get(Calendar.DATE) - 1);
for (Tyopaiva tyopaiva : loydetytTyopaivat) {
if (tyopaiva.getAlk... |
54dff0d4-1812-488a-a0eb-ef8811b6b9f1 | 0 | public int hashCode(){
return this.cityMap.hashCode();
} |
2f7e709e-a2cc-4091-a4ef-bed05b86a4f1 | 1 | public final int stackSize() {
int size = returnType.stackSize();
for (int i = 0; i < parameterTypes.length; i++)
size -= parameterTypes[i].stackSize();
return size;
} |
1c0c573b-e158-4938-bb24-7fa91b236b2f | 2 | public ArrayList<Integer> haeVuodet() throws DAOPoikkeus {
//avataan yhteys
Connection yhteys = avaaYhteys();
String sql = "SELECT YEAR(pvm) AS vuosi FROM Tilaus GROUP BY YEAR(pvm)";
ArrayList<Integer> vuodet = new ArrayList<Integer>();
try {
Statement haku = yhteys.createStatement();
Resu... |
a38c63f9-55df-4889-8670-e9150b644f15 | 6 | @Override
public Sentence doProcess(Sentence st) {
String prevTag = null;
boolean changed = false;
Eojeol[] eojeolSet = st.getEojeols();
for (int i = 0; i < eojeolSet.length; i++) {
String[] tags = eojeolSet[i].getTags();
prevTag = "";
changed = false;
for (int j = 0; j < tags.length; j++... |
c3f41414-aff6-4f22-bd13-adf0e0ca8205 | 0 | public void shouldDrawStateLabels(boolean drawLabels) {
this.drawLabels = drawLabels;
} |
914e25de-32b4-4325-b317-f987715e9186 | 8 | static int process(String line) {
int cnt = Integer.parseInt(line.trim());
if(cnt == 0)
return 0;
String[] inp = new String[cnt];
for(int i = 0; i < cnt; i++) {
inp[i] = readLine().trim();
}
int[] prev = new int[cnt];
System.out.println(String.format("Case %d:", casen));
for(int i = 0; i < cnt;... |
8aa943e4-fd0e-4a80-9486-eac1fe334ede | 5 | public String stateDesc() {
if ((state == STATE_RESTING || state == STATE_ACTIVE) && bleeds) {
return "Bleeding" ;
}
if (state == STATE_RESTING && ! asleep()) {
return "Stable" ;
}
return STATE_DESC[state] ;
} |
1e2c1cc7-a67b-4253-ac06-367f0dfa9242 | 7 | public static Tape importTapeFromFile(File f) throws FileNotFoundException, TuringException
{
Scanner s = new Scanner(f);
int instructionCount=0;
try
{
instructionCount = Integer.parseInt(s.nextLine());
}
catch(NumberFormatException ex)
{
throw new TuringException("Could not import file: Number ... |
5cce02f9-07c5-49bb-bc80-0a42755b22ea | 1 | public double fitness(){
double sum = 0;
double F,f,c,k;
k=2;
for(int i = 0; i < bins.size(); i++){
f = bins.get(i).getFilled();
c = bins.get(i).getCapacity();
sum = sum + Math.pow(f/c, k);
}
F = sum / bins.size();
return F;
} |
cf0c8dff-5fd3-412c-a910-9ce5ca028db2 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected==null)||(!(affected instanceof MOB))||(invoker==null))
return true;
if(affected==invoker)
return true;
final MOB mob=(MOB)affected;
// preventing distracting player from doin anything else
if(msg.amISource(... |
61003cd2-0cb1-4b62-afd1-d63cab00ea77 | 9 | private boolean addToSymbolTable(String key, String name, String kind, IData data) {
for (Symbol temp : symbolTable.values()) {
if (temp.getValue().equals(name) && temp.getScope().equals(scope)) {
if (kind.equals(LITERAL)) return true;
errorList += "duplicate symbol... |
a6b35f76-1eb4-4d2e-8435-6a7325f76f65 | 4 | @Override
protected final JScrollPane initCenter(
final Map<Integer, DragObject<JPanel, JPanel, JPanel>> trackList) {
final JPanel panel = new JPanel();
final TreeSet<DropTarget<JPanel, JPanel, JPanel>> set = new TreeSet<>();
for (final DragObject<JPanel, JPanel, JPanel> o : trackList.values()) {
for (fina... |
56f2fa58-f2a4-47d1-aada-21a3e9cc0dc8 | 8 | @Override
public void start(AudioFormat playFormat) {
try {
/* Get the line to play from. */
line = getLine(playFormat);
if (line != null) {
// Start the line
line.start();
// Figure out how big of an internal buffer the line has
// We will read from the main buffer in chunks of this si... |
74f82888-6f3d-4ebb-b5f2-253a5d2a2a04 | 0 | public void setDocumentInfo(DocumentInfo docInfo) {
this.docInfo = docInfo;
} |
a359ffaf-751c-4536-8ff8-6e2902b18e51 | 5 | static private BTJsonObj recurse(JsonElement el, String term) {
if(term.isEmpty()) {
if(el.isJsonObject()) {
return new BTJsonObj(el.getAsJsonObject());
} else {
return null;
}
}
if(!el.isJsonObject()) {
return null;
}
int li_index = term.indexOf('.');
String lstr_part = term;
... |
c727cbb1-6611-44df-a7e6-7c1f8d6c918b | 8 | private Weibo parseToWeiboQq(JSONObject info) {
Weibo weibo = new Weibo();
// weibo.setGeo_lat(geo_lat);
// weibo.setGeo_lon(geo_lon);
try {
String geo = info.getString("geo");
// System.out.println("geo is "+geo);
String text = info.getString("text");
if (text.equals("") || text == null) {
text ... |
e00107b7-1358-4148-8206-797398f4576f | 8 | static Object[][] divide(Object[][] x, Object[][] y) {
Object[][] ret = new Object[x.length][];
for (int i = 0; i < x.length; i++) {
ret[i] = new Object[x[i].length];
for (int j = 0; j < x[i].length; j++) {
Object a = x[i][j];
... |
db3fa0f4-6946-433b-90e6-d7fe42a9f15e | 4 | public static void sort(int[] array) {
printArray(array);
int a = 0;
boolean finished = true;
for (int i = 0; i < array.length; i++) {
finished = true;
for (int j = i % 2; j < array.length - 1 - i % 2; j += 2) {
if(array[j] > array[j + 1]) {
a = array[j + 1];
... |
5bb2036c-ce66-49a3-91d9-50d9688f9c9b | 0 | public boolean getDirFilterIncludeIgnoreCase() {
return this.dirFilterIncludeIgnoreCase;
} |
60d3e4db-1539-42d8-b5f3-b6a4978b06ca | 5 | @Override
public void paintComponents(Graphics g) {
if (!this.skin.getBrandingPosition().equals(Position.NONE)) {
Graphics g2 = g.create();
int x, y;
int w, h;
Rectangle bounds = this.parent.getBounds();
if (this.skin.isChanged() || (this.brandin... |
ccdfb447-da44-4b1e-aa6a-859c362b4421 | 5 | public void createCutSceneOne() {
try {
portrait = (ImageIO.read(new File(
"res/Cutscene/CutSceneWarrior.gif")));
} catch (Exception e) {
System.out.println("Boo!");
}
dialogue = ("Testing, testing, 1 2 3~!");
cutscene1.add(new CutScene... |
b55f084a-f0d0-4a57-a6da-01e9056cc835 | 9 | public void tick()
{
for(Integer i = 0; i < Main.CPU_COUNT; ++i)
{
Integer waitingTime = waitingTimes.get(i);
Process currentProcess = runningProcesses.get(i);
if(waitingTime > 0)
{
// The CPU is currently waiting
waitin... |
e4fa5671-98e8-420f-8ac0-be2fbae27daf | 6 | public boolean equals(Object other)
{
if(other==null || !(other instanceof Mossa))
return false;
Mossa mos=(Mossa) other;
if(percorso.length!=mos.percorso.length)
return false;
for(int i=0;i<percorso.length;i++)
{
if(percorso[i].getRiga()!=mos.percorso[i].getRiga() || percorso[i].getColonna... |
fc9998a2-cb65-421e-8d7a-91e393506d98 | 7 | public static void pointMutation(String[] args) {
final String ID = args[0];
ExecutorService exec = Executors.newFixedThreadPool(Runtime
.getRuntime().availableProcessors());
System.out.println("Start with "
+ Runtime.getRuntime().availableProcessors() + " threads");
try {
// test with following mu... |
7aaa6bfb-180a-47d9-abc6-7cc7c0c355d2 | 2 | public synchronized int baseNumberPreMRna2Pos(int baseNum) {
for (Exon eint : sortedStrand()) {
if (eint.size() >= baseNum) return eint.getStart() + baseNum;
baseNum -= eint.size();
}
return -1;
} |
496ebf66-be75-43d3-80a3-9b05d6614137 | 3 | private void removeValueFromTree(String valueToRemove){
Iterator<String> it = _tree.keySet().iterator();
while(it.hasNext()){
String parent = it.next();
ArrayList<String> values = _tree.get(parent);
if(values.contains(valueToRemove)){
//System.out.println("Removed value " + valueToRemove + " from p... |
60188e38-9df2-42c0-a060-5d5e0c3515f9 | 8 | void Export(int dim, int pos) {
ImagePlus myim=null;
if (dim >= 0)
{
if (colormode)
myim=getDisplayedSlice(dim,pos).ColorExport();
else
myim=getDisplayedSlice(dim,pos).Export();
}
else
{
if (ActElement() instanceo... |
713b3c12-0dd9-42f7-9938-981162b242d1 | 5 | public double palindromo(int c)
{
double mayor = 0;
int oper1 = 0;
int oper2 = 0;
for(double n1 = Math.pow(10, c) - 1; n1 > 1; n1--){
for(double n2 = Math.pow (10, c) - 1; n2 > 1; n2--){
if(n1 * n2 > mayor){
if(compr... |
d0f6398c-9e77-4770-9b3e-4bd67cc1b7ec | 3 | private final static Path getHome() {
final String home_ = System.getProperty("user.home");
switch (FileSystem.type) {
case UNIX:
// case LINUX:
return Path.getPath(home_.split(FileSystem.OSType.UNIX.sepFile));
case WINDOWS:
if (FileSystem.type.subtype.equals("Windows Vista")) {
// workaround for b... |
03fb1d0f-e271-4458-b846-6add10946ffc | 4 | public static Point getMovementCellLocation(Point currentLocation, Map.Direction movementDirection) {
Point movementCellLocation = (Point) currentLocation.clone();
switch (movementDirection) {
case UP:
movementCellLocation.y -= 1;
break;
... |
243880ec-d166-4532-9a1d-fcb427128b02 | 6 | public int getNewCaseClassLabel(List<Case> Neighbors,Case NewCase)
{
int ClassLabel = -1;
int nuberofNeighbors;
int tempClass;
int []classShows;
//allocate memory for 10 integers
classShows = new int[10];
//initialize the values of the matrix classShows
for (int i=0; i<=9;i++)
{
classShows[i... |
d69a6c95-19db-4cc8-a887-cc7b889bc9a2 | 8 | @SuppressWarnings("CallToThreadDumpStack")
public static Parametros leer(String direccionArchivo){
Parametros parametros = new Parametros();
try {
FileInputStream fIStream = new FileInputStream(direccionArchivo);
DataInputStream dIStream = new DataInputStream(fIStream);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.