method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5aff7da2-c687-4440-a4ce-062d30f38eaf | 3 | protected void startGame(String sender) {
if (!bot.getNick().equals(name)) {
bot.changeNick(name);
}
if (doBarks)
idleTimer.cancel(); // don't make comments while the game's on.
players2.reset();
players2.start(MAXPLAYERS);
for (int i = 0; i < players2.numPlayers(); i++) {
bot.voice(gameChan, pl... |
8d4dfa21-0917-4a85-8928-87088c433a9a | 1 | public static byte[] rotateLeft(byte[] in, int len, int step) {
int numOfBytes = (len - 1) / 8 + 1;
byte[] out = new byte[numOfBytes];
for (int i = 0; i < len; i++) {
int val = getBitInt(in, (i + step) % len);
setBit(out, i, val);
}
return out;
} |
130ec827-5164-457b-8ef6-d97de977c15e | 5 | public void loadHandlers() throws IOException{
for (String line = reader.readLine(); line != null; line = reader
.readLine()) {
if (line.contains("#")) {
String thePackage = stringModifier.removeSingleChar(line, line.indexOf("#"));
String name = stringModifier.substringFirstCapitalChar(thePackage);
... |
1a9e82de-faee-47ed-943c-23770179a1bf | 9 | @Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(citation).append(EOL);
if (comments != null ) {
for (Comment comment : comments) {
stringBuilder.append(comment).append(EOL);
}
}
... |
a024e83c-4900-485b-9c23-a04cc14205e2 | 1 | private ItemIdList() {
ItemIdList.idSIIS = new SIIS();
File datadump = new File("data.dump");
if (!datadump.exists()) {
parse();
// buildFromScratch();
} else {
idSIIS = SIIS.deSerializeFile(datadump);
System.out.println(idSIIS.size());
}
} |
ebb011fc-4212-49a3-987e-0fba336b114a | 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... |
68bd38a1-82a6-4ee4-968e-22e43e00ada4 | 2 | public void write(AnnotationsWriter writer) throws IOException {
String typeName = pool.getUtf8Info(typeIndex);
if (members == null) {
writer.annotation(typeName, 0);
return;
}
writer.annotation(typeName, members.size());
Iterator it = members.values().it... |
f3ffed3b-ef3f-42ad-a097-9d7cc28af9d8 | 5 | private void checkWhatLineExpected() throws AssemblerException {
abortMnem = true;
if (atOperandFieldEncodings) {
abortMnem = true;
throw new AssemblerException(
"MnemonicData error: Line format or indentation error, operand field encodings line expected. Line should begin with two tabs.\n"
+ ge... |
baa48474-f2dd-4be2-8a42-86013042e16a | 0 | public static void severe(String message)
{
FMLRelaunchLog.log("MattparksCore", Level.ERROR, message);
} |
f9c20638-c10e-487a-9734-e08840efe9fe | 1 | private synchronized boolean contains(Object p){
if(p instanceof Peer)
return peerList.contains((Peer)p);
return false;
} |
cd389125-db81-4e23-b068-ad0873a78829 | 0 | public static void before(PrintWriter out){
out.println("<html>"+
head()+
"<body>"+
"<table id=\"hor-minimalist-b\">"+
thead());
} |
5de55962-93f1-44cc-bd2a-3c3df0e33a09 | 5 | public CodeMap31 set(final int index, final int value) {
final int i0 = index >>> 24;
int[][] map1;
if (i0 != 0) {
if (map == null)
map = new int[MAX_INDEX_ZERO][][];
map1 = map[i0];
if (map1 == null)
map[i0] = map1 = new int[MAX_INDEX_ONE][];
} else
map1 = map10;
final int i1 = (index >... |
ccd43e55-48a9-4596-b496-76cd01afa5b6 | 0 | public int ID() {
return ID;
} |
5e4a4974-f799-440f-9c0b-ce41c81e8534 | 8 | @Override
public void actionPerformed(ActionEvent e)
{
Reference.lastActionMinute = new DateTime().getMinuteOfDay();
if (e.getSource() == overviewButton)
{
Reference.overPanel = new OverPanel();
... |
7c5dbff6-79ea-4b62-a7f1-4dee022d1d8a | 8 | public void registerBookJobs(BookMeta book, Minecart minecart, Player player) {
if (!enable) {
return;
}
if (minecartBookJobMap.get(minecart) != null){
ItemStack bookItemStack = new ItemStack(Material.BOOK_AND_QUILL, 1);
bookItemStack.setItemMeta(getBook(mine... |
3ec168f1-e007-4e05-8b64-e346b1e24856 | 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... |
ff783152-9fac-4012-ba7e-cfa556584bd9 | 1 | public JSONObject getJSONObject(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONObject) {
return (JSONObject)object;
}
throw new JSONException("JSONArray[" + index +
"] is not a JSONObject.");
} |
4fafb297-0c03-47af-967a-6cfdae0f5c93 | 4 | private int transferFromLargestOverlap(int count, AreaObject[] array) {
int smallestWasted = Integer.MAX_VALUE;
int bestPick = -1;
for (int i = 0; i < count; i++) {
int wasted = areaWasted(mBounds, array[i].getBounds());
if (wasted <= smallestWasted) {
smallestWasted = wasted;
bestPick = i;
}
... |
86c3e818-fbf7-4c9b-8d55-adb85526720b | 8 | public boolean saveItemList(ArrayList<Package> packList, Connection con) {
int rowsInserted = 0;
int tal = 0;
String SQLString1 = "insert into pakker values(?,?,?)";
String SQLString2 = "select pakkeseq.nextval from dual";
String SQLString3 = "insert into pakkedetails values(?,?... |
6faf277b-86e7-4bac-a19b-61fc5ecce7be | 7 | public static char getIndexPos(int index)
{
switch(index)
{
case 0: return '^';
case 1: return 'N';
case 2: return 'V';
case 3: return 'A';
case 4: return 'R';
case 5: return 'O';
case 6: return '.';
}
return ' ';
} |
b0240693-5ca5-42ac-8b12-efd7e7359c28 | 7 | @ScriptyCommand(name="map-create")
public static Map mapCreate(Object[] aArgs)
throws CommandException
{
{
Map<Object, Object> lMap = new HashMap<Object, Object>();
for(int i = 1; i < aArgs.length; i++)
{
if(aArgs[i] instanceof String)
... |
2f896a03-6433-47e8-b3f4-abdf84af77aa | 5 | private void editarDatosUsuario() throws IOException, ServletException {
String nombre = request.getParameter("nombre");
String apellido = request.getParameter("apellido");
String username = request.getParameter("username");
String email = request.getParameter("mail");
if (apellido != null && nombre != null &... |
49060334-c4b7-4599-a59d-5a0e0c8da1ff | 0 | public void setResponseWrapper(ResponseWrapper responseWrapper) {
this.responseWrapper = responseWrapper;
} |
0dec4907-9781-41c2-93ca-427edfa534c6 | 9 | public static final int getMPEaterForJob(final int job) {
switch (job) {
case 210:
case 211:
case 212:
return 2100000;
case 220:
case 221:
case 222:
return 2200000;
case 230:
case 231:
case 232:
return 2300000;
}
return 2100000; // Default, in case GM
} |
ec14f802-baf6-4641-bd98-a4bcfae70cd0 | 7 | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case LEFT_RHINO_ID:
return isSetLeftRhinoId();
case LEFT_TITAN_ID:
return isSetLeftTitanId();
case RIGHT_RHINO_ID:
return isSetRightRhinoId();
case RIG... |
89d02f41-f3b2-459f-902a-1e579bf3e01e | 5 | public void paint(Graphics g) {
int startRow = 0;
int endRow = rows;
int startColumn = 0;
int endColumn = columns;
Rectangle clip = g.getClipRect();
if (clip == null) {
computeVisibleRect(visibleRect);
clip = visibleRect;
}
... |
9f75bb16-0b6b-4f2c-b262-4d6277cd57bb | 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... |
a835f7d6-c3f9-4be7-83b5-101318c343e9 | 0 | public void setLastLargest() {
lastLargest = largest;
} |
def2a9d9-464b-4acf-9ced-8072e16dc8c1 | 8 | public static void classClass(){
Olive o = new Olive(OliveName.PICHOLINE, OliveColor.GREEN);
// using Class Class
Class<?> c = o.getClass();
System.out.println(c);
System.out.println(c.getName());
System.out.println(c.getSimpleName());
ArrayList<Integer> aa = new ArrayList<>();
Class<?> bb = aa.ge... |
e89a533b-c26b-4da0-8081-a920e66e4484 | 7 | private static void parseDriverNode(Node node) {
String jdbcDriver = null, jdbcUrl = null, name = null;
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMEN... |
f95d1a31-0fd7-45e8-8189-7aaa7d594254 | 2 | public void mouseReleased(int mouseX, int mouseY) {
//Iterate through each object
for (ImageButton obj : screenObjects) {
obj.mouseReleased(mouseX, mouseY);
}
if(loopMenuOpen){
loopMenu.mouseRelease(mouseX, mouseY);
}
} |
4adc1ba4-11a8-4372-8ba3-89731bcd5166 | 4 | public Projectile createProjectile(float direction, Position pos){
if (timeNow()-lastTimeFired>rateOfFire
&& !isReloading()){
if (ammunitionInMagazine==0){
return null;
} else {
ammunitionInMagazine-=1;
lastTimeFired=timeNow();
boolean visible = (getType() == Type.GUN) ? true : false;
re... |
755f63c3-d23c-4d9f-ae35-73808f9aa85e | 1 | public void printError(int err)
{
if(err==-1) System.out.println("File not found");
} |
d55d288f-1333-4fc2-9e0f-b8d9eb7c8bc1 | 0 | @Override
public Object invoke(Object arg0, Method arg1, Object[] arg2)
throws Throwable {
log.debug("before method invoke...");
Object result = arg1.invoke(delegate, arg2);
log.debug("after method invoke...");
return result;
} |
03e91584-98d1-448f-9b4e-6650f2521453 | 5 | @Override
public String getPinyin() {
if(getInput().replaceAll("\\d", "").equals(getInput()) || getInput().replaceAll("\\d", "").isEmpty())
return getInput();//just return input if the input is all numbers or no numbers
String unprocessedInput = getInput();
// split up each syllable and then put the string ba... |
77fdef39-0f5a-4ef1-834c-c56c045e5aca | 6 | public static List<List<Integer>> subsetsWithDup(int[] num) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
Arrays.sort(num, 0, num.length);
res.add(new ArrayList<Integer>());
if (null == num || 0 == num.length) {
return res;
}
int j = 0;
int ... |
eccda05a-4c39-4a45-9a9e-8703acfc8bfd | 5 | public static ArrayList<Member> searchMemberByCity(String city){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Member> members = n... |
9a332dd7-6d35-475a-b968-4965be7fa3a2 | 8 | @DataProvider
public Collection getChartResult(Map param) throws Exception {
// sql的内容为根据时间的分组,然后分别计算出当月的利润率和从开户到当月截至的利润率
/******
* SQL********* select dm, round(profit/(SELECT profit_ FROM
* accounttransactionsinfo WHERE TYPE_='balance' and SIZE_ in
* ('AddFunds') order by OPENTIME_,TICKET_ limit 1),4) a... |
ad6e9aaf-dfc2-4f97-8c94-7c1b44d68343 | 4 | public void javaToNative (Object object, TransferData transferData) {
if (!checkMyType(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
MyType[] myTypes = (MyType[]) object;
try {
// write data to a byte array and then ask super to convert to pMedium
ByteArrayOutputStream out... |
5f307ca1-2754-4832-8621-9b08b2bb985b | 6 | public String download(PeerInfo peerInfo, String filename) throws PeerNotConnectedException, TrackingServerNotConnectedException, FileNotFoundException {
if(peerInfo == null) {
peerInfo = getPeerInfoFromPeerSelectionAlgorithm(filename);
}
if(peerInfo == null) {
throw new PeerNotConnectedException("Cannot de... |
a7a867eb-4f98-4011-8f14-0802bc66202c | 5 | public void sizeline() {
int dumy = 0;
MyDrawing buffer;
if(selectedDrawings.size() != 0){
for(int i=0;i<selectedDrawings.size();i++){
selectedDrawings.elementAt(i).move(selectedDrawings.elementAt(i).getX(), 400 - selectedDrawings.elementAt(i).getH());
}
for(int i=0;i<selectedDrawings.size();i++){
... |
a1819afa-52a5-4985-8d2d-75e6303814a4 | 4 | void paintDirect(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int alpha, int color1) {
int[] opacityData = opacityBuffer.data;
int by = srcRect.top;
for (int j = dstRect.top; j < dstRect.bottom; j++, by++) {
int srcOffset = srcRect.left + by * w;
int dstOffset = dstRect.left + j * width;
f... |
9553b7e5-c915-4afe-b29a-e6d03199cab6 | 5 | public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JButton) {
SoundManager.playSound(SoundManager.SoundType.BUTTON);
}
//TODO Program functionality of buttons?
if(e.getSource() == home) {
mathGame.showMenu(MathGame.Menu.MAINMENU); // Return to the main menu
// choosefraction();
... |
ce334a48-df47-4857-b742-89a22f5c9a04 | 3 | public ArrayList<ArrayList<Integer>> subsetsWithDup(int[] S) {
result = new ArrayList<ArrayList<Integer>>();
result.add(new ArrayList<Integer>());
Arrays.sort(S);
if ((S.length) == 0)
return result;
put(S[0], 1);
Arrays.sort(S);
int range = result.... |
cb96b41c-ca22-40b4-8ae6-a3bd0c1e8c8e | 7 | @Override
public boolean equals(Object o) {
if (!(o instanceof Matrix)) {
return false; // o is not a matrix
}
Matrix a = (Matrix) o;
if ((!this.isJagged && !a.isJagged) && this.sameOrder(a)) {
for (int row = 0; row < this.rowCount; row++) {
fo... |
1b256753-3e1a-458e-9706-43f6d51aba53 | 6 | public static boolean line_box_xywh(double lx0, double ly0, double lx1, double ly1, double rx0, double ry0, double rWidth, double rHeight) {
int out1, out2;
if ((out2 = outcode(lx1, ly1, rx0, ry0, rWidth, rHeight)) == 0) {
return true;
}
while ((out1 = outcode(lx0, ly0, rx0, ry0, rWidth, rHeight)) != 0) {
... |
d36680d9-0552-4467-93b6-769c3830a4a7 | 6 | public Object[] toArrays() {
Object objs[] = new Object[count];
int n = 0;
if ((flags&InputFlags.TA_IN_PRICE_OPEN)!=0) {
objs[n++] = getO();
}
if ((flags&InputFlags.TA_IN_PRICE_HIGH)!=0) {
objs[n++] = getH();
}
if ((flags&InputFlag... |
3b32be8b-53f8-4618-9cf3-a2857a14c01d | 9 | private static String toNumber(String s) {
String result = "";
for (int i =0; i < s.length(); i ++){
if("ABC".indexOf("" + s.charAt(i)) > -1)
result += "" + 2;
if("DEF".indexOf("" + s.charAt(i)) > -1)
result += "" + 3;
if("GHI".indexOf("" + s.charAt(i)) > -1)
result += "" + 4;
if("JKL".index... |
a15fe5f0-7ab7-41ce-ad1a-4fff64b16d89 | 5 | public ButtonPanel() {
super();
listeners = new EventListenerList();
setLayout(new FlowLayout(FlowLayout.RIGHT));
install = new JButton(Localization.translate("ButtonPanel.install"));
update = new JButton(Localization.translate("ButtonPanel.update"));
uninstall = new JButton(Localization.translate("ButtonPa... |
5ada1df1-ac73-4368-9fd9-3753a69c8eac | 7 | @SuppressWarnings("unchecked")
private void _unload(PythonPlugin pl) throws Exception {
PluginManager man = plugin.getServer().getPluginManager();
if (!(man instanceof SimplePluginManager)) {
throw new ClassCastException("cannot unload plugins from a non-SimplePluginManager");
}
... |
c47f130c-acd3-45e0-9065-4b9e32aa33d1 | 6 | static void printAnalyzerResult(MethodNode method, Analyzer a,
final PrintWriter pw) {
Frame[] frames = a.getFrames();
TraceMethodVisitor mv = new TraceMethodVisitor();
pw.println(method.name + method.desc);
for (int j = 0; j < method.instructions.size(); ++j) {
method.instructions.get(j).accept(mv);
... |
6865ebe9-395f-477b-8e5c-a17f0d90e99c | 5 | public String evaluate(String in){
in = in.trim();
String command = in.substring(0,in.indexOf(" "));
String args = in.substring(in.indexOf(" ")+1);
if(command.equals("help"))
man.get("help");
if(command.equals("save")){
if(man.save())return "Saved successf... |
c5fa102c-3835-4c5d-8980-d49dd29f180b | 6 | public void parseWrite(StringBuilder code, ApplySentence s, Environment e) {
List<Value> args = s.value;
boolean gr6taken = willPushRegister(6);
takeRegister(code, 6);
boolean gr7taken = willPushRegister(7);
takeRegister(code, 7);
code.append(spc + " LAD GR6, 0" + "\n");
code.append(spc + " LAD GR7, WR... |
348b57b8-1ea8-413a-9eb1-76c88ecd0fae | 7 | public Matrix subMatrix(int startRowIndex, int endRowIndex, int startColIndex, int endColIndex) {
if (startRowIndex < 0 || endRowIndex > getNumRows()
|| startColIndex < 0 || endColIndex > getNumCols()) {
throw new IndexOutOfBoundsException("Sub-matrix index out of range");
}... |
118fb4bd-1a47-4a59-ad85-79231ba636f6 | 8 | private static void destroy_Launcher(War war) {
LauncherDestroyer destroyer;
EnemyLauncher user_launcher = null;
String launcherId;
int destroyerId = 0;
if (war.getWarLauncherDestroyer().isEmpty()) {
System.out.println("\tNo Destroyer available to hit the launcher");
} else {
System.out.println("Ente... |
2f930a0e-2d91-4406-85fb-18d5255a8af1 | 6 | private void creerTblOffre() {
if (!m_offInit) {
try (BufferedReader br = new BufferedReader(new FileReader(Constant.m_offreList))) {
String sCurrentLine;
m_tblEmplois.clear();
String[] results;
// int i = 0;
while ((sCur... |
636a1c0f-0e26-4f24-9017-19d46ee446d8 | 2 | public static void setSpeed(int x)
{
if(x < 1 || x > 10)
return;
crawlOff = false;
crawlSpeed = 0.05 / x;
} |
902e6dd2-5009-4c2a-8505-6c16b000b046 | 2 | *
* @return <tt>true</tt> iff any ground formula instances exist having the given predicate, and
* the given term in the given argument position
*
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public b... |
39618037-6c0e-4929-bac3-361ee191aedc | 3 | public void newGame()
{
/** Choose mode - Player vs Player or Player vs Computer */
System.out.println("Press Y to play against the AI. \n Alternatively, press any other key to continue with 2 players. \n Confirm your choice by pressing Enter");
Scanner sc = new Scanner(System.in);
String yn = sc.nextLine().t... |
b88ba6a1-f9b3-4d62-9995-f8bb0ea54aac | 5 | public static void loadConfig() {
// set standard values
config.put("DBURL", "jdbc:mysql://localhost:55555/server");
config.put("DBUSER", "root");
config.put("DBPW", "root");
config.put("PORT", "1234");
// overwrite them with the values from the config file
try (BufferedReader br = new BufferedReader(
... |
446fe9a2-4854-4934-98bb-15bf725fb009 | 8 | private void createSpecies(int num,int inputs,int outputs){
if(species==null){
species=new Species(history);
for(int i=0;i<num;i++)
species.getIndividuals().add(new SpeciationNeuralNetwork(history,inputs,outputs));
if(species2==null)
currentSpe... |
62099a18-cbc5-49aa-a712-efdc15cf73e9 | 3 | public void setCategorie(Categorie categorie) {
if (getCategorie() != null) {
getCategorie().getSujets().remove(this);
getCategorie().ajouterNbreSujets(-1);
getCategorie().ajouterNbreReponses(-(getReponses().size() - 1));
}
this.categorie = categorie;
if (ge... |
eb962c80-b502-4e13-bf44-3dc114163785 | 4 | @Override
public void run() {
boolean fim = false;
LOGGER.info("Cliente Aguardando dados");
while (!fim) {
System.out.println("Cliente Aguardando dados");
System.out.flush();
int read = is.nextInt();
LOGGER.info("Recebido " + read + " do servidor");
switch (read) {
case -1: // mario
cli... |
dd4de106-d6aa-4fa0-a0e0-84235ac82b25 | 3 | private void playCard(ICard card, List<ICard> taking) {
if (table.action(card, taking)) {
log("Giocata la carta " + card.getCardStr());
cardsOnHand.remove(card); // rimuove la carta dalla mano
if (taking.size() != 0){
personalDeck.addAll(taking); // Aggiungo le carte al mazzetto
log("Presa: " + cards... |
3388c4f8-1404-42be-a427-b7404e9f31d0 | 2 | @Override
public void onCloseDocument(PdfWriter writer, Document document) {
//la cella con il numero totale di pagine avrà le stesse caratteristiche della cella originaria contentente il testo #Page
//ma l'allineamento sarà a sinistra
if (this._TotalNumberOfPageFooter != null) {
... |
2e0f3866-9b5e-435e-8ea9-736ff58911de | 5 | public ContentObjectRelation getParentChildRelation(ContentType childType, String childId) {
if (childType instanceof RegionType)
return null;
else if (childType instanceof LowLevelTextType) { //Text lines, word, glyph
for (int i=0; i<regions.size(); i++) {
Region reg = regions.getAt(i);
if (reg inst... |
b9b80cb1-ad5c-4928-9312-a8189ea98cea | 4 | protected String getGasType(int userChoice){
if (userChoice == UNLEAD) return UNLEAD_STR;
else if (userChoice == PLUS_UNLEAD) return PLUS_UNLEAD_STR;
else if (userChoice == PREMIUM_UNLEAD) return PREMIUM_UNLEAD_STR;
else if (userChoice == DIESEL) return DIESEL_STR;
return null;
} |
c26a057c-a068-4c6a-b624-95f73c78e50a | 3 | public void Insert(BinaryNode item)
{
if(item.elementNumber < elementNumber)
if(left != null)
left.Insert(item);
else
setLeft(item);
else
{
if(right != null)
right.Insert(item);
else
... |
62a28980-5352-4e1b-88ad-eaa08679c99e | 8 | public static void main(String args[]) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(String ln;(ln=in.readLine())!=null;){
StringTokenizer st=new StringTokenizer(ln);String a=st.nextToken(),b=st.nextToken();
boolean ws=fal... |
bb380a0d-8873-4ad9-968d-90737c1555ee | 3 | @Override
public void setBuffer()
{
if (isDirty())
{
// calculate how many bytes we need to store all the involved people
int length = 0;
for(InvolvedPerson involvedPerson : involvedPeople)
{
length += stringToBytes(encoding.getCharacterSet(), involved... |
3f5f38c0-3966-41cd-80e7-77d8e37e35a2 | 5 | public Load(){
try{
aFileReader = new FileReader(aFilePath);
aBufferedReader = new BufferedReader(aFileReader);
for(;;){
String aString = aBufferedReader.readLine();
if(aString != null){
stringLines.add(aString);
}else{
break;
}
}
}catch(FileNotFoundException error){
error.... |
62da3664-b3d9-4d25-9274-7ab5f23881f2 | 4 | private static boolean isUpdateAvailable(URI remoteUri, File localFile)
{
URLConnection conn;
try
{
conn = remoteUri.toURL().openConnection();
}
catch (MalformedURLException ex)
{
log.error("An exception occurred", ex);
return false;
}
catch (IOException ex)
{
log.error("An exception occu... |
086830d0-af26-4c52-9806-8fbd111daae2 | 7 | private static long ageDifferenceInDays(String firstname1 , String surname1,
String firstname2, String surname2)
throws InvalidPersonException {
Person person1 = null;
Person person2 = null;
for (Person person : people){
String firstname = person.getFirstname();
String surname = person.getSurname();
... |
1eca65bc-f4df-4295-aa75-f6139521d61b | 9 | @Override
public String getOptionsXML()
{
StringBuffer sb = new StringBuffer();
if( anRot != 0 )
{
sb.append( " AnRot=\"" + anRot + "\"" );
}
if( anElev != 15 )
{
sb.append( " AnElev=\"" + anElev + "\"" );
}
if( pcDist != 30 )
{
sb.append( " pcDist=\"" + pcDist + "\"" );
}
if( pcHeight ... |
a604a41a-284d-49ce-9896-8ed4c5c53a19 | 9 | public void setTimestep(String timestep) {
if ((!timestep.equals(SimConst.DAILY))
&& (!timestep.equals(SimConst.DAILY_MEAN))
&& (!timestep.equals(SimConst.MONTHLY_MEAN))
&& (!timestep.equals(SimConst.MEAN_MONTHLY))
&& (!timestep.equals(SimConst.ANN... |
6e95b20b-4fab-4995-be5b-0c3592bfea22 | 4 | public void modifyCountry(Country cnt) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
55a8d664-0301-4c4f-9107-c6e3888415c3 | 0 | public long getLastReceiptTime() {
return lastReceiptTime;
} |
94b6fa1a-2e6e-4a75-9d45-d3f6bdd534d9 | 7 | private static void mirror() throws Exception {
int initialSize = frames.size();
if (mapCenter == -1) {
throw new Exception("map-center was never declared.");
}
for (int fr = 0; fr < initialSize; fr++) {
if (fr != mapCenter) {
//This loop should be... |
979e5e81-09b0-4fef-9bb0-13d65cd6ee6f | 0 | @Basic
@Column(name = "CTR_ID_ELEMENTO")
public int getCtrIdElemento() {
return ctrIdElemento;
} |
c940802b-c8b4-49fe-98c3-61be04d630ca | 7 | public NusmvSTS explore(String nusmvFile) throws IOException {
logger.info("Using NuSMV to retrieve STS from SMV file");
init(nusmvFile);
int iteration = 0;
while (!this.pathsToExplore.isVisited()) {
iteration++;
logger.info("Starting up..");
startNuSMVConsole(nusmvFile);
// sendCommandToCons... |
50c3f847-d114-470f-9793-0be01e6f8fe1 | 7 | private void read(){
try{
String str = "";
String seqstr = "";
Sequence curseq = new Sequence();
while((str=input.readLine())!=null){
if(str.startsWith(">")){
if(seqstr.compareTo("")!=0&&curseq!=null){
curseq.seqSeq(seqstr);
seqstr = "";
seqs.add(curseq);
}
curseq = ne... |
820893f3-1d36-4943-9c0a-ad516d4a0d93 | 5 | public boolean move(int newBase)
{
//Save the registers if we're the currently running process
if(this == m_currProcess)
save(m_CPU);
//Get the relative locations to make for easier moving based on newBase
int relLIM = registers[CPU.LI... |
f22a8c77-c7b4-411e-b7c2-b7266e741527 | 1 | private void parameter()
{
if (have(NonTerminal.PARAMETER))
{
tryDeclareSymbol(current);
nextToken();
expect(Token.Kind.COLON);
type();
}
} |
e82d3d62-49ca-4840-adfd-dc7769e5efa5 | 6 | private static String _v2DirStr(Vector2d v)
{
if (v.equals(NIL)) return "DNIL";
if (v.equals(NONE)) return "DNONE";
if (v.equals(UP)) return "DUP";
if (v.equals(DOWN)) return "DDOWN";
if (v.equals(LEFT)) return "DLEFT";
if (v.equals(RIGHT)) return "DRIGHT";
re... |
baee0af8-0425-4dc7-878f-060a234ec64d | 3 | public SecondaryPowerFailure(Grid grid, int lifetime, PrimaryPowerFailure parentPowerFailure, Rotation rotation, Position pos) {
super(grid, lifetime);
if (parentPowerFailure == null)
throw new IllegalArgumentException("The given PrimaryPowerFailure is invalid!");
if (rotation == null)
throw new IllegalArg... |
8d6336b2-7633-49c4-919b-22f99f230e45 | 2 | public void addTrack(Song song) {
// System.out.println("Album called " + title + " inserting track named " + song.getTitle() + "...");
if(song.getTitle() == null) {
song.setTitle("No Title");
}
if(!albumContainsTrack(song)) {
tracks.put(song.getTitle(), song);
}
} |
a074271b-b28d-48af-a751-1afacf40f91f | 1 | public void visitInstanceOfExpr(final InstanceOfExpr expr) {
if (expr.expr() != null) {
expr.expr().visit(this);
}
print(" instanceof " + expr.checkType());
} |
ed9cc09c-db62-4871-94cb-b3e0a931c18f | 8 | private void decode(byte[] bytes) throws InvalidUIntException
{
if (bits != 1 && bits != 2 && bits != 4 && bits != 8)
throw new InvalidUIntException();
byteBuffer = ByteBuffer.wrap(bytes);
switch (bits)
{
case 1:
value = byteBuffer.get();
break;
case 2:
value = byteBuffer.getShort();
b... |
84924ce0-9ebf-4471-a0da-daef7927b7ca | 4 | public boolean equals(Object obj) {
if (obj == this)
return true;
/* is obj reference null */
if (obj == null)
return false;
/* Make sure references are of same type */
if (!(getClass() == obj.getClass()))
return false;
else {
Style tmp = (Style) obj;
if (tmp.name.equalsIgnoreCase(... |
dd70360b-09ca-4b51-9fb0-9c20e905dbef | 8 | public Move(GameBoard b, Position start, Position dest)
{
this.startPiece=b.getPiece(start);
this.start = start;
this.dest = dest;
killedPiece=b.getPiece(dest);
if(startPiece.getType()==Piece.KING&&!b.hasKingMoved(startPiece.getColor())){
flags=(byte)BitField.setBit(flags, KING_MOVED_FLAG);
}
if... |
513c84b0-413d-4f16-b63c-92f815b43358 | 9 | protected Direction moveRandomly(String logMe, Direction direction) {
final Unit unit = getUnit();
if (unit.getMovesLeft() <= 0 || unit.getTile() == null) return null;
if (logMe == null) logMe = "moveRandomly";
Random aiRandom = getAIRandom();
if (direction == null) {
... |
07be4fff-ec0f-49e6-bd46-a6a1f43125b8 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ControlScheme other = (ControlScheme) obj;
if (Jump != other.Jump)
return false;
if (Left != other.Left)
return false;
if (Right != other.Right)
return false;
return... |
3b0349e1-ef18-4856-8dd7-64f9625c5240 | 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... |
8e42f161-752c-4913-b7aa-4c99f9c0afba | 9 | public static RecordableTextAction getAction(int action) {
if (action<MIN_ACTION_CONSTANT || action>MAX_ACTION_CONSTANT)
return null;
switch (action) {
case COPY_ACTION:
return copyAction;
case CUT_ACTION:
return cutAction;
case DELETE_ACTION:
return deleteAction;
case PASTE_ACTION:
r... |
134f2e58-97bc-4b75-8060-d23eb8c57f5b | 7 | public static void main(String[] args) {
DataGIS gis = null;
TopRegionalRC rc = null;
DataGridUser user = null;
//FIRST STEP---------------------------------------------
//Initialize the GridSim package
int num_user = 1; // number of grid users
Calendar calendar... |
79a6650b-f711-4657-8dab-62e8a2ae1a88 | 8 | final public void Assignment() throws ParseException {
/*@bgen(jjtree) Assignment */
BSHAssignment jjtn000 = new BSHAssignment(JJTASSIGNMENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtreeOpenNodeScope(jjtn000);int op ;
try {
PrimaryExpression();
op = AssignmentOperator();
... |
2e1565c3-cacf-4798-907a-7adb5831b33f | 5 | public int[] twoSum(int[] numbers, int target) {
int[] a = {0,0};
Hashtable<Integer, Integer> hash = new Hashtable<Integer, Integer>();
for (int i = 0; i <= numbers.length-1; i++) {
hash.put(numbers[i], i);
}
for (int i = 0; i <= numbers.length-1; i++) {
Integer n = hash.get(target - numbers[i]);
if ... |
1ffc3ee6-0963-4980-8332-f06a6aef124d | 3 | private void processEvent(MouseEvent e, TouchCommandMessageType down) {
Dimension componentDimension = e.getComponent().getSize();
float xRate = (float) e.getX() / (float) componentDimension.width;
float yRate = (float) e.getY() / (float) componentDimension.height;
switch (down) {
case TOUCH_DOWN:
client... |
0a31b398-da4e-48e6-b947-2ec5bb4bb32e | 7 | public Object invoke(JMSRemoteRef jmsRemoteRef, Method method, Object[] params) throws Exception {
boolean oneway = JMSRemoteRef.isOneWay(method);
long timeout = 0;
if (!oneway) {
timeout = REQUEST_TIMEOUT;
if (method.isAnnotationPresent(Timeout.class)) {
... |
5e764f8c-4a1a-43f2-b7e2-81f08b783a49 | 0 | public void setTotalTicketsSold(long totalTicketsSold) {
this.totalTicketsSold = totalTicketsSold;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.