method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4a66cc1d-8b4a-47db-bd19-35473347f06f | 6 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
showHelp(sender);
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("list")) ... |
097aef29-0c6f-4e2d-a54c-cb4b8916a173 | 0 | @Override
public boolean singleStep() {
return false;
} |
0cd87cb3-f621-4e6e-9934-67da00b2e656 | 3 | public int compareTo(IdCount idCount) {
return (idCount.count > this.count ? 1 : (idCount.count != this.count ? -1 : (idCount.id < this.id ? -1 : 1)));
} |
b9af95a5-5c14-42d9-acc6-17be4f40d60e | 9 | protected String normalize(String s) {
StringBuilder str = new StringBuilder();
int len = (s != null) ? s.length() : 0;
for ( int i = 0; i < len; i++ ) {
char ch = s.charAt(i);
switch ( ch ) {
case '<': {
str.append("<");
break;
... |
570ae3d5-bf62-4959-802f-9fcda37482e7 | 8 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("numtri.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("numtri.out")));
int n = Integer.parseInt(f.readLine());
int[][] triangle = new int[n][n];
int[][] path = new... |
fd2c20c5-58e6-489f-ba58-dc79cf0b3407 | 0 | public GameStates()
{
currentState = States.Start;
} |
07fd2d74-6da3-4fae-ac4b-5bd0c1b44229 | 7 | private void init(OutputStream out, String encoding)
throws UnsupportedEncodingException, IOException {
internalOut = new OutputStreamWriter(out, encoding);
// Write the proper BOM if they specified a Unicode encoding.
// NOTE: Creating an OutputStreamWriter with encoding "UTF-16" DOES
// DOES write out... |
13670d9c-30cc-457c-a286-f7024e0943b4 | 5 | private boolean handleNoSync() {
try {
if (readByte() == 0) {
return false;
}
} catch (IOException e) {
stats.incrementStat(statPrefix + STAT_CONNECTION_FAIL);
log.info("RxThread: exception caught while trying to... |
42057895-1286-4770-8754-578ac783be03 | 0 | @Before
public void setUp() {
this.p = new Piste(5, 5);
this.e = new Este(0, 0, 10, 10);
this.t = new Taso();
} |
69760cff-e767-414d-b60f-505c179f6417 | 0 | public LinkedList<Instance> getInstances() {
return instances;
} |
a9c318e3-f605-402b-8515-82e77299ed60 | 3 | @Override
public String toString()
{
if (size() == 0) return "[]";
String string = "[";
boolean first = false;
for (int tile : this)
{
string += (first ? ", " : "") + tile;
first = true;
}
string += "]";
return string;
} |
ebaab6da-7824-4b25-9ea3-a9ca197a5ff4 | 9 | public static String assertRationalRotationMatrix(double[][] matrix,
int decimalPlaces) {
String rational = assertRationalMatrix(matrix);
if (rational != null) {
return rational;
}
if (matrix.length != 3) {
return "The rotation matrix does not comprise three rows:"
+ NEWLINE + representMatri... |
0e6fbda6-d6bc-4b5b-9296-5a795f170833 | 4 | private synchronized static void deleteTaskByID(String id, String mail) {
try {
XStream xstream = new XStream(new DomDriver());
File remFile = new File((String) Server.prop.get("taskFilePath"));
Task[] allTask = (Task[]) xstream.fromXML(remFile);
List<Task> retList = new ArrayList<Task>(Arrays.asList(... |
4c62da16-504d-4df1-99d2-32914063c651 | 7 | private Constructor<?> getXMLConstructor(Class<? extends OVComponent> c) {
for (Constructor<?> con : c.getConstructors()) {
if (con.getGenericParameterTypes().length == 2) {
if (con.getGenericParameterTypes()[0] == Element.class
&& con.getGenericParameterTypes()[1] == OVContainer.class) {
return con... |
8d29d403-b3b4-440b-9af6-eda29e156917 | 0 | public void beforePhase(PhaseEvent event)
{
FacesContext facesContext = event.getFacesContext();
HttpServletResponse response = (HttpServletResponse) facesContext
.getExternalContext().getResponse();
response.addHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "no-cache");
// Stronger ac... |
75ef963c-a3aa-4df0-b91b-dbf67e8530e9 | 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... |
cb0b60f1-088b-4960-9554-016622345210 | 5 | public MediaWiki endMove(final MediaWiki.EditToken moveToken, final String newFullName, final String reason, final boolean suppressRedirect, final boolean moveTalk, final boolean moveSubpages) throws IOException, MediaWiki.MediaWikiException {
final Map<String, String> getParams = paramValuesToMap("action", "move", "... |
b7cac42f-5518-4d15-bd77-259e9e297601 | 9 | @Override
public void addAllInner(Set<? extends IObject> interfaces,
Set<? extends IObject> classes) {
try {
long biggestId = Integer.MIN_VALUE;
// Add the objects
if (interfaces != null) {
for (IObject interf : interfaces) {
tree.addObject(interf);
// IdManager part of UI, will not show up... |
92ac0380-1900-4130-aad1-ec7034ffc4ec | 2 | @Override
public void removeSubProcess(ProductType productType, SubProcess subProcess) {
productType.removeSubProcess(subProcess);
tx.begin();
for (Stock s : subProcess.getStocks()) {
subProcess.removeStock(s);
}
TypedQuery<State> q = em.createQuery(
"SELECT s FROM states s WHERE s.subProcess=:sp", St... |
467d7bd7-eb03-42b8-90d8-99cd0c72f406 | 5 | @Override
public int read() throws IOException {
int c;
// If we have a block in here, start feeding that out.
if ((c = outBuffer.read()) != -1)
return c;
// Otherwise, time to make a block.
while (inBuffer.size() < ConCh.Delta(source.length, cod... |
59fd02bc-7db7-498b-b804-ae0c8629e491 | 1 | private BeanstreamResponse process(HttpUriRequest http,
ResponseHandler<BeanstreamResponse> responseHandler) throws IOException {
HttpClient httpclient;
if (customHttpClient != null)
httpclient = customHttpClient;
else
httpclient = HttpClients.cre... |
0882d425-65d8-432c-9a0e-eca2b20ecc02 | 0 | @Override
public void setReceiveException(IReceiveException exception) {
receiveException = exception;
} |
ffb0f087-9341-4be7-90e7-93d227f9a516 | 4 | public void copyFileToZip(File src, String dest) throws IOException {
if (!src.exists()) return;
createDirectory(dest);
for (File f : src.listFiles()) {
String target = dest + f.getName();
if (f.isDirectory()) copyFileToZip(f, target + "/");
if (f.isFile()) createFile(target, f);
}
} |
f87c0aba-1f79-4a64-aaed-1d1f21a02dc2 | 9 | public int[][] left(int grid[][]) {
score = 0;
for (int yIndex = 0; yIndex < 4; yIndex++) {
for (int xIndex = 3; xIndex > 0; xIndex--) {
if (grid[yIndex][xIndex - 1] == 0) {
for (int a = xIndex - 1; a < 3; a++) {
grid[yIndex][a] = g... |
293c439c-eae8-46f0-b651-94c0805aeb82 | 8 | public boolean checkTurn(ConnectionToClient player) {
if (player == playerX && currentMove == Move.X) {
return true;
} else if (player == playerX && currentMove == Move.O) {
return false;
} else if (player == playerO && currentMove == Move.X) {
return false;
... |
9f13735a-4850-4c58-b7c2-c831b923f822 | 8 | public int minDepth(TreeNode root) {
if(root == null) return 0;
LinkedList<TreeNode> que = new LinkedList<TreeNode>();
que.offer(root);
que.offer(null);
int res = Integer.MAX_VALUE;
int dep = 0;
while(!que.isEmpty()){
TreeNode n = que.poll();
... |
d0c9e264-f67c-4698-8900-03ea0817262c | 2 | public int indexOf(T theElement)
{
for(int i = 0; i < size; i++)
if(element[i].equals(theElement))
return i;
return -1;
} |
e85e42bb-6a6d-4508-adfa-5e42e08f7369 | 4 | public static void UpperGenre(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmnt... |
c0920b95-21e9-497e-baba-718c4b18848d | 1 | protected LegatoTokenResponse tokenizeCard(HttpsConnector connector, String cardNum, String cvd, int expiryMonth, int expiryYear) {
LegatoTokenRequest tokenRequest = new LegatoTokenRequest();
tokenRequest.number = cardNum;
tokenRequest.expiryMonth = expiryMonth;
tokenRequest.expiryYear = expiryYear;
tokenRequ... |
787ff8dd-8ee7-4aad-a05f-f392df8d9cdb | 7 | double getResult() {
//trim redundant spaces
String nums = getNumbers().trim();
//split <Numbers> string in tokens
StringTokenizer st = new StringTokenizer(nums, " ");
//add tokens to List
ArrayList<Double> al = new ArrayList<Double>();
while(st.hasMoreTokens())
try {
al.add(Double.par... |
c541a25f-66f5-49b9-acd6-bb24a738903b | 6 | public static void updateBoard(int nr) {
Game.updateMap(nr);
for (int i = 0; i < BSIZE; i++) {
for (int j = 0; j < BSIZE; j++) {
MapObject temp = Game.getMapObject(i, j);
if (temp instanceof Worm) {
Worm worm = (Worm) Game.getMapObject(i, j... |
1fda28a1-3580-42a4-a27b-1e369626ef39 | 2 | static public void decodeAllFilesInDirectory(String src)
{
File folder = new File(src);
File[] listOfFiles = folder.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
System.out.println(file.getName());
decodeFile(file.getPath());
}
}
} |
502066bd-7813-4f1c-918b-d9a980e38098 | 5 | public void update(){
if(add.size() > 0){
for(Entity ent : add){
entity.add(ent);
}
add.clear();
}
if(remove.size() > 0){
for(Entity ent : remove){
entity.remove(ent);
}
remove.clear();
... |
78fe8772-459d-4627-bbdd-7ff2e35a1c72 | 7 | private void setMapBoundries() {
if (!(intersections.isEmpty())) {
boolean first = true;
for (Intersection i : intersections) {
if (first) {
north = i.getLocation().y;
south = i.getLocation().y;
west = i.getLocation().x;
east = i.getLocation().x;
first = false;
} else {
if... |
db94a037-5fb1-4b11-be01-f2092158e550 | 9 | public Card[] pickCards(SelectCardOptions sco, Card[] allcards) {
GameQuery p = new GameQuery(QueryType.GETCARD, QueryType.CARD)
.setObject(sco);
p = query(p);
if (p == null)
return null;
if (p.t != QueryType.CARD)
return null;
if (p.o instanceof Car... |
f9eda1fb-03fb-413c-9a99-29034c35b188 | 8 | public Dimension getPreferredSize() {
final String text = getText();
boolean isEmpty = text.length() == 0
|| (HtmlTools.isHtmlNode(text) && text.indexOf("<img") < 0 && HtmlTools
.htmlToPlain(text).length() == 0);
if (isEmpty) {
setText("!");
}
... |
eea5998b-a8f7-4fae-94d0-4f0afd47f58e | 9 | public boolean getContainer(Container container, InlandShip ship,float tpf, int location) {
switch (getContainerInt) {
case 0:
if ((int) this.getLocalTranslation().x < location) {
this.move(tpf * 8 / 3f, 0, 0);
} else if ((int) this.getLocalTransla... |
91c9bc4e-8be4-43ab-b0ff-b3b7f32de31e | 8 | public Connection getConnection(){
if(sqlite){
if(!this.getFile().exists()){
plugin.getLogger().info("CRITICAL: Database does not exist");
try {
this.getFile().createNewFile();
Class.forName("org.sqlite.JDBC");
Connection dbCon = DriverManager.getConnection("jdbc:sqlite:" + this.getFile());
... |
5c7a0d6d-0541-449c-b954-167281e15e18 | 2 | public ListNode partition(ListNode head, int x) {
ListNode dummyBack = new ListNode(0);
ListNode dummyFront = new ListNode(0);
dummyBack.next = head;
ListNode p1 = dummyBack, p2 = dummyFront;
// 1. go from dummy
// 2. use p1.next != null
// can avoid using pre-pointer
while(p1.next != null){
if(p1.n... |
43f70808-a1e6-467d-9e7f-911999bfd21f | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final RestaurantServer other = (RestaurantServer) obj;
if (this.customersOrder != other.customersOrder && (this... |
fca314be-58cb-4e29-aeec-705a6913e7c9 | 3 | private boolean checkAllRows() {
boolean changed = false;
int numberChanged = 0;
//goes down so that rows aren't skipped
for(int z = height - SAFE_HEIGHT; z >= 0; z--) {
if(checkSingleRow(z)) {
changed = true;
numberChanged++;
for(int i = z + 1; i < height; i++) {
// z + 1 so that the delete... |
4710641a-aeaf-4baa-ae8a-7d2a8d7d2747 | 2 | public String getType(){
if(type==SSHDSS){ return Util.byte2str(sshdss); }
if(type==SSHRSA){ return Util.byte2str(sshrsa);}
return "UNKNOWN";
} |
8b548384-2ba2-4f9d-8a92-3ce7dabf22ef | 7 | public static void main(final String[] args) throws Exception {
if (args.length < 2) {
showUsage();
return;
}
int inRepresentation = getRepresentation(args[0]);
int outRepresentation = getRepresentation(args[1]);
InputStream is = System.in;
Outpu... |
808ca787-b507-4c04-a154-63d19f6bbb63 | 2 | public Essay getModel(int Question_ID) {
Essay essayQuestion = new Essay();
try {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT QuestionID,QuestionType,noofwords, instructions");
sql.append(" FROM `Essay`");
sql.append(" where QuestionID=" +... |
d8cddf9e-3c56-4b21-8f06-4634deb5eec9 | 8 | public void alta(){
String dni,cuenta;
int titulares=0,salir=0;
cuenta=calcularCuenta();//Llamo al método para que me devuelva un número de cuenta a usar
do{//Do while para incluir varios titulares
do{//do while para pedir un DNI correcto de 9 caracteres. No optimiza... |
0dc28185-9c42-4b83-85cf-34f503c2311c | 6 | public void gestionHabitaciones(int reservaEco, int reservaVip) {
while (true) {
int parada = (int) ((Math.random() * 10000 + 1000));
try {
Thread.sleep(parada);
} catch (InterruptedException ex) {
Logger.getLogger(Vip.class.getName()).log(Leve... |
101dafac-6cf7-4c6e-95ae-1be692391e16 | 1 | public Class<? extends Annotation> getScope() {
return metadata.getScope();
} |
dd14bc9e-4fec-4621-a20a-41745753f0ab | 0 | public void setSaleId(int saleId) {
this.saleId = saleId;
} |
849c2799-e101-4296-83f8-fe99e1a4ba4a | 8 | @Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
switch (action) {
case "Exit":
String exitMessage = "Are you sure you wish to exit?";
int doExit = JOptionPane.showConfirmDialog(null, exitMessage, action, JOption... |
64bd4f57-0b51-4c59-8a1e-dbc61d12345a | 0 | public String attempt(String gameid, String combi) {
Game game = games.getGame(gameid);
List<Token<Colors>> colors = getColors(combi);
Combination<Colors> combination = new Combination<Colors>(colors);
Answer answer = game.giveAnswer(combination);
return answer.toJson();
} |
bc6ff603-aae4-466d-af32-0324d07a4b5d | 3 | public static void main(String[] args) {
// TODO Auto-generated method stub
for (int i = 2; i <= 9; i += 4) {
for (int j = 1; j <= 9; j++) {
for (int k = 0; k < 4; k++) {
System.out.print((i + k) + " * " + j + " = " + (i + k) * j + "\t");
}
System.out.println();
}
System.out.println();
... |
ccbeffd5-3239-4c05-9678-55d73428ba9a | 1 | public void exception(){
long result = a.getTimeLeftInMillis();
if(result <= 0){
System.out.println("The bid for " + a.getName() + " has expired.");
}
} |
20224d6b-c8a5-4a5a-84fa-757d8bc25f72 | 4 | public double getActionPower(Instance vision, String powerType) throws Exception {
// Make the decision by model
if (powerType == StringUtil.DASH_POWER && dashPowerCls != null) {
return dashPowerCls.classifyInstance(vision);
} else if (powerType == StringUtil.KICK_POWER && kickPowerCls != null) {
return kic... |
a87ddfda-2a3a-4759-8601-c31d71b3cfe0 | 0 | public Point3 minus(Point3 p){
return new Point3(this.x - p.x, this.y - p.y, this.z - p.z);
} |
119650c0-30f0-4e6f-a328-e42c198d070f | 4 | private void removeEntity(int x, int y, Entity e) {
if (x < 0 || y < 0 || x >= w || y >= h) return;
entitiesInTiles[x + y * w].remove(e);
} |
2013ced2-f419-41af-b025-3633ea719ae6 | 3 | private Chromo<T> rouletteSelection(){
Chromo<T> selected = null;
double totalFitness = individuals.stream()
.mapToDouble(chromo -> chromo.getFitness()).sum();
double slice = rand.nextDouble() * totalFitness;
double fitnessSoFar = 0;
if (totalFitness == 0){
selected = getRandomChromoFromPopulation()... |
54684b35-7886-4eae-a7d2-ec96dc4f20ad | 8 | public DataModel(String path) {
this.classSet = new TreeSet<>();
this.classValuesMap = new HashMap<>();
try(BufferedReader br = new BufferedReader(new InputStreamReader(
new BufferedInputStream(new FileInputStream(new File(path)))))) {
String line = br.readLine();
String[] parts = line.split("\\s+");... |
2162e19e-f265-4550-b6ed-e1833e2e533b | 3 | public MiniXMLToken getTokenTagName(MiniXMLToken oMiniXMLToken, int type) {
bInsideTag = true;
int token = getNext();
oMiniXMLToken.setValue(token);
if (isFirstNameChar(token)) {
oMiniXMLToken.setType(type);
while (true) {
if (!isNameChar(testNext()))
return oMiniXMLToken;
oMiniXMLToken.appen... |
08437744-9b32-4b40-9eef-94d27b42d7f0 | 2 | public List<String> getSubNodes(String node)
{
List<String> ret=new ArrayList<String>();
try
{
for(Object o:fconfig.getConfigurationSection(node).getKeys(false))
{
ret.add((String) o);
}
}
catch(Exception e){}
return ret;
} |
aa8e24d6-a28a-4042-859c-78b115c8e7e6 | 5 | @Override
public HashMap<String,String> getAvailableCommands()
{
HashMap<String,String> toRet = new HashMap<String,String>();
ArrayList<Class<?>> availableCommands = (ArrayList<Class<?>>) ReflectionHelper.getCommandClasses();
for(Class<?> comm:availableCommands)
{
try
{
Command currComm = (Command)c... |
263b0353-ece3-4fbf-b5ed-3786643f430c | 3 | int method328(int arg0) {
if (anInt545 >= anInt541) {
anInt544 = anIntArray537[anInt542++] << 15;
if (anInt542 >= anInt535) {
anInt542 = anInt535 - 1;
}
anInt541 = (int) (anIntArray536[anInt542] / 65536D * arg0);
if (anInt541 > anInt545) {
anInt543 = ((anIntArray537[anInt542] << 15) - anInt544)... |
c302f357-f199-4fac-b14a-1452902c3a16 | 4 | @Test
public void testLuoHarjoitusJaTarkistaTehtavat() {
boolean oikeinMeni = true;
try {
this.kone.luoHarjoitus("m", lkm);
} catch (Exception exception) {// EXCEPTION
System.out.println("Airmetiikkakone.luoHarjoitus-virhe");// EXCEPTION
}
for (int ... |
8142eceb-f1f3-477d-850a-5b29bbf9f30e | 8 | /* */ public void moveToBest()
/* */ {
/* 211 */ Random r = new Random();
/* 212 */ if ((Math.abs(this.x - this.bestPosX) < 2) && (Math.abs(this.y - this.bestPosY) < 2)) {
/* 213 */ this.speedX = 0.0F;
/* 214 */ this.speedY = 0.0F;
/* 215 */ setMoveTo(false);
/* 216 */ return... |
6d585faf-6475-476d-ac3e-1efa66e6123a | 3 | public String[] getVariablesOnLHS() {
ArrayList list = new ArrayList();
if(myLHS == null) return new String[0];
for(int i = 0; i < myLHS.length(); i++) {
char c = myLHS.charAt(i);
if (ProductionChecker.isVariable(c))
list.add(myLHS.substring(i, i + 1));
}
return (String[]) list.toArray(new Str... |
ad086be9-333f-4b40-b7bb-5942537a8afc | 8 | private static String date_format(double t, int methodId)
{
StringBuffer result = new StringBuffer(60);
double local = LocalTime(t);
/* Tue Oct 31 09:41:40 GMT-0800 (PST) 2000 */
/* Tue Oct 31 2000 */
/* 09:41:40 GMT-0800 (PST) */
if (methodId != Id_toTimeString) {
... |
65c0336b-72dc-475f-83cb-fe2140078c27 | 8 | protected JPanel createDaysGUI() {
JPanel daysGrid = new JPanel(true);
daysGrid.setLayout(new GridLayout(0, dayName.length));
// What day is today in case we need to highlight it
Calendar today = Calendar.getInstance();
int todayMonth = today.get(Calendar.MONTH);
int tod... |
89a67ce1-8c77-44c6-b15c-409be40d9e27 | 2 | @Test
public void WhenUpdatingWithNullHostAndRefmaxLesserThanLevelSize_ExpectReducedLevelSize() throws UnknownHostException {
RoutingTable routingTable = new RoutingTable();
localhost_.setHostPath("0");
routingTable.setLocalhost(localhost_);
PGridHost aHost = new PGridHost("127.0.0.1... |
bb9ded02-70f6-4fd0-ace3-d677b05025e5 | 6 | public static ArrayList<Word> analyze(String string) {
StringTagger tagger = SenFactory.getStringTagger(null);
List<Token> tokens = new ArrayList<Token>();
ArrayList<Word> arrayList = new ArrayList<Word>();
try {
tagger.analyze(string, tokens);
for (Token token : tokens) {
Word word = new Word();
... |
dc32aea9-4f00-430e-b6d4-97c0caf16772 | 2 | @Override
public boolean equals(Object obj)
{ if(obj instanceof Pair)
{ Pair that=(Pair)obj;
{ return (this.s.equals(that.s)&&this.t.equals(that.t));}
}
else { return false;}
} |
22823157-f2b1-4bd5-b18a-dfe61915efa2 | 4 | @Override
public void kill() {
setRunning(false);
listening = false;
try {
if (serverSocket != null)
serverSocket.close();
for (ClientConnection client : clientConnections) {
if (client.getClientSocket() != null)
client.getClientSocket().close();
}
} catch (IOException e) {
e.printStac... |
ef5a4fd9-4a55-411f-afa7-f9c48afbe445 | 1 | public boolean isAutoscrollOnStatus() {
if(frame == null) buildGUI();
return autoscrollStatus.isSelected();
} |
b7505fc0-4b9b-476e-b410-8ca212b81674 | 2 | public void swim(int k) {
/**
* Checking for isLesser makes sure that the >= property of MaxHeap is
* satisfied.
*/
while (k > 1 && isLesser(k / 2, k)) {
swapArrayValues(k / 2, k);
k = k / 2;
this.arrayAccess += 2;
this.comparisi... |
9e58f1d5-f48d-4638-b3e0-4849c3c0e003 | 3 | public List<CmisObject> getQueryResults(String queryString) {
List<CmisObject> objList = new ArrayList<CmisObject>();
System.out.println(queryString);
// execute query
ItemIterable<QueryResult> results = session.query(queryString, false);
for (QueryResult qResult : results) {
... |
746bd333-8246-4d15-b31a-901c22cf887a | 2 | public MP3Container getClone() {
Vector<MP3> temp1 = new Vector<MP3>();
for (int i = 0; i < size();i++) {
temp1.add(list.get(i));
}
Vector<Integer> temp2 = new Vector<Integer>();
for (int i = 0; i < size();i++) {
temp2.add(i);
}
return new MP3Container(temp1,temp2);
} |
676b7969-a1cf-4f66-8033-2bc5ccea6281 | 8 | public static void cashSelected()
{
askForAmount();
String s = sc.nextLine();
BigDecimal cashAmt;
cashAmt = BigDecimal.valueOf(Double.parseDouble(s));
if (payments == null || payments.isEmpty())
{
if (s == null || s.isEmpty())
{
System.out.println("Error: Please enter a valid cash amount.");
... |
d331a9e6-10cd-4222-80ae-b59f9bd45957 | 8 | public synchronized static int getStatus() {
if (serverMainThread == null) {
return DEAD;
} else if (serverMainThread.isAlive()
&& !serverMainThread.isInterrupted()) {
return RUNNING;
} else if (serverListeningThreads == null) {
return DEAD; //... |
55585945-8b40-42a5-b6ba-c07c3870a2be | 9 | public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
if (eastComponent != null) {
Dimension d = eastComponent.getPreferredSize();
dim.width += d.width + getHgap();
dim.height = Math.max(d.height, dim.height);
}
i... |
ef6785d2-c38d-45b3-966b-d961ddce4005 | 5 | private String parseDependencyFromLine(String line) {
String addedPath = null;
if ((line != null) && line.startsWith("//:include ")) {
addedPath = getNormalPath(line);
} else if ((!isIgnoreRequire()) && (line != null) && (line.startsWith("//= "))) {
addedPath = MiniProcessorHelper.getRequirePath... |
4b33c070-1672-4e49-a1e1-ab6261ccc791 | 3 | public int getMaxZCaveSpot() {
int count = caveSpots.size();
int[] caveSpot;
int zMax = 0;
int iMax = -1;
for(int i = 0; i < count; i++) {
caveSpot = (int [])caveSpots.get(i);
if(caveSpot[0] > zMax && caveSpot[2] - caveSpot[1] > 3) {
zMax =... |
5800a169-5d08-4b4d-8945-1d1d88783de6 | 6 | public static void main(String[] args) {
// String queryString ="SELECT ?actor ?news WHERE {\n"+
//
// "SERVICE <http://linkedmdb.org/sparql> {" +
// "?film <http://purl.org/dc/terms/title> 'Tarzan' .}\n"+
// "SERVICE <http://linkedmdb.org/sparql> {" +
// "?film <http://data.linke... |
6e8d52a3-30d1-4fea-bf00-9ea9ffefeaf2 | 3 | public static void main(String[] args) throws Exception {
Runnable server = new Runnable() {
@Override
public void run() {
try {
new SocketServerExample("localhost", 8090).startServer();
} catch (IOException e) {
e.p... |
8d97580f-d318-4d57-bada-d164a1919481 | 2 | public static List<IComponent> getAllChildrenComponents(Entity entity, List<IComponent> componentList) {
Children childrenComponent = entity.getComponent(Children.class);
// Our base test, stop recursion if we no longer have children
if (childrenComponent == null) {
return componentList;
}
for (Entity ch... |
91fc0eb9-0fdf-456c-844d-0cd0f98b5a1f | 5 | private void deleteFile() {
HashMap<String, FileStructure> currFileList = fileUtil.getAllFiles(rootDirAddress, true);
Iterator iter = currFileList.keySet().iterator();
while(iter.hasNext()) {
String currFileName = (String)iter.next();
// here we have a bug, cannot delete ... |
4f8156a5-60f6-44dc-a544-b03f0e03ff2f | 0 | protected void addDuplicate(URI uri) {
this.duplicates.add(uri);
} |
262b5b17-eb91-4279-8ffb-c1a81db10c2e | 4 | private AFParser recursiveAFNEGenerate(RegularExpresionNode node) {
AFParser result = null;
if(node instanceof ConcatNode){
RegularExpresionNode left = ((ConcatNode)node).leftOperandNode;
RegularExpresionNode right = ((ConcatNode)node).rightOperandNode;
result = this.... |
3c538eb5-3a41-4581-87fd-bf1924b21904 | 7 | private static ArrayList<Configuration> sautRecursif(Configuration conf, byte[] triplet, byte typeSauteFirst, boolean noirEnPlayer){
ArrayList<Configuration> listeConf = new ArrayList<Configuration>();
byte caseDebut = triplet[0];
byte typeSaute = triplet[1];
byte caseFin = triplet[2];
byte newTurttle... |
25227502-c895-4c94-ae62-f4cfb8690a7d | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
1c5d583d-6514-45fd-bdbe-06ef866a44de | 3 | private void findRecursive(File folder) {
for(File file : folder.listFiles()) {
if(file.isDirectory()) {
findRecursive(file);
}
if(FilenameUtils.getExtension(file.getName()).equals("java")) {
results.add(file);
}
}
} |
96478c03-15cd-4c92-87ec-9fcb651eb851 | 8 | public void checkImgDir(){
if(xDirection > 0 && pDir != 3){
pDir = 3;
}
if(xDirection < 0 && pDir != 2){
pDir = 2;
}
if(yDirection < 0 && pDir != 1){
pDir = 1;
}
if(yDirection > 0 && pDir != 0){
pDir = 0;
}
} |
7cbb9c46-52e9-4d6a-98df-d8f2b356318f | 6 | private static boolean validateRGB(String[] rgb) {
if (rgb.length < 3) {
return false;
}
for (String color : rgb) {
if (color.isEmpty() || color.length() > 3) {
return false;
}
short value = Short.parseShort(color);
if (value < 0 || value > 255) {
return false;
}
}
return true;
... |
25f91de2-a6ad-41ff-a4af-7c845aac3397 | 4 | public void actionPerformed(ActionEvent e)
{
AbstractButton b = (AbstractButton) e.getSource();
if (b == quoteBtn)
{
getQuote();
} else if (b == orderBtn)
{
placeOrder();
} else if (b == marketBtn)
{
priceText.setText("");
} else if (b == limitBtn)
{
priceText.selectAll();
priceText.r... |
2689e23d-5670-4aca-b470-9ccf70577d53 | 1 | @Override
public void execute(String[] input) {
Properties preferences = laura.getPreferences();
String userName = preferences.getProperty("userName");
if (userName == null) {
laura.print("Hello, my name is LAURA. What's yours?");
userName = laura.getInput();
laura.print("Great to meet you, " + userN... |
4583abca-a63b-488c-b746-94c8296fef6f | 7 | public void processMouseReleased(int x, int y)
{
// ARE WE COMPLETE MAKING OUR SHAPE?
if (state == PoseurState.COMPLETE_SHAPE_STATE)
{
// WE HAVE TO USE POSE SPACE COORDINATES
Rectangle2D poseArea = zoomableCanvasState.getPoseArea();
float zoomLevel = zoom... |
b46017e6-3cbb-44ac-bfa7-bc55f2858767 | 2 | public void insertarFinal(T obj){
// Variable auxiliar
Nodo<T> q = p; //EL nodo auxiliar
Nodo<T> t = new Nodo<>(); //El nuevo nodo a insertar
t.setValor(obj);
t.setLiga(null);
if(p == null){
p = t;
}else{
//ciclo que recorre la lista
while(q.getLiga() != null){
q = q.getLiga();
}
q.s... |
98f51a40-6656-4b01-b84c-1dc3b562609b | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idEntrada != null ? idEntrada.hashCode() : 0);
return hash;
} |
584e14c4-4574-44a5-bca4-f300f8a71729 | 5 | public static Sujet creerSujet(Categorie categorie, String sujet, String message, boolean sticky, Utilisateur auteur, Icone icone)
throws ChampInvalideException, ChampVideException {
if (!categorie.peutCreerSujet(auteur))
throw new InterditException("Vous n'avez pas les droits requis pou... |
127e0512-823f-47ff-abfe-f64cbc121605 | 9 | public String toString() {
// only ZeroR model?
if (m_ZeroR != null) {
StringBuffer buf = new StringBuffer();
buf.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
buf.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n\n");
buf.append("Wa... |
fd15951b-097d-4b2e-b528-2acbeec8fe4d | 9 | @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 MateriaPK)) {
return false;
}
MateriaPK other = (MateriaPK) object;
if ((this.idpropuesta == null && other.idpr... |
fe7ced8f-ec61-4199-ae71-389d37c464b3 | 9 | protected boolean encodeHeader(int alphabetSize, int[] alphabet, int[] frequencies, int lr)
{
EntropyUtils.encodeAlphabet(this.bitstream, alphabet, alphabetSize);
if (alphabetSize == 0)
return true;
this.bitstream.writeBits(lr-8, 3); // logRange
int inc = (alphabetSize > 64) ? 16 :... |
745c90ef-522b-4db3-b613-f5f692031c4a | 9 | private void cores() {
Menu m = new Menu("CORES");
m.inclui("listar", "Todos as cores e modificadores");
m.inclui("incluir", "Adicionar um nova cor");
m.inclui("incluir2", "Adicionar um novo modificador");
m.inclui("remover", "Remover uma cor");
m.inclui("remover2", "Rem... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.