method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
44b5e23c-bc9a-49f2-8c28-2e227ca3434a | 2 | public static void main(String[] args)
{
RTMPSClient client = new RTMPSClient("prod.na1.lol.riotgames.com", 2099, "", "app:/mod_ser.dat", null);
try
{
client.connect();
if (client.isConnected())
System.out.println("Success");
else
System.out.println("Failure");
}
catch (Exception e)
{
e... |
2eab5464-1596-4d7b-a364-ba5ea7886efd | 0 | @Basic
@Column(name = "SOL_ESTADO")
public String getSolEstado() {
return solEstado;
} |
6c3f0b7e-e75f-46b8-b764-5d97c6691795 | 6 | protected String getRecordID(URL aURL) {
String objURL = aURL.toString() + "/object";
// Run a new test
try {
WebClient webClient = new WebClient();
XmlPage page = webClient.getPage(objURL);
Iterator<DomNode> iterator = page.getDescendants().iterator();
while (iterator.hasNext()) {
DomNode domNo... |
636a91a5-e6c2-4751-af82-90a129fb6262 | 8 | public List<ShipAction> getTurn(Integer turnCount) throws ConnectionLostException {
try {
/*
* check to see if something is arrived in time. Otherwise, assume
* no input.
*/
@SuppressWarnings("unchecked")
Integer returnedTurnCount = (Integer)socket.readObject(false);
if (returnedTurnCount == ... |
807558b8-6fc6-4379-886c-2e92a799e5ee | 4 | public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... |
0b044900-1871-491a-82ba-f0f3469a11f6 | 1 | public void testIsBefore_LocalDateTime() {
LocalDateTime test1 = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
LocalDateTime test1a = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
assertEquals(false, test1.isBefore(test1a));
assertEquals(false, test1a.isBefore(test1));
assertEq... |
660aa4c1-e481-4f4b-8560-93b4b445f83a | 2 | public String regresaNombre(String login) {
String res = "";
try {
Class.forName(driver);
Connection con = DriverManager.getConnection(connectString, user, password);
PreparedStatement query = con.prepareStatement(" select usuarios.nombre from usuarios join"
... |
ad994356-30d8-498a-aee2-fb00a10632f7 | 8 | protected int takeStep(int i1, int i2, double alpha2, double alpha2Star, double phi2) throws Exception {
//procedure takeStep(i1, i2)
//
// if (i1 == i2)
// return 0
if (i1 == i2) {
return 0;
}
double C1 = m_C * m_data.instance(i1).weight();
double C2 = m_C * m_data.instance(... |
f7a46672-db3a-417c-a2aa-265ea12ac30d | 8 | static boolean isGetallenReeks(String reeks) {
boolean getallen = false;
int getalCount = 0, woordCount = 0;
for(int i = 0; i < reeks.length(); i++) {
if(reeks.charAt(i) > 47 && reeks.charAt(i) < 58)
getalCount++;
else if(reeks.charAt(i) > 64 && reeks.charAt(i) < 91)
woordCount++;
else if(reeks.... |
2c03cc18-6d28-46e9-976d-1ed41a8c0468 | 3 | public static void main(String args[]){
long start = System.currentTimeMillis();
try{
BufferedReader inputStream =
new BufferedReader(new FileReader("myIntegers.txt"));
String line = inputStream.readLine();
while(line != null){
System.out.println(line);
line... |
db5df296-3a2a-45a5-8ccb-162441dfb67e | 1 | public static void main(String[] args) throws InterruptedException, ExecutionException {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Set<Callable<String>> callables = new HashSet<Callable<String>>();
callables.add(new Callable<String>() {
public String ca... |
d0becb61-c884-4d93-8e58-192304623821 | 8 | public LayoutMessage(BinaryReader in, Superblock sb, long address) throws IOException {
in.setOffset(address);
this.m_address = address;
this.m_version = in.readByte();
if(this.m_version < 3) {
this.m_numberOfDimensions = in.readByte();
this.m_type = in.readByte();
in.skipBytes(5);
... |
db89d50a-14a6-42e7-b5ba-8afda69a7de4 | 3 | private static StatBase[] initMinableStats(String var0, int var1) {
StatBase[] var2 = new StatBase[256];
for (int var3 = 0; var3 < 256; ++var3) {
if (Block.blocksList[var3] != null && Block.blocksList[var3].getEnableStats()) {
String var4 = StatCollector.translateToLocalForm... |
1db01f39-60ac-4f48-b04f-38e2235b21c2 | 1 | private boolean jj_3_66() {
if (jj_scan_token(EXCLAMEQUAL)) return true;
return false;
} |
00011f1b-b5ae-426d-88f4-f53110872ed5 | 7 | public byte getLoginState() {
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps;
ps = con.prepareStatement("SELECT loggedin, lastlogin, UNIX_TIMESTAMP(birthday) as birthday FROM accounts WHERE id = ?");
ps.setInt(1, getAccID());
... |
f84cb994-fa03-488b-a90f-7f1b363bbb9b | 3 | @Override
public float contains( int x, int y ) {
Path2D path = connection.getClosedConnectionPath();
if( path == null ) {
return 0.f;
}
for( int i = 0; i <= precision; i++ ) {
int delta = 2 * i + 1;
if( path.intersects( x - i, y - i, delta, delta ) ) {
return (precision + 1.f - i) / (precision + ... |
86cb5db3-1d76-43c5-bada-c0bb7d70eb5e | 8 | @Override
public boolean setRingLeft(Wearable ring) throws NoSuchItemException, WrongItemTypeException {
if (ring != null) {
if (ring instanceof Ring) {
if (ring.getLevelRequirement() > level || ring.getStrengthRequirement() > stats[0]
|| ring.getDexterityRequirement() > stats[1] || ring.getMagicRequire... |
a2f4a71f-16ba-4dbd-8b73-f5a21a307c00 | 6 | public void removePlayer(int id){
for(int i = 0 ; i < this.nbConnected ; i++){
if(players.get(i).getPlayerId() == id){
printToExcept("EXITED/"+players.get(i).getNom()+"/\n", id);
players.remove(i);
break;
}
}
if(nbConnected > 0)
nbConnected--;
if(drawer != null){
if(drawer.getPlaye... |
c2b5fb6b-6ecc-4863-b79d-93bb02c56503 | 2 | public boolean teleportAllToSpawn() {
boolean failure = false;
for (String s : playersInGame)
if (!Locations.teleportToSpawn(Bukkit.getPlayer(s))) failure = true;
return !failure;
} |
4e94b52a-f545-4342-9130-c54999fecd9d | 8 | static void addTab(final JTabbedPane tp,File file) throws IOException {
//JEditorPane ep = new JEditorPane();
JTextArea ep = new JTextArea();
TextLineNumber tln = new TextLineNumber(ep);
ImageIcon icon;
JLabel label;
icon = createImageIcon("images/unsaved.png");
label = new JLabel("New")... |
372cc706-c138-4b61-ac3b-4ee290068a99 | 4 | public static void main(String[] args) {
//Teste da arvore B com JOptionPane
String Ordem = JOptionPane.showInputDialog("Entre com a ordem da arvore:");
if(Ordem == null || Ordem.length() == 0){return;}//entrada vazia(cancelamento do panel)
for(int j =0; j < Ordem.length(); j++){//testa se entrada nao é int... |
f4313734-0104-4f8a-a734-d3666dc99898 | 4 | public static void setAccounting(Accounting accounting) {
journals = accounting==null?null:accounting.getJournals();
accounts = accounting==null?null:accounting.getAccounts();
accountTypes = accounting==null?null:accounting.getAccountTypes();
balances = accounting==null?null:accounting.g... |
aa5cf6ae-1072-4977-b1a6-cf3f8ef3ad67 | 7 | private List getAtgData(List<SystemObject> objects) {
// ermittelt die Atgs
final HashSet<SystemObjectType> allObjectTypes = new HashSet<SystemObjectType>();
final HashSet<AttributeGroup> allAttributeGroups = new HashSet<AttributeGroup>();
// Erst die Typen der selektierten Objekte ermitteln
for(SystemObject ... |
3c06b99a-2092-4881-904e-a72abfbdba69 | 2 | private void succ() {
hasNext = false;
pos++;
while (pos < items.length) {
if (items[pos] != null) {
hasNext = true;
return;
}
pos++;
}
} |
63c977b4-8352-4ebf-bc1e-c9e8c4a01fbc | 3 | private void getAllIP() {
try {
FileInputStream fstream;
String filePath = getClass().getProtectionDomain().getCodeSource().getLocation().toString();
//file path calculation when deployed in NetBeans
// int endindex = filePath.indexOf("dist/gfdeploy");
// ... |
4d4b595f-ec50-4a89-8535-c0364b2d9982 | 9 | @Override
public void actionPerformed(ActionEvent e) {
loginProcessFinished = false;
loginFinishCount = 0;
loginResult = false;
processingLabel.setVisible(true);
loginPanel.changeComponentsEnableStatus(false);
ExecutorService threadPool = Executors.newCachedThreadP... |
67ec4175-d0ef-4fab-8781-20e39355ae95 | 4 | private CompoundTag load()
{
File file = new File(path + player.getName() + ".dat");
FileInputStream input_stream;
NBTInputStream nbt_input;
CompoundTag tag;
try
{
input_stream = new FileInputStream(file);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
return null;
}
try
{... |
65718c06-f102-484c-9e62-27789def292a | 8 | public String longestCommonPrefix(String[] strs) {
if (strs == null)
return null;
if (strs.length == 0)
return "";
if (strs.length == 1)
return strs[0];
char[] first = strs[0].toCharArray();
int commonLen = first.length;
for (int i = 1;... |
2e127a67-da35-4583-99e1-211aab6f6bda | 9 | public static void main(String[] args) throws Exception
{
List<Holder> list = GetDistinctAlignedOrthologs.getList();
HashSet<String> names = new HashSet<String>();
for(Holder h : list)
{
String key = "Line_" + h.lineName;
names.add(key);
}
List<Boolean> includeList = new ArrayList<Boolean>()... |
60404c17-c22b-4900-aab3-ddb664541a4c | 3 | public Map<String, Double> getPrices() {
prices = new HashMap<String, Double>();
if(this.getManagerBean()!= null)
{
for(Spolka company : this.getManagerBean().getSpolki())
{
Double value = prices.get(company.getSector());
if(value == null)
... |
932e65fb-fb38-408d-99f1-f762d5d1ee34 | 1 | public static pgrid.service.corba.PeerReference[][] read (org.omg.CORBA.portable.InputStream istream)
{
pgrid.service.corba.PeerReference value[][] = null;
int _len0 = istream.read_long ();
value = new pgrid.service.corba.PeerReference[_len0][];
for (int _o1 = 0;_o1 < value.length; ++_o1)
value[... |
f3698983-baed-4a1f-bccc-32ea7f3d551e | 8 | public static int findTallest(Collection<Box> boxes){
ArrayList<Box> rotations = new ArrayList<Box>();
int maxHeight[] = new int[rotations.size()];
for(Box b : boxes){
rotations.add(b);
rotations.add(new Box(Math.max(b.height,b.width),Math.min(b.height,b.width),b.length));
rotations.add(new Box(Math.max(... |
4711bf83-c19a-41fe-9b30-786c4dfa9a70 | 5 | protected void initialize()
{
// Sets the backgrounds visible and animated
if (this.backgrounds != null)
{
for (int i = 0; i < this.backgrounds.size(); i++)
{
Background b = this.backgrounds.get(i);
b.setVisible();
b.getSpriteDrawer().activate();
}
}
// Activates all the objects and sets... |
96a99244-d433-4eee-8edf-b2079ebe2770 | 7 | public static void main( String[] args ) throws ClassNotFoundException, SQLException, IOException {
Class.forName("org.h2.Driver");
try(Connection connection = DriverManager.getConnection("jdbc:h2:mem:mydatabase","user1","password1")){
// Creation of the table
String tableName... |
417f12de-f7b3-4604-b28e-f16b2ac651eb | 5 | public void move() {
try {
doodle.move();
for (final Iterator<Enemy> enemyIterator = new ArrayList<>(enemies).iterator(); enemyIterator.hasNext(); ) {
final Enemy enemy = enemyIterator.next();
enemy.move();
if (enemy.isDestroyed()) {
... |
ca042ea5-4ca4-4906-aa7c-edfdbd4dff5a | 4 | public void accept(Visitor visitor) {
if (visitor.visit(this)) {
for (SpouseRef husband : getHusbandRefs()) {
husband.accept(visitor, true);
}
for (SpouseRef wife : getWifeRefs()) {
wife.accept(visitor, false);
}
for (ChildRef childRef : getChil... |
2700cf84-b4c6-4b47-b83c-49e6819be761 | 8 | private void saveProperty(String key, String value, String propFileDir) {
Properties tempPathProp = new Properties();
FileOutputStream outputStream = null;
InputStream inputStream = null;
try {
File tempPathFile = new File(propFileDir);
if (!tempPathFile.exists(... |
e8e4e744-e62f-42d2-9e3d-882fa7127b02 | 5 | private int getClusterInLegend(int x, int y) {
int clusterId = -1, clusterIndex;
if (x > legendX1
&& x < legendX2
&& y > legendY1
&& y < legendY2
&& (y - legendY1) <= (ChartData.getSize() * legendPartitionSize)) {
clusterIndex = ((int) Math.ceil((y - legendY1)
/ (double) legendPartitionSize... |
3ec2c1a5-0bee-400c-b371-7c59b2aa8baf | 1 | private void initPopupMenu(){
mainPopupMenu = new JPopupMenu();
ImageIcon itemDeleteIcon = new ImageIcon(Main.ICO_PATH + "table_row_delete.png");
JMenuItem itemDelete = new JMenuItem(" Delete ", itemDeleteIcon);
itemDelete.addMouseListener(new MouseAdapter() {
@Override
... |
245cd58a-cea8-44ea-b281-faf1e560a205 | 2 | private void incTurn() {
//Check if iterator is at end of bidders
if(!bidTurn.hasNext())
bidTurn = bidders.listIterator();
// Make sure bidders is not empty
if(bidders.size() > 0)
mP.setCurrentTurn(bidTurn.next());
} |
0cc3dd38-e9ec-414e-9b94-27a95974b809 | 6 | public void drawTiles(int layer, int x, int y){
int tileSize = parent.tilePanel.getTileSize();
int mouseX = x;
int mouseY = y;
if(mouseX > 0) mouseX = mouseX/tileSize;
else mouseX = 0;
if(mouseY > 0) mouseY = mouseY/tileSize;
else mouseY = 0;
int choice = parent.tilePanel.getChoice();
i... |
6167dc09-bc66-4c3a-b4e7-07fbccb5a06c | 4 | public synchronized Product editProduct(Product product) {
for (Product productAux : listProduct) {
if (productAux.getCode() == product.getCode()) {
listProduct.remove(productAux);
try {
listProduct.put(product);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (NullPointe... |
c6e26df0-600d-4ed2-a056-b61f95144bb1 | 9 | private void run_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_run_buttonActionPerformed
String result = "";
ArrayList<String> solution,submission;
if(numTests == 1) {
result = Shell.pythonCall(submission_fp, CourseAccess.accessTestIn(courseID, actName));
submission... |
4eb4e6f7-c03a-4e1b-964d-45ed7299eb73 | 8 | private void split(Node<T> nodeToSplit) {
Node<T> node = nodeToSplit;
int numberOfKeys = node.numberOfKeys();
int medianIndex = numberOfKeys / 2;
T medianValue = node.getKey(medianIndex);
Node<T> left = new Node<T>(null, maxKeySize, maxChildrenSize);
for (int i = 0; i < ... |
c7f41bed-8793-400b-893b-855ba2638f7c | 6 | public static boolean search(Map m, Vector2 startNode, Vector2 goalNode) {
// list of visited nodes
ArrayList<Vector2> closedList = new ArrayList<Vector2>();
// list of nodes to visit (sorted)
ArrayList<Vector2> openList = new ArrayList<Vector2>();
openList.add(startNode);
while (!openList.isEmpty()) {
... |
b96cbfd3-4540-43ad-8f1c-f513165ad6c6 | 5 | @Override
public String execute() throws Exception {
TestFreemarkerUtil fm = new TestFreemarkerUtil();
List<User> users = new ArrayList<User>();
users = this.service.fetchUsersList(); //get user list
String[] clubs;
List<String> club_name = new ArrayList<String>();
List<String> club_url = new ArrayList<St... |
6131a8d1-6eac-4b4d-a57f-d0975861897f | 8 | public static WavFile newWavFile(File file, int numChannels, long numFrames, int validBits, long sampleRate) throws IOException, WavFileException
{
// Instantiate new Wavfile and initialise
WavFile wavFile = new WavFile();
wavFile.file = file;
wavFile.numChannels = numChannels;
wavFile.numFrames = numFrames;... |
524e2fae-bf73-4689-834d-8c52b92f87a8 | 5 | public CheckResultMessage check1(int day) {
int r1 = get(2, 5);
int c1 = get(3, 5);
int r2 = get(6, 5);
int c2 = get(7, 5);
int r3 = get(22, 5);
int c3 = get(21, 5);
int r4 = get(25, 2);
int r5 = get(43, 5);
int c5 = get(44, 5);
BigDecimal x1 = new BigDecimal(0);
BigDecimal x2 = new BigDecimal(0);... |
62effdaa-e2a8-4d44-9771-b3a71e5e09b9 | 6 | private static void fillMap() {
MapIterator<MeanElapsedTime, CompositeTime> mapIter;
MeanElapsedTime meanTime;
// 1. Eintrag
meanTime = new MeanElapsedTime();
meanTime.addMeassurement(17.3);
meanTime.addMeassurement(64.8);
meanTime.addMeassurement(19.3);
map.insert(meanTime);
mapIter = map.iterator(... |
26e6f753-70ef-4181-aa8c-af27a7cd7b21 | 1 | public boolean Modificar(Object o) {
Transaction t = cx.beginTransaction();
try {
cx.update(o);
t.commit();
cx.flush();
return true;
} catch (Exception e) {
System.out.println("no se modifico");
t.rollback();
ret... |
2c9c2b23-3e7b-41ec-bf74-1d1fa6bc2c75 | 9 | public int [] peak(int x, int y)
{
// find the peak and minimum ssd coordinates.
float minp = Float.MAX_VALUE;
float mag = 0;
peakloc[0] = peakloc[1] = 0;
for (int l = -size/2; l <= size/2; l++)
{
for (int k = -size/2; k <= size/2; k++)
{
// look for minimum in size/2xsize/2 central... |
0c53b056-1b72-4169-8e61-56dd5501e457 | 4 | @Override
public int compare(Question question1, Question question2) {
if (question1.quizID < question2.quizID)
return -1;
else if (question1.quizID > question2.quizID)
return 1;
else {
if (question1.position < question2.position)
return -1;
else if (question1.position > question2.position)
... |
d9c61b52-55e9-45f0-bc84-0fd36048f8b1 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
1698a0c1-daa8-4ffa-912c-dc708e452faa | 8 | public XmlTag (String s)
{ int n=0;
int k=0;
n=skipBlanks(s,n);
while (n<s.length())
{ n=endItem(s,n);
k++;
n=skipBlanks(s,n);
}
if (k==0) return;
n=0;
n=skipBlanks(s,n);
int m=endItem(s,n);
Tag=s.substring(n,m);
n=m;
N=k-1;
Param=new String[N];
Value=new String[N];
for (int i=0; i<... |
cc3f6925-dc0a-42ef-99e5-57f3fd085226 | 2 | public Clazz findClazzFull(String clazz) {
DirManager manager = this;
while (manager != null) {
Clazz c = manager.findClazz(clazz);
if (c != null) return c;
manager = manager.getOwner();
}
return null;
} |
fa48d962-003b-4992-a0cb-96e814a41719 | 1 | @Override
protected void postUpdateState(GameContainer container, int delta) throws SlickException {
if (gui != null) {
gui.setSize();
gui.handleTooltips();
gui.updateTimers();
gui.invokeRunables();
gui.validateLayout();
gui.setCursor()... |
59b6b3ff-5e5e-427d-9839-fa837e87c66d | 5 | @Override
public int compareTo(Object o) {
if(o == this)
return 0;
TileXY other = (TileXY)o;
if(this.y == other.y){
if(this.x == other.x)
return 0;
if(this.x > other.x)
return 1;
else
return -1;
}
if(this.y > other.y)
return 1;
return -1;
} |
2f226e32-7733-45c0-9bc2-cfaef7249dd2 | 1 | public MethodInfo addNewMethod(final int modifiers, final int typeIndex,
final int nameIndex, final int exceptionIndex,
final int[] exceptionTypeIndices, final int codeIndex) {
final Exceptions exceptions = new Exceptions(this, exceptionIndex,
exceptionTypeIndices);
final Code code = new Code(this, codeIn... |
33518ee2-40c2-4eda-ba1b-3a7129c2e474 | 1 | public static TelaPrincipal getInstancia() {
if (TP == null) {
TP = new TelaPrincipal(userLogado);
}
return TP;
} |
8722a6e4-3513-4c44-8866-ee093e71faf3 | 4 | public void setStructTypeJAVA()
{
for(int i = 0; i != lstPair.size(); i++)
{
String typeOrigName = lstPair.get(i).getSecond();
if(typeOrigName.equals("character varying"))
{
lstPair.get(i).setSecond("String");
}
else if(typeOrigName.equals("integer"))
{
lstPair.get(i).setSecond("int");
... |
7743107a-cdd5-4eef-859e-8840561f46d6 | 7 | public boolean PingCamera(int Index) {
if (Parent.GetNoCameraParameter()) {
return true;
}
URLConnection conn = null;
BufferedReader data = null;
String line;
String result;
StringBuffer buf = new StringBuffer();
// try to connect
tr... |
77b43f3b-2a1c-4802-8825-6879f589acfe | 4 | public ConnectionFactory(){
_connectionConfig = ConnectionConfig.getInstance();
switch(Integer.parseInt(_connectionConfig.getProperty(ConnectionConfig.DRIVER))){
case 1 : this._iConnection = new PostgreSqlConnection(_connectionConfig.getProperty(ConnectionConfig.HOST),
... |
a327f7b9-f756-4318-abad-accb7741c55b | 7 | public static void main(String[] args) {
PorterStemmer s = new PorterStemmer();
for (int i = 0; i < args.length; i++) {
try {
InputStream in = new FileInputStream(args[i]);
byte[] buffer = new byte[1024];
int bufferLen, offset, ch;
bufferLen = in.read(buffer);
off... |
5e16c5ec-8a72-4906-bc7c-519bb7eab4d6 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((tickID==Tickable.TICKID_MOB)
&&(affected instanceof MOB))
{
final MOB M=(MOB)affected;
final MOB invoker=(invoker()!=null) ? invoker() : M;
if((M.location()!=castingRoom)||(M.amDead()))
unInvoke();
else
if((!M.amDead())
&&(M... |
b460e920-019d-4d7f-887e-48f8ab368eb1 | 5 | public double nFoldCrossValidation(Matrix features, Matrix labels, int n) {
int rows = features.getNumRows();
if (n > rows) {
throw new MLException(String.format(
"n [%d] must be <= row size [%d]", n, features.getNumRows()));
}
if (rows != labels.getNum... |
7b060ae8-644b-4ecb-b6e7-e73fa6d7cfc8 | 2 | public void run() {
try {
sleep(10000); // 10s until work starts.
while (true) {
System.out.println(theBuffer.getLine());
}
}
catch (Exception e) {/* Let thread terminate. */};
} // run |
26f1d88b-78db-48e0-b907-2ccb756ec65d | 9 | public int read(char[] outputBuffer,
int offset,
int size)
throws IOException
{
try {
int charsRead = 0;
int bufferLength = this.buffer.length();
if ((offset + size) > outputBuffer.length) {
size = outputBuffer.length - o... |
79d1d921-a815-46dd-9c44-da36c59e98f1 | 2 | public ArrayList<Instrucao> readSplited() {
ArrayList<Instrucao> insAux = new ArrayList<>();
Scanner ler = new Scanner(System.in);
System.out.printf("Informe o nome de arquivo texto:\n");
String nome = ler.nextLine();
try {
FileReader arq = new FileReader(nome);
... |
48c4b778-0ea5-409d-ac13-3441395f688f | 6 | public void compute(long iID, long jID, PostingMovie[] moviesForUseri, PostingMovie[] moviesForUserj, Boolean own){
int indexForI = 0;
int indexForJ = 0;
float [] calculationResult = new float[3];
while((indexForI<moviesForUseri.length)&&(indexForJ<moviesForUserj.length)){
if(moviesForUseri[indexForI].movieI... |
197c57bc-a1dc-4edb-8e44-aeb9380dcb54 | 3 | private void addComponents() {
for (Component component : componentAddBuffer) {
if (!componentClassToId.containsKey(component.getClass())) {
componentClassToId.put(component.getClass(),
componentIdPool.requestId());
}
int entityId = component.getOwner().getId();
int componentId = componentClass... |
607d13be-1fb8-47ad-832b-d18e51bcab62 | 4 | public static boolean checkLogin(Login l){
ArrayList<Staff> staffList = new ArrayList<Staff>();
staffList = StaffDAO.getAll();
if(staffList.isEmpty()){
return false;
}
for(Staff staff: staffList){
Login contrLogin;
contrLogin = staff.getLogin();
if(contrLogin.getStaffID().equals(l.getS... |
defe3417-bde4-4481-ac93-6bce2956c718 | 5 | public void setLoadingProgress(int var1) {
if(!this.mc.running) {
if(!this.field_1005_e) {
throw new MinecraftError();
}
} else {
long var2 = System.currentTimeMillis();
if(var2 - this.field_1006_d >= 20L) {
this.field_1006_d = var2;
Sc... |
ddeda4f6-08bf-4498-8b97-29e035316033 | 3 | public void fusionWithMultiply(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha = (color1... |
7b7334b2-0200-48f9-97e5-d4378e3b20c2 | 9 | public void authenticate() throws ParseException, SQLiteException, IOException {
String string;
JSONObject json;
// If not authenticated, commence
if (!authenticated) {
try {
// Keep reading messages from the server
... |
a8e7b0f4-e7a4-4da9-9274-ec44de9e236b | 7 | private static String getID(DamageType type){
switch(type){
case DARKMAGIC:
return "mutagenicHorror";
case ELECTRO:
return "electricField";
case FIRE:
return "fireyField";
case ICE:
return "chillyWind";
case PHYSICAL:
return "ghostlyPunches?";
case ROCK:
return "boulderFist";
case WIND... |
dc334777-4175-4892-9154-30929d61a537 | 5 | public boolean transferOwnerFile(Node oldOwner, String fileName)
{
try
{
FileManagerInterface iFace = (FileManagerInterface) getFileManagerInterface(oldOwner);
FileProperties transferedOwnerFile = iFace.getOwnerFile(fileName);
if(transferedOwnerFile != null)
{
this.addOwnerFile(transferedOw... |
763bba7f-6c4d-46b5-8462-7293d1d204c7 | 2 | public void removeOutgoingLink(Link l) {
Iterator<Link> iter = getOutgoingLinks().iterator();
while (iter.hasNext()) {
if (iter.next().getLinkID() == l.getLinkID()) {
iter.remove();
}
}
} |
34643189-e59d-47d7-a39d-2d9148ea2d3a | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
bc0fa5f4-e7c9-44a0-9a39-6a1a81b5a054 | 5 | public void setWidth( int newWidth )
{
/* if an image falls upon this column,
* adjust image width so that it does not change
*/
ArrayList iAdjust = new ArrayList();
ImageHandle[] images = myCol.getSheet().getImages();
if( images != null )
{
// for each image that falls over this colu... |
bfcdd24d-5ece-4244-bcf3-63e8dfde8296 | 7 | public static boolean BFS( ){
boolean bicoloreable = true;
Queue<Integer> cola = new LinkedList<Integer>();
cola.add(0);
color[0] = 1;
while (!cola.isEmpty()) {
int a = cola.poll();
for (int i = 0; i < mAdy.length; i++) {
if(color[i]==-1 && mAdy[a][i]){
cola.add(i);
if(color[a]==1)
... |
b9c405fe-a20c-4930-a58b-a452e59e25ca | 5 | public void writeControl (byte type, byte request,
short value, short index, byte buf [])
throws IOException
{
if (buf == null) { //added by Wayne Westerman 2002
//assume we're doing a No-Data-Control, and somebody has to make a 0-length buf
buf = new byte[0];
}
if ... |
2d7fba3d-4fcd-4b71-9f60-b8b2d28fb117 | 7 | public String
replace_vars(String input, String context)
{
if(log_level >= 4) log.log(4, key, "replace_vars called.", "\n");
if(log_level >= 4) log.log(4, key, "input: ", input, "\n");
if(log_level >= 4) log.log(4, key, "context: ", context, "\n");
String tmp = null;
String rv = null; // ret... |
793f3b3a-449a-4c36-8076-1801be5ffa5a | 8 | public void waitForPlayer()
{
//DEBUG
System.out.println( "Entered waitForPlayer." );
Integer outputObj = new Integer( ROGER );
// We'll loop until we get good input
do {
// Receive something from the remote player
try {
in... |
97c26cfb-af55-414b-84f9-d3d3d725f777 | 4 | public void setWeights(Node root) {
System.out.println("Visited nodes " + root.name);
List<Edge> edges = AdjacencyList.getAdjacent(root);
for (Edge edge : edges) {
if (result[edge.getTo().name] == -1 || result[edge.getTo().name] > (edge.weight + result[root.name]))
re... |
78ef2daa-c6d7-4504-b3c8-4f81dd40f48b | 6 | public void makeIterations() {
Double delta = 1.0;
initializeVector();
Map<String, Double> tempVectorMap = new HashMap<String, Double>();
while(delta > threshold) {
delta = 0.0;
Iterator it1 = vectorMap.entrySet().iterator();
while (it1.hasNext()) {
Map.Entry mapEntry1 = (Map.Entry) it1.next();
... |
9d73da79-ff03-45d5-b4ba-f19cea114fda | 2 | private static String getFormattedValue(int value) { // intToKOrMil
if (value < 100000) {
return String.valueOf(value);
}
if (value < 10000000) {
return value / 1000 + "K";
} else {
return value / 1000000 + "M";
}
} |
32985926-00c3-4d94-8c7b-c798f711e933 | 6 | public synchronized String getFilteredPHPSource(String fileSource)
{
FileInputStream fIn = null;
FileChannel fChan = null;
long fSize;
ByteBuffer mBuf;
String content = "";
try
{
fIn = new FileInputStream(fileSource);
fChan = fIn.getCha... |
738ea214-3412-461d-86ba-b62fe63f9b9f | 0 | public Randomizer()
{
} |
2a52c2ae-10a1-4fe8-a0a3-3e019ade4e59 | 2 | public PrimaryExpression(Symbol s){
if(Symbol.Id.IDENTIFIER_NAME == s.getCode()){
if(it.isExist(s.getValue())){
this.identifer = it.getIdentifier(s.getValue());
} else {
this.identifer = new Identifier(s.getValue(),-1,current_block);
it.addIdentifier(this.identifer);
}
this.place = this.identi... |
f404e5f0-ae33-4ea1-9444-ff8546933a5a | 1 | public void input_samples(float[] s)
{
for (int i=31; i>=0; i--)
{
samples[i] = s[i]*eq[i];
}
} |
68e15de3-ae52-49ac-adee-24acfdaf89c7 | 1 | public String getUserKey() {
return isUserKeyFromProp() ? propUserKey : userKey;
} |
ee557d8f-b408-4431-ab56-8a3b02d71233 | 6 | void addProfile(LangProfile profile) {
String lang = profile.name;
if (langlist.contains(lang)) {
throw new IllegalArgumentException("Duplicate language profile for [" + lang + "]");
}
int index = langlist.size();
if (capacity <= index) {
ensureCapacity(ca... |
b4f37110-014d-459e-8880-7e24a93c3cbe | 1 | private static byte[] createHash(String text) {
try {
return MessageDigest.getInstance("SHA-256").digest(text.getBytes(Charset.forName("UTF-8")));
} catch (java.security.NoSuchAlgorithmException ex) {
System.out.println(ex.getMessage());
return null;
}
} |
0477e52c-0b90-492f-82be-dcce68b96f40 | 9 | static boolean isVowel(char a){
return a=='a'||a=='A'||a=='e'||a=='E'||a=='i'||a=='I'||a=='o'||a=='O'||a=='u'||a=='U';
} |
a905e4f7-34e8-46c4-8776-38b7c37caa8c | 7 | public Raster getRaster(int x, int y, int w, int h) {
ColorSpace cs = getColorModel().getColorSpace();
PDFFunction functions[] = getFunctions();
int numComponents = cs.getNumComponents();
float x0 = (float) start.getX();
float x1 = (float) end.ge... |
9c3f5202-0ba1-4969-b081-67a285ce7da6 | 5 | @Override
public boolean updateCopy(Copy copy) {
String itemID = copy.getRelatedItemID();
Boolean reference = copy.isReferenceOnly();
Boolean isRecalled = copy.isRecalled();
Statement stmt = null;
try {
stmt = con.createStatement();
stmt.executeUpdate("Update Copy set Recalled=" + (isRecalled ? 1 : 0)
... |
88eb081a-3e38-4bf3-a9e2-71f7f4a65012 | 4 | public void loadsave(){
if(PlayerHandler.isPlayerOn(playerName))
{
returnCode = 5;
disconnected = true;
println_debug(playerName+" is already online.");
}
else
{
if(loadGame(playerName, playerPass) == 1)
{
misc.println(playerName+" character file successfully loaded.");
appendToLR(playerName+... |
1e29a71a-4f72-4933-9c67-0b46128ca47a | 2 | public static pgrid.service.corba.repair.IssueType from_int(int value) {
if (value >= 0 && value < __size)
return __array[value];
else
throw new org.omg.CORBA.BAD_PARAM();
} |
0f33e329-9498-44df-af87-0526829e0588 | 0 | public VueMetaDonnee(Metadonnee metadonnee) {
this.metadonnee = metadonnee;
img = new JLabel(new ImageIcon(metadonnee.getCheminIcone()));
add(img);
texte = new JTextArea(metadonnee.toString());
// texte.setMaximumSize(new Dimension(5, 30));
texte.setEditable(false);
// texte.setCaretPosition(texte.getDocu... |
972ea611-2454-4981-97a3-9615a21b24f6 | 7 | public ArrayList<String> cbDepartamentos() throws SQLException {
ArrayList<String> Departamentos = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.