method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
db9dcbf2-e1a3-43bc-ab52-81af8fcd2a42 | 4 | public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(
new InputStreamReader(System.in));
String line = "";
StringBuilder sb = new StringBuilder();
int f = 0;
d: do {
BigInteger aux = new BigInteger("0");
line = buf.readLine();
if(line==null || line.l... |
1935b421-c3e2-4280-8151-b1c418775827 | 1 | private static String getCitedBy(Element e) {
Elements fl = e.getElementsByClass(THSIS_CITIEDBY_CLASS);
String text = fl.select("a[href]").first().text();
// 查找文本中包含的数字
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(text);
String citedBy = "0";
while (matcher.find()) {
cit... |
4439336d-15fa-4e4a-b4fa-1d2abdde524f | 3 | public String generateRandomFarg()
{
int fargCode = new Random().nextInt(3);
String farg = null;
switch(fargCode)
{
case 0:
farg = "röd";
break;
case 1:
farg = "blå";
break;
case 2:
farg = "gul";
break;
default:
farg = null;
break;
}
return farg;
} |
94d85a26-080d-4c07-b8cb-1136b88424dc | 6 | private void setScaledImage(Image background, String key) {
if (background != null) {
float iw = background.getWidth(this);
float ih = background.getHeight(this);
float pw = getWidth(); //panel width
float ph = getHeight(); //panel height
if (pw < iw || ph < ih) {
... |
c0aa6ab2-8ca5-4d63-b5df-a8d634d7c767 | 2 | public List<Event> getEvents(String artistName) throws IOException, EncoderException {
String data = client.getData(artistName);
return !(data == null || data.isEmpty()) ? dataHandler.parsJsonToEvents(data) : null;
} |
ee6583e4-63b0-4fca-ba33-f8d8e842cc83 | 9 | public static void print(byte type, String msg) {
if (!systemShow && type == system)
return;
if (!loadShow && type == error)
return;
if (!debugShow && type == debug)
return;
if (type == system) {
System.out.print("[System]: ");
}
if (type == error) {
System.out.print("[Error]: ");
}
if ... |
0bc3be5f-3600-47dd-97b7-835ca52b4f5d | 5 | public ViewRestaurant(String str) {
super();
this.setLayout(null);
this.name = str;
// Title
JLabel title = new JLabel(str, JLabel.CENTER);
title.setBounds(200, 0, 700, 50);
title.setFont(title.getFont().deriveFont(32f));
this.add(title);
// Back button
btn1 = new JButton("Back");
btn1.setBounds... |
94991575-70de-4991-8ecd-27ec6f6b11e0 | 5 | private ActionListener createInviteListener() {
// create a dialog to let user input ip, port and invitation type
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PeerStatus status = LocalInfo.getPeerStatus();
if... |
bae6b9d5-7656-41dc-af84-975917dfe618 | 2 | public static MethodType tMethod(String signature) {
int hash = signature.hashCode();
Iterator iter = methodHash.iterateHashCode(hash);
while (iter.hasNext()) {
MethodType methodType = (MethodType) iter.next();
if (methodType.getTypeSignature().equals(signature))
return methodType;
}
MethodType meth... |
eff106ea-15d2-4351-8603-ab15ff4b1be0 | 7 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
final String rest=CMParms.combine(commands,1);
Environmental target=mob.location().fetchFromRoomFavorMOBs(null,rest);
if((target!=null)&&(!target.name().equalsIgnoreCase(rest))&&(rest.length()<4))
... |
4197deee-db49-46ff-a0b4-4cb83023f531 | 7 | @Override
public void actionPerformed(ActionEvent arg0) {
String actionName = arg0.getActionCommand();
String serviceName = null;
String user = null;
if (column == 1) {
user = ((String) table.getValueAt(row, column)).split("\\s+")[0];
serviceName = (String) table.getValueAt(row, column - 1);
} else {
... |
e1dc7beb-a1ac-4a22-b041-a9505a2ca3c8 | 4 | @EventHandler
public void onEntityExplode (final EntityExplodeEvent event){
if (!plugin.isEnabled()) return;
if (event.isCancelled()) return;
for (Block block : event.blockList()){
if (plugin.blockListener.relevantSign(block)){ // Have no Player to offer here...
event.setCancelled(true);
plugin.... |
cfe77a7e-1830-4d77-82ee-aa2fd6dce9dc | 8 | final public void Expression() throws ParseException {/*@bgen(jjtree) #ConditionalNode( false) */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTCONDITIONALNODE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
Sequence();
} catch (Throwable jjte000) {
if (jjtc000) {
... |
2a45d66f-c4cc-49f9-8c6b-63c28453b7e4 | 2 | public double[] columnSums(){
double[] sums = new double[this.numberOfColumns];
for(int i=0; i<this.numberOfColumns; i++){
sums[i] = 0.0;
for(int j=0; j<this.numberOfRows; j++){
sums[i] += this.matrix[j][i];
}
}
... |
d8be89f4-4487-4a72-86d2-477f1659e013 | 0 | public void testQuardraticParabolaEquation() {
Point[] points = new Point[] { new Point(3, 0), new Point(-3, 0),
new Point(0, 6) };
QuadraticParabolaEquation equation = QuadraticParabolaEquation
.newInstance(points);
assertEquals(6, equation.getY(0), 0);
} |
dcfcb811-3501-47ab-bd42-b3581ccade18 | 2 | public void adicionaTurma(int numero) throws TurmaJaExisteException {
for (Turma t: this.turmas){
if (t.getNumero() == numero){
throw new TurmaJaExisteException("Já existe a turma de número:"+numero);
}
}
Turma t = new Turma(this, numero);
this.turmas.add(t);
} |
ef05b738-0c80-499b-98af-3b15a716d1d6 | 7 | public void update(Node rootNode, Camera cam, Nifty nifty, HashMap<String, StreetInfo> streetInfoMap){
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
currentTime = sdf.format(cal.getTime());
Ray ray;
Collis... |
10920b78-4237-413d-b843-4abaa7aac2d3 | 5 | public void destroy(String id) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Roles roles;
try {
roles = em.getReference(Roles.cl... |
40f630bc-79e4-4c8b-8237-20451831293a | 8 | public MOB getElligibleOfficer(Law laws,
Area myArea,
MOB criminal,
MOB victim)
{
final Room R=criminal.location();
if(R==null)
return null;
if((myArea!=null)&&(!myArea.inMyMetroArea(R.getArea())))
return null;
MOB M=getElligibleOfficerHere(laws,myArea,R,criminal,victim);... |
d880bd6e-8922-4294-b61d-d0d2cec2e5f7 | 5 | public boolean checkGoal(State state) {
for (int k = 0; k < state.getData().size(); k++) {
for(int m = 0; m < state.getData().get(k).size(); m++) {
if (state.getData().get(k).get(m).equals("$") || state.getData().get(k).get(m).equals(".")) {
return false;
}
}
}
endTime = System.nanoTime();
... |
c83fe44e-53de-4bf2-9ed1-be131f3cf498 | 5 | public Behaviour jobFor(Actor actor) {
if (actor.isDoing(Delivery.class, null)) return null ;
if (stage >= STAGE_BOARDING) {
final Action boardAction = new Action(
actor, this,
this, "actionBoard",
Action.STAND, "boarding "+this
) ;
boardAction.setPriority(stage ==... |
6c9aba7c-2fd9-4071-ba73-177039e36074 | 2 | private void ConsultarTorneio_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarTorneio_ButtonActionPerformed
int i=0;
Collection<String> marcador = a.getMelhorMarcadores(Torneio_ComboBox.getSelectedItem().toString());
if (marcador != null) {
for (Stri... |
32da69da-fc0a-48e4-a965-e0c875330fd3 | 2 | public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out"... |
8532ef80-5fcb-40b9-ab59-23f15fb33b95 | 4 | public void newTrack() {
int theId = lookForBlankId();
int newMatchesSize = Math.max(theId + 1, highestId() + 1);
int[] matches = new int[newMatchesSize];
for (int i = 0; i < matches.length; i++)
matches[i] = 0;
Track newTrack = new Track(theId, "", "", 1, 0, 0, 0, 0, 0, "", matches);
for (int i = 0; i <... |
508bda33-4474-450c-8da4-e7dd729f186b | 4 | private void iteracja_rekrystqalizacja() {
double p = this.gestosc_dyslokacji(this.itr);
double psr = p/(double)this.tabSizeX*this.tabSizeY;
for (int i = 0; i <= this.tabSizeX - 1; i++) {
for (int j = 0; j <= this.tabSizeY - 1; j++) {
if (this.P[i][j].prev==0) {
this.P[i][j].p += this.pij(70, 120, ps... |
6bc698bb-0a93-47ce-ab65-75c8cdb0d464 | 3 | public byte[] decoding(byte[] data) {
int bufLen = data.length - (data.length + 7 ) / 8 ;
ByteBuffer buf = ByteBuffer.allocate(bufLen);
for(int i = 0; i != data.length; i++) {
if ((i + 1) % 8 != 0 && i + 1 != data.length) {
convertByte = data[i + 1];
... |
27ce9cb0-ef25-4b62-b43d-b581d09a6bc0 | 1 | public void disol(int... overlays) {
for (int ol : overlays)
visol[ol]--;
} |
858fcc37-dc25-42cf-8f7d-28c2b89b2deb | 1 | private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setText("BACK");
jButton1.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
jButton1MouseMouseClicked(event);
}
});
}
return jButton1;
} |
a9122cd1-0087-4df8-b188-6ab9349a751d | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
093b8f6c-e325-406c-855a-de0ad67d0a73 | 7 | @SuppressWarnings("unchecked")
public static void openURL(String prompt, String url)
{
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Mac OS")) {
Class fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = ... |
d325271e-6daf-4d01-be53-c5eafca30acb | 5 | public IVPBoolean greaterThanOrEqualTo(IVPNumber num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER... |
3a88a828-6075-4a29-8690-ae942d00adcc | 3 | public String encrypt(String str) {
if(StringUtils.isEmpty(str)) throw new IllegalArgumentException("String for encrypt is null");
digester.update(str.getBytes());
byte[] hash = digester.digest();
StringBuffer hexString = new StringBuffer();
for(int i = 0; i < hash.length; i++) {
if((0xff & hash[i]) ... |
1e5c8a23-2819-455b-b3e9-33ec9a7a04e6 | 5 | protected SecuredPriorityBean getPriority(SecuredTaskTriggerBean task) throws GranException {
String impactUDFName = KernelManager.getFind().findUdf(INCIDENT_IMPACT_UDFID).getCaption();
String urgencyUDFName = KernelManager.getFind().findUdf(INCIDENT_URGENCY_UDFID).getCaption();
String urgency =... |
6657fb6e-6df8-4544-9530-024c85a819cb | 7 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int p = Integer.parseInt(st.nextToken())-1;
String... |
0e447433-1d96-4efd-bf61-90ee09b38b85 | 7 | private <T> Class<?> createProxyClass(Class<?> mockedType, Class<?>...interfaces) {
if (mockedType == Object.class) {
mockedType = ClassWithSuperclassToWorkAroundCglibBug.class;
}
Enhancer enhancer = new Enhancer() {
@Override
@SuppressWarnings("unche... |
5b57b444-de37-4ced-9cda-89fef5ad7eb9 | 3 | public void update(Observable o, Object arg) {
for (Element<Light> e : _lightElements) {
System.out.print("Light at (" + e.i + "," + e.j + "): ");
System.out.println(e.x.getColor());
}
for (Element<VehicleAcceptor> e : _roadElements) {
for (Vehicle d : e.x.getCars()) {
... |
3d7c905c-1886-4283-847e-c3b327ca8253 | 0 | @Override
public String getMobile() {
return super.getMobile();
} |
1698fd07-a494-4074-bb11-be051520c31e | 8 | public boolean canMoveDown(){
int emptyRowsFromBottom=0, j, i;
// check for field boundaries
for(j=(t.getySize()-1);j>0;j--){
if(!t.rowIsEmpty(j)){
break;
}
emptyRowsFromBottom++;
}
if((t.getPosY()+t.getySize()-emptyRowsFromBottom)>(p.getySize()-1)){
return false;
}
// check for o... |
9d398b3a-9c22-4372-88f3-72ef6f8a7c45 | 3 | public QueueInterface<String> calculate()
throws DAIllegalArgumentException, DAIndexOutOfBoundsException {
if (displayText != "")
displayTextTop.addLast(displayText);
if (displayTextTop.getSize() > 2) {
QueueInterface<String> deque = new DynamicArray<String>();
while (displayTextTop.getSize() > 0) {
... |
1cdb6c1b-ed46-4939-a88e-740b6b966b44 | 5 | public static FieldNode getLocalField(String name, String desc, ClassNode cn) {
for (FieldNode fn : cn.fields) {
if ((name == null || fn.name.equals(name)) && (desc == null || fn.desc.equals(desc)))
return fn;
}
return null;
} |
adee49b3-637a-4a43-9c60-92dfbe0f9e62 | 2 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == userPrivateMessageItem) {
String toUser = usersOnlineList.getSelectedValue();
openChatWindow(toUser, getUserIdByName(toUser), true);
} else if(e.getSource() instanceof JButton) {
closeTab(((JButton) e.getSource()).getActionCommand(... |
126ec7aa-492a-48d5-ba39-44a3edbc995c | 2 | public void setParameter(String key, String value) {
String[] values = parameters.get(key);
if (values == null) {
parameters.put(key, new String[]{value});
} else {
String[] result = new String[values.length + 1];
result[0] = value;
for (int i = 0... |
4069c8e0-d4ef-452e-ab79-a7e29386f242 | 4 | private static void writeConstructors(final ClassEditor ce,
final DataOutputStream dos) throws IOException {
// Sort constructors by their signatures
final SortedSet sorted = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
MethodEditor me1 = (MethodEditor) o1;
MethodEditor m... |
ca44eb75-f9b0-4b9d-95e0-d052e1fa0e9c | 5 | public VueSalle(ListUserPanel a, int nbPlaces){
matriceSalle = ListeMatriceSalle.getMatriceSalle(nbPlaces);
listUserPanel = a;
setHeight("100%");
setWidth("100%");
setStyleName("vueSalle");
flextable = new FlexTable();
flextable.clear();
flowpanel = new FlowPanel();
flextable.setWidget(1, 0, flowpane... |
aea291f0-2e38-4d2a-bac7-9831a490a5f3 | 1 | public void fastClicked()
{
WindowStack ws = WindowStack.getLastInstance();
System.out.println(ws);
if (ws != null) {
WindowFast fast = new WindowFast();
ws.push(fast);
}
} |
613738d9-fe1a-4e80-8ba4-cd1f21ffebc8 | 0 | @Override
public void testFailure(Failure failure) {
setFailedOrIgnoredForFailureOrAssumptionFailure(failure, TestState.failed);
} |
4d8c454b-2a02-4848-a0c1-fb58174f1f97 | 2 | public void mouseExited(MouseEvent e)
{
if(e.getButton() == MouseEvent.BUTTON1)
{
mouseActions.left();
}
else if(e.getButton() == MouseEvent.BUTTON3)
{
mouseActions.right();
}
} |
89f37595-cae1-4909-b942-04be54cb73ef | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Card other = (Card) obj;
if (rank != other.rank)
return false;
if (suit != other.suit)
return false;
return true;
} |
0f1382e7-8c35-4295-8ced-8bf2ae811b14 | 8 | private JToggleButton getButton(int tool)
{
switch (tool)
{
case TOOL_EYEDROPER:
return eyedropper;
case TOOL_LINE:
return line;
case TOOL_OVAL:
return oval;
case TOOL_PAINT_BUCKET:
return... |
8d781dcd-fbd5-40f9-9269-93d0e2805380 | 9 | public Direction getTurnDirection(Direction current, boolean isRightTurn) {
Direction result = Direction.N;
if (current != null) {
switch (current) {
case N:
if (isRightTurn) {
result = Direction.E;
} else {
... |
88e67fef-ebcd-4a5c-9efc-3e714a076e9c | 6 | private List<String> getProperties(Class<?> clazz) {
List<String> properties = new ArrayList<String>();
Iterable<Field> fields = filter(
Arrays.asList(clazz.getDeclaredFields()),
new Predicate<Field>() {
@Override
public boolean apply(Field input) {
return !Modifier.isStatic(input.getModifi... |
5d0eca6b-be00-4ac7-b280-3a53bfacea5d | 8 | public void placeEntrance() {
boolean valid = false;
while (valid == false) {
double r1 = Math.random(); // X or Y wall
double r2 = Math.random(); // 0 or Last
Random rn = new Random();
int row = rn.nextInt(grid.length - 2) + 1;
if (r1 > 0.5) ... |
716deb51-560d-4b1b-87d1-89ca8aabc7a4 | 0 | public boolean isNormalMove(Piece piece, Field from, Field to) {
return piece.canMove(this.window.board, from, to);
} |
7f431155-597c-4400-a0d6-94314bb9ae98 | 9 | private static void checkSchedule(){
@SuppressWarnings("unused")
long newCurrentTime;
while(!dataReceived)
{
dataReceived = ic.mm.dataRec();
edSchedSel = ic.mm.editSchedSelected();
schedSetupSel = ic.mm.InitSetupSelected();
l... |
2a0c311a-4b5a-4366-860f-2c88ebc6c999 | 4 | public void addResults(Test test, UUID batchId, Boolean persist) {
if(persist!=null){
Config config = Config.getInstance();
String dburl = "jdbc:mysql://" + config.configProperties.getProperty("db.hostname") + ":" + config.configProperties.getProperty("db.port") + "/" + config.config... |
2df15e32-3def-4091-8070-5276204d225e | 1 | public static NSpace getSpace(String context) {
try {
return (NSpace)CONTEXT_CACHE_MODULE.get(new NSpaceKey(context), () -> new NSpace(context));
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
} |
85e31dbc-ab3f-4db2-85ff-caff732e55ac | 4 | public void addListenerHistButton(final JButton histButton){
histButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
URL urlButton = new URL(histButton.getText());
System.out.println("histButton: "... |
8826956e-7a86-4726-88bc-60eb1c1aac11 | 6 | public void recalcColumnWidths()
{
JTableHeader header = this.getTableHeader();
TableCellRenderer defaultHeaderRenderer = null;
if (header != null)
defaultHeaderRenderer = header.getDefaultRenderer();
TableColumnModel columns = this.getColumnModel();
TableModel... |
6e0e2cc0-9b5f-45a6-aed6-0e9ed6a5dd3c | 6 | private void fillAttrAndOpe(Parse parse , Model model){
for(Classe e : model.getClasse()){
e.cld(model);
final String x = e.getIdentifier();
final Object[] at = e.getArrayAttribut().toArray();
final Object[] mt = e.getArrayOperation().toArray();
for(int k=0;k<e.getArrayAttribut().size();k++) {
... |
6cfdeffe-5c92-4dfb-b1a5-0520d604bc56 | 8 | public int getFirstMsgIndex(List<JournalEntry> journal, String from, String to, String subj)
{
from = DB.injectionClean(from);
to = DB.injectionClean(to);
subj = DB.injectionClean(subj);
if(journal==null)
return -1;
for(int i=0;i<journal.size();i++)
{
final JournalEntry E=journal.get(i);
if((fr... |
4ce61922-4e77-49b6-9b49-ef546abf8ef3 | 5 | public Repo(String dir) throws IOException {
RepositoryBuilder rb=CoffeeGit.gerRepositoryBuilder();
File fileDir=new File(dir);
repo=rb.setGitDir(fileDir)
.readEnvironment()
.findGitDir()
.build();
String[] gitDirList=fileDir.list();
boolean initFlag=false;
for(int i=0;(!initFlag)&&i<gitDirLi... |
264c82c9-7790-4fb7-9501-f8929911eb1a | 6 | public static void saveConfigurationValue(OutputStream stream, Stella_Object value) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(value);
if (Surrogate.subtypeOfStringP(testValue000)) {
{ StringWrapper value000 = ((StringWrapper)(value));
stream.nativeStream.print(value000.wra... |
f37fb6a8-1c31-4225-b538-b210ff170a2d | 2 | public String getNewPlayer() {
int player = getPlayerNum();
if (player == 0) return "Player1";
else if (player == 1) return "Player2";
else return "Observer";
} |
a3fb83a1-2a88-4930-82c2-cb6902840b4f | 2 | private String Complement(String binaryString)
{
StringBuilder complementBuilder = new StringBuilder(binaryString);
for(int i = 0; i < binaryString.length(); ++i)
{
char flip = binaryString.charAt(i) == '0' ? '1' : '0';
complementBuilder.setCharAt(i, flip);
}
return complementBuilder.toString();
... |
8aea0e99-30c9-45f0-8257-87ea23289568 | 6 | private ArrayList<Spire> deleteDoubles(ArrayList<Spire> l) {
ArrayList<Spire> temp = l;
int reps = 0;
for (int i = 0; i < temp.size(); i++) {
for (int e = 0; e < temp.size(); e++) {
if (temp.get(e).equals(temp.get(i)) && e != i) {
reps++;
... |
98ca0686-dcd5-41c8-a1ab-086fe456c6cf | 6 | final boolean method1414(int i) {
if (((OpenGlToolkit) aHa_Sub2_2511).aBoolean7820
&& ((OpenGlToolkit) aHa_Sub2_2511).aBoolean7783
&& aClass337_2513 == null) {
Class242 class242
= (WidgetVariable.method3249
(35632, 121, aHa_Sub2_2511,
"uniform float rcpRelief;\nuniform vec2 sampleSize;\nuni... |
5193c49c-1709-496f-8e4f-c14a5bc8f522 | 5 | public static void sink(int row) {
game.fallTimer.stop();
int lines = 0;
try {
lines = game.gameGrid.collapseAbove(row);
}
catch (Exception e) {
e.printStackTrace();
}
// Give bonus points for consecutive line removals
if (lines == 0) {
game.consecutive = 1;
}
else {
++game.consecu... |
a3c244e6-63ed-4222-a296-3881fdcd4d8f | 4 | public void run()
{
Socket sckOut = null;
InetSocketAddress isaTmp = null;
try
{
sckOut = new Socket();
sckOut.bind
(
new InetSocketAddress
(
EzimNetwork.localAddress
, 0
)
);
isaTmp = new InetSocketAddress
(
this.addr
, this.port
);
sckOut.connect(isaTmp,... |
1b685956-be8e-4820-858c-20cb0a232c87 | 1 | protected final void addEnd(final String name) {
try {
h.endElement("", name, name);
} catch (SAXException ex) {
throw new RuntimeException(ex.toString());
}
} |
f0952c73-c2c2-4077-9776-cc159669876d | 1 | public void save(Member transientInstance) {
log.debug("saving Member instance");
try {
Session session = getSession();
Transaction tr = session.beginTransaction();
session.save(transientInstance);
tr.commit();
session.flush();
session.close();
log.debug("save successful");
} catch (RuntimeEx... |
89fd09a0-0187-4e72-a3bb-c1c503291b14 | 6 | public static void main(String[] args) {
File f = new File("registro.txt");
BufferedReader reader = null;
int mayor = 0, actual = 0;
String[] valor = null;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(f)));
String line = reader.readLine();
while (line != null) {
... |
bcbdda96-6a7c-4226-85ef-14168909f5b7 | 1 | public int getInt(int index) throws JSONException {
Object o = get(index);
return o instanceof Number ?
((Number)o).intValue() : (int)getDouble(index);
} |
936d6d5e-dcd9-4ec0-a4aa-cf2ac77c1732 | 1 | public void addSymbol(String lispPackage, String value) {
if (lispPackage.equals(""))
arguments.add("'" + value);
else
arguments.add("'" + lispPackage + "::" + value);
} |
ee311f2c-d9ad-40fb-a85c-ef7a8641833c | 1 | public static Venue[] findAll() throws SQLException {
ResultSet resultSet = Data._findAll(Venue.class.getSimpleName());
ArrayList<Venue> rtn = new ArrayList<Venue>();
int i=0;
for(i=0; resultSet.next();i++) {
Venue iVenue = new Venue();
iVenue.id = resultSet.getLong("id");
iVenue.name = resultSet.getSt... |
513b47b0-de0e-43e7-9840-862c985e37f6 | 1 | public Node getBack() {
Node node = head.previous;
if (node == head) {
current = null;
return null;
} else {
current = node.previous;
return node;
}
} |
03aaee23-ce04-4e9f-b673-77afcce8528b | 1 | public void setBackground(Path img) throws IOException {
if (FileUtil.control(img)) {
FileUtil.copyFile(img, this.imageDir.resolve(Constants.SKIN_BG_NAME), false);
this.backgroundImgChanged = true;
this.imgBackground = this.imageDir.resolve(Constants.SKIN_BG_NAME);
}... |
438ba0a3-327c-4fac-86ee-cc1cf0d466f8 | 7 | public void sql_change_appointment_info(int choice) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Statement s = GUI.con.createStatement();
if(choice == 1)
{
s.executeUpdate ("UPDATE appointments SET Title =... |
21ceba07-abcb-461d-8ebe-470d9cc28a69 | 7 | private void generateMap(String[] layout) {
String line;
for ( int r = 0; r < GameConstants.WORLDSIZE; r++ ) {
line = layout[r];
for ( int c = 0; c < GameConstants.WORLDSIZE; c++ ) {
char tileChar = line.charAt(c);
String type = "error";
if ( tileChar == '.' ) { type = Ga... |
adebfda8-440d-4e14-9b76-aa40e33cb474 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (null == obj) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Description eq = (Description)obj;
if (!super.equ... |
c900cb0a-832d-4b7d-9f60-5d5a6fe9006a | 0 | public boolean isGestureOk() {
return gestureOk;
} |
7fa4357d-ed21-4021-8918-13e242bae560 | 4 | public static DefaultCell averagedCell(List<Measurement> measurements) {
Point2D.Double averagedCellTowerPos = averagedCellTowerPosition(measurements);
DefaultCell averageCell = new DefaultCell(averagedCellTowerPos, 0.0, 120.0);
double vectorAngle = 0.0;
List<Measurement> maxMeasurementsThatFit = ne... |
ab209e48-ae34-415d-8d3d-6c4cdea3787e | 1 | @Override
public double execute(Date start, Date end) {
int duration = TimeCalculator.duration(start, end);
duration = duration % this.countUnit > 0 ? duration / this.countUnit
+ 1 : duration / this.countUnit;
double price = this.pricePerUnit * duration;
return DecimalCleaner.round(price, 3);
} |
ed5d3928-1196-43d1-b0de-5319ea2a8720 | 8 | private int getNextProgramCharDistance(String line, int i) {
boolean inComment = false;
int remainingCharNum = line.length() - i;
int charDistance = 1;
for (charDistance = 1; charDistance < remainingCharNum; charDistance++) {
int ch = line.charAt(i + charDistance);
if (inComment) {
if (line.regionMat... |
9ba91fb2-8e7f-44cf-8346-d94a8ce16d45 | 9 | @Override
public MediaTag load(RandomAccessFile raf, String versions)
throws IOException {
if(raf.length()<42) {
// definitely not FLAC
return null;
}
byte b[]=new byte[4];
raf.seek(0L);
MediaFileUtil.read_sure(raf,b);
if(!(new ... |
7017891a-3dfb-4e32-b481-756f2a74e170 | 7 | @Override
public String toString()
{
String cardString = "";
if ( this.number == 1 )
{
cardString += "Ace";
}
else if ( this.number == 11 )
{
cardString += "Jack";
}
else if ( this.number == 12 )
{
cardString += "Queen";
}
else if ( this.number == 13 )
{
cardString += "King";
}
... |
d00e284c-6276-4f9c-89f1-70ac9443dc52 | 9 | public void validar() throws InvalidIDException {
try {
if(cuit==null) throw new NullPointerException("Null CUIT given");
if(cuit.toString().length()!=11) throw new IndexOutOfBoundsException("Invalid CUIT length:"+cuit.toString().length()+"must 11 digits");
sexo = cuit / (long) Math.pow(10, 9);
dni = cuit... |
1b3c86a9-b208-416f-a9b2-c2eef1ca1eaf | 7 | public static Spell getWaterSpell(int i)
{
switch (i)
{
default:
case 0:
return new Waterbending();
case 1:
return new WaterbendingFreeze();
case 2:
return new WaterSpout();
case 3:
... |
030d9517-8eb7-4273-9087-e6c79ba8dd15 | 9 | @EventHandler(priority = EventPriority.HIGH)
public void join(PlayerJoinEvent event) {
if (plugin.config.usedbtomanageXP) {
String playername;
Player player = event.getPlayer();
double XP = plugin.getTOTALXP(player);
double XPneu = XP;
playername =... |
868eee1a-709a-4aa4-8fdb-b9fe557fd486 | 5 | public void setImage() {
if (harbor == "havencolission") {
setImage(new GreenfootImage("havencolission.png"));
}
if (harbor == "havenfooter") {
setImage(new GreenfootImage("havenfooter.png"));
}
if (harbor =="rightbalk") {
setImage(new... |
aa4fa916-6101-48a2-8eaf-4e56ff4057cf | 9 | @Override
/*
* Method to find the shortest possible route between two nodes in the graph
* using the Breadth-First Search Algorithm. Returns: ArrayList of Nodes in
* order which they should be traversed in order to reach destination.
*/
public ArrayList<Node> findRoute(Node sourceNode, Node destinationNode) {... |
07a9ed02-affe-4706-a906-96278777b462 | 4 | public int right(int graus) {
if (graus <= 340) { //limite de elevação 270º
if (graus < 10) {
right = "!00" + graus + "R*";
System.out.println("RIGHT = " + right);
arduino.enviaDados(right);
} else if (graus >= 10 && graus < 100) {
... |
efea7992-4171-466a-a5e1-698492ef6171 | 7 | private static boolean downloadDependency(String dep) {
switch(dep) {
case "jinput":
case "lwjgl":
case "lzma":
case "slick-util":
try {
Files.copy(Paths.get(dependencyURLs + "\\" + dep + ".jar"), Paths.get(workPath + "\\deps\\" + dep + ".jar"));
return true;
} catch (IOException e) {
e.pri... |
1642243d-f0a4-4bb2-a7b6-d1761e9a2718 | 0 | @Override
public void componentResized(ComponentEvent e) {
// TODO Auto-generated method stub
//System.out.println("resized in MainFrame");
Position.setSize(this.getWidth(), this.getHeight());
} |
d6db5f7a-8e83-47b7-9928-0c62a44a93c0 | 0 | public void setAge(int age) {
this.age = age;
} |
eb18c1b5-1248-4813-be69-cd0a890c472b | 8 | public void piirraRuutu(Ruutu ruutu, Graphics graphics) {
Elementti elementti=ruutu.getRuudussa();
if (elementti==null) {
}
else if ("liukuhihna".equals(elementti.tyyppi())){
piirraLiukuhihna(graphics,ruutu,elementti.getGrafiikkaluku());
} else if ("kuoppa".equals(ele... |
0b6b7175-c215-4fff-8cff-f75c1f6dfef1 | 7 | public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('P', options);
if (tmpStr.length() != 0)
setPruningMethod(
new SelectedTag(Integer.parseInt(tmpStr), TAGS_PRUNING));
else
setPruningMethod(
new SelectedTag(PRUNING_NONE, TAGS_PRUNIN... |
2b155364-d48c-4aaa-9547-6d968def6fd3 | 9 | public int onMouseClick(Point mousePos)
{
if( gameresult != -2) // it is shown the game result, when users clicks, make new game
{
if( gameresult == GV.PLAYER_ONE)
{
player1.gamesWon++;
}
else if( gameresult == GV.PLAYER_TWO)
{
player2.gamesWon++;
}
board.initialize();
gameres... |
7d31c54a-9a30-45b7-8d7c-29ae782abb0c | 7 | protected void drawBars(Graphics2D g) {
if (!isValuesFilled()) {
return;
}
double barStep = (getWidth() - (leftChartMargin + FIRST_BAR_LEFT_MARGIN)* 2) / getValues().length;
double xTopLabel;
double xBottomLabel;
int x;
int y;
int w;
int h;
Value value;
double realBarW... |
c86cf93a-4189-4091-96bb-c798bd299987 | 6 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((bairro == null) ? 0 : bairro.hashCode());
result = prime * result + ((cep == null) ? 0 : cep.hashCode());
result = prime * result + ((cidade == null) ? 0 : cidade.hashCode());
result = prime * result
+ (... |
fc70b826-1540-40bd-9e7a-4d6555031cc2 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.