method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9d233887-d188-4ab6-a17a-d6b32bc4fa22 | 8 | public void SelecteerSBox(int keuze, int rij, int kolom) {
switch(keuze){
case 0:
resultaatSBox[eersteIndex] = Matrices.sBox1[rij][kolom];
eersteIndex++;
break;
case 1:
resultaatSBox[eersteIndex] = Matrices.sBox2[rij][k... |
ea0c8e49-c709-44d4-978f-430eddac93d0 | 0 | public static void main(String[] args) {
boolean isLocal = "windows".equals(OS);
System.out.println(isLocal);
} |
db05b7e8-e978-4ca9-83de-3a43b4215d28 | 8 | public final WaiprParser.statdefs_return statdefs() throws RecognitionException {
WaiprParser.statdefs_return retval = new WaiprParser.statdefs_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal36=null;
Token char_literal38=null;
ParserRuleReturnScope statdef35 =null;
Par... |
fc19b411-b2e2-49cf-a5de-752c00d32be2 | 3 | @Test
public void putGetSize() {
HugeMapBuilder<HandTypesKey, HandTypes> dummy = new HugeMapBuilder<HandTypesKey, HandTypes>() {{
allocationSize = 64 * 1024;
setRemoveReturnsNull = true;
}};
HandTypesMap map = new HandTypesMap(dummy);
HandTypesKeyImpl key = new HandTypesKeyImpl();
Han... |
90801b25-0ac5-4559-aee8-221c2a343b6b | 2 | @Override
public boolean removeAll( Collection<?> collection )
{
boolean changed = false;
for (Object element : collection)
{
changed |= remove( element );
}
return changed;
} |
5a56414d-8f76-4010-af75-527164fc1a9e | 9 | public static char findFirstNonRepeatingChar(String stream)
{
LinkedListNode head = null;
LinkedListNode tail = null;
boolean[] repeating = new boolean[256];
LinkedListNode[] nodes = new LinkedListNode[256];
for (int i=0; i<stream.length(); i++)
{
... |
8c4f9395-b988-4e6b-9bc1-b541a2ebfe7d | 3 | @Override
public void setVolume(int soundID, int volume) {
//Clamp the volume between 0-100
if(volume > 100) volume = 100;
if(volume < 0) volume = 0;
//Convert it to a float between 0.0f and 1.0f
float convertedVolume = ((float)(volume/100));
//Set the volume
if(this.soundMap.containsKey(soundID)) {
... |
2d533bd5-ec15-4c24-a8ab-766b4633d026 | 2 | public int score(Collection<String> names) {
int sum = 0;
for( String name : names ) {
if( rankByName.get(name) == null ) throw new RuntimeException("Error: Entry '" + name + "' not found!");
sum += rankByName.get(name);
}
return sum;
} |
aa2286e1-0bcd-41e8-a63e-14686f5d3bf8 | 5 | public boolean set_hhmm(String hhmm) {
if(hhmm.matches("\\d\\d\\d\\d")) {
int h= (byte)Integer.parseInt(hhmm.substring(0, 2));
int m= (byte)Integer.parseInt(hhmm.substring(2, 4));
if(h>=0 && h<24 && m>=0 && m<60) {
this.hour=(byte) h;
this.minute=(byte) m;
return true;
}
}
r... |
d437c9ea-448d-4e7a-9137-ce23c83d2375 | 8 | private Statement statement() throws RequiredTokenException
{
enterRule(NonTerminal.STATEMENT);
Statement statement = null;
if(firstSetSatisfied(NonTerminal.VARIABLE_DECLARATION))
try
{
statement = variable_declaration();
}
catch (SymbolRedefinitionException e)
{
statement = new Error(... |
d7b3017c-1c85-4077-a075-800efa9bd2c8 | 8 | protected void updateWeather()
{
if (!this.worldProvider.hasNoSky)
{
if (this.lastLightningBolt > 0)
{
--this.lastLightningBolt;
}
this.prevRainingStrength = this.rainingStrength;
if (this.worldInfo.isRaining())
... |
7e8b8abd-0b78-4bca-ae89-82fd44fae3a3 | 9 | public ArrayList<LazyDocument> documentFor(Filer filer, TypeElement classDeclaration)
throws SAXParseException {
String viewName = classDeclaration.getSimpleName() + ".ui.xml";
Collection<? extends AnnotationMirror> mirrors = classDeclaration.getAnnotationMirrors();
for (AnnotationMirror mirror : mirr... |
f8fcdb81-df3d-4e06-8dcf-c42cb817f0c3 | 4 | public PaintMessage getMessage(String string)
{
Scanner s = new Scanner(string);
PaintMessage message = null;
switch (PaintMessageType.valueOf(s.next()))
{
case LINE:
message = new LineMessage(s.nextInt(), s.nextInt(), s.nextInt(), s.nextInt(), s.nextInt(), s.nextInt());
break;
case SHAPE:
message... |
659c2b8a-7954-44fd-89d7-13876f9d63b2 | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((datum == null) ? 0 : datum.hashCode());
result = prime * result + nummer;
result = prime * result + plaatsen;
result = prime * result + ((prijs == null) ? 0 : prijs.hashCode());
result = prime * result + (... |
b6a12533-a1cd-4b0d-b640-2d863845ae5d | 3 | public synchronized void lock(){
while(locked){
try{
if(this.thread != Thread.currentThread())
wait();
else
break;
}catch(Exception e){}
}
this.thread = Thread.currentThread();
locked... |
98c9be77-4e1f-47eb-8d90-eebc91fedeec | 6 | public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(isSelected) {
setForeground(table.getSelectionForeground());
setBackg... |
2bab5629-d854-4c92-94a2-979d82ac8a77 | 2 | public static void deleteDir(File dir) {
for(File file : dir.listFiles()) {
if(file.isDirectory()) {
deleteDir(file);
continue;
}
file.delete();
}
dir.delete();
} |
f86d29b7-65cc-46fa-bef9-20c318cb28d7 | 1 | private String formatTD(String content) {
String buf = "";
int idx = 0;
int aStart = 0;
int aEnd = -5;
int i=0;
while (content.indexOf("<td", idx) != -1) {
i++;
aStart = content.indexOf("<td", idx);
aStart = content.indexOf(">", aStart)+1;
//buf += content.substring(aEnd+5, aStart);
aEnd ... |
846336da-7b7d-4890-80cc-3d9e8eb6c546 | 5 | public void put(K key, V value) {
int internalKey = generateKey(key);
if (array[internalKey] == null) {
Bag<K, V> bag = new Bag<>(key, value, internalKey);
array[internalKey] = bag;
} else {
int count = 0;
while (array[internalKey] != null && count < size) {
internalKey++;
count++;
if (i... |
0e35e4da-40be-4c8b-8961-b9268fc541ac | 3 | public Object[] conectarOlib(String url, String titleno) throws ClassNotFoundException, SQLException {
// retorna un arreglo con 2 arreglos en su interior [ [arreglo 1] , [arreglo 2] ]
// arreglo 1: arreglo de cadenas [nombres de archivo]
// arreglo 2: arreglo de cadenas [cadenas con dublin co... |
31b3ce0a-01dd-4226-be2a-04b30dbff92f | 1 | public void render(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
AffineTransform transformation = new AffineTransform();
//rotiere den Vogel
transformation.translate(x, y);
try {
double xOrient = (double)direction.getY();
double yOrient = (double)direction.getX();
double pos = Math.atan2(xOrient, yO... |
271bc9d1-3ad8-43e2-8e1e-f3ffdbb72dec | 9 | @Override
public void setValueAt(Object o, int row, int col)
{
Order or = info.get(row);
switch (col)
{
case 0 : or.getOrderName(); break;
case 1 : or.getDueDate(); break;
case 2 : or.getSleeve().getMaterial().getName(); break;
case 3 : or.... |
3d7241e4-2a85-41cf-9519-bd8cb9d7a750 | 8 | private JPanel setupControlPanel() {
JPanel controlPanel = new JPanel();
controlPanel.setBorder(new TitledBorder("Controls"));
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
controlPanel.setLayout(gbl);
gbc.anchor = GridBagCon... |
187ca12b-6a50-4dba-8c84-354e0956715b | 8 | public void Play() {
while (game.getGameState() != GameState.Ending) {
switch (game.getGameState()) {
case MainMenu:
visualiser.sayHello();
String[] names = visualiser.getNames();
game.getPlayers()[0].setName(names[0]);
... |
599b8430-e750-45fb-9411-2b3017911d43 | 1 | public String properties()
{
String gasString = "";
if(isGas())
gasString = " gas";
return protons+" "+getSymbol()+" "+getName()+gasString+" Mass: "+getMass()+" Density: "+getDensity();
} |
f120cf73-16bd-4a07-88ca-b3be308aa105 | 0 | private void ExitbuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ExitbuttonMouseClicked
// TODO add your handling code here:
dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
System.exit(0);
}//GEN-LAST:event_ExitbuttonMouseClicked |
6644b385-13a0-4ed3-b81d-9d24e470645a | 4 | public Matrix getD () {
Matrix X = new Matrix(n,n);
double[][] D = X.getArray();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
D[i][j] = 0.0;
}
D[i][i] = d[i];
if (e[i] > 0) {
D[i][i+1] = e[i];
} else if (e[i] < 0) {
... |
323958fd-04ba-43d0-b8e2-253e0ef4ff3f | 3 | private void trigger(){
Set<String> fileSignatureSet = filePathModifiedTimeMap.keySet();
for ( String fileSignature : fileSignatureSet ){
File file = new File(fileSignature);
long currentLastModifiedTime = file.lastModified();
Long lastestLastModifiedTime = filePathModifiedTimeMap.get(fileSignature);... |
5b89611c-17be-43d8-b44a-050a0d311b05 | 1 | public static void closeConnection(){
try {
conn.close();
} catch (SQLException e) {
System.out.println("error closing connection within process class");
e.printStackTrace();
}
} |
4c38ac14-7654-4a93-9968-6e1d8d3ca1ea | 9 | public int alphaBetaSearchResult(int depth, int alpha, int beta)
{
if (isTerminalState())
return heuristicFunctionValueOfGivenBlock(lastMoveMadeInBlockNumber);
else if (depth == 0)
return heuristicFunctionValueOfGame();
List <Integer> listOfEmptyCells = getBlock(nextMoveInBlockNumber).getListOfBestMoves... |
4b85d507-819e-4846-9fea-59a30ed306f5 | 1 | static void openURL (String url) throws IOException, URISyntaxException{
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.BROWSE)){
desktop.browse(new URI(url) );
}else
showMessage(("Error"));
} |
4efa3005-bb0d-49a6-b7c5-0e40acc27f6e | 4 | private void readtRNS() throws IOException {
switch (colorType) {
case COLOR_GREYSCALE:
checkChunkLength(2);
transPixel = new byte[2];
readChunk(transPixel, 0, 2);
break;
case COLOR_TRUECOLOR:
checkChunkLength(6);
transPixel... |
cbba3560-4485-4518-8581-d14260357919 | 3 | public void deleteCommand()
{
try{
int choice = JOptionPane.showConfirmDialog(rootPane, "Are you sure you want to delete " + currentRunway.getId() + "?"
+ "\n This will also delete all glider and winch positions associated with this runway.",
"Delete Runwa... |
babf0b19-4352-4ad3-b56b-8a4432071a5a | 8 | @Override
public ImmutableValue<Boolean> evaluate(Context context) {
// destacando variaveis
Value[] values = new Value[variables.length];
for (int i = 0; i < variables.length; i++) {
Expression variable = variables[i];
values[i] = variable.evaluate(context);
}
// destacando ... |
29317770-407e-49c8-b975-ded5efd9d479 | 1 | @Test
public void testTimeStep_MEAN_MONTHLY_1year() throws Exception {
printDebug("----------------------------");
printDebug("MEAN_MONTHLY 1 year: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.assertNotNull(t);
... |
6624d61b-0207-449b-8d2c-a69349d3f0b7 | 2 | public void releaseAllKeys() {
for(int i = 0; i < buttons.length; i++) {
buttons[i] = false;
}
for(int j = 0; j < upButtons.length; j++) {
upButtons[j] = false;
}
} |
d4a41764-6865-4c32-ac81-4d0a10dc7bf4 | 5 | public static String to_booleanString(String str) {
if (str == null) return null;
String[] trueValues = new String[] {"true","True","Yes","yes","1","-1","yep","supported"};
String[] falseValues = new String[] {"false","no","False","No","0","nope","not supported","not_supported"};
//ArrayList<String> trueValues ... |
7e269b3d-207b-47b4-91c0-581db60f1cf2 | 0 | private ImageProcessor hMinima(ImageProcessor ip, int m){
ip.invert();
ImageProcessor ip1 = ip.duplicate();
ip1.subtract(m);
GreyscaleReconstruct_ gr = new GreyscaleReconstruct_();
Object[] result = gr.exec(new ImagePlus("temp", ip), new ImagePlus("temp1", ip1), "null", true, false);
ip.invert();
return (... |
50a8eab1-9d35-4a1a-bfc1-3f1850ba8fa1 | 8 | public void render(Graphics g, Camera camera) {
int x0 = camera.x >> 4;
int x1 = (camera.x + camera.width + 16) >> 4;
int y0 = camera.y >> 4;
int y1 = (camera.y + camera.height + 16) >> 4;
for (int y = y0; y < y1; y++) {
for (int x = x0; x < x1; x++) {
if (x >= 0 && y >= 0 && x < width && y < height) ... |
642267c8-2140-48a7-a79d-210f9113ff36 | 5 | static final void method1005(byte byte0, boolean flag) {
if (TraversalMap.aByteArrayArrayArray976 == null) {
TraversalMap.aByteArrayArrayArray976 = new byte[4][104][104];
}
if (!flag) {
return;
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j ... |
978e83be-98b8-47e7-929d-08d7d49d6d73 | 6 | private static DecimalImpl divByInt(final long d1Base, final int d1Factor, final long d2Base)
{
if (d1Factor < 0)
{
final long scaledBase = d1Base * DPU.getScale(-d1Factor);
final long base = scaledBase / d2Base;
final long remainder = scaledBase % d2Base;
if (0 != remainder)
{
final int factorLimi... |
2b55c8bd-935d-4fa4-960d-82ea95f5f767 | 8 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
// Offset used by the image, as well as their "highlighted" buttons.
Point offsetHead = new Point(10, 25);
Point offsetMiddle = new Point(235, 30);
// Sinleton to load the images only once. Placin... |
d71adfa6-9207-4038-ab14-3939df1dddb9 | 6 | @Override
public double calculate(Map<? extends Number, ? extends Number> weightedSet, double extremalLevel) {
assert extremalLevel >= -1 && extremalLevel <= 1;
// используя гравитационное расширение нечетких сравнений найдем центр тяжести всей совокупности.
double sumOfRectifications = 0;... |
6ddb9274-b36c-42e0-ae09-cb9dcbefcb65 | 1 | public static int parse(String methods) {
int httpMethods = 0;
String[] items = methods.split("\\|");
for (String item : items) {
item = item.trim();
httpMethods = httpMethods | HttpMethods.getMethod(item);
}
return httpMethods;
} |
91fe3b4d-591e-4501-a2ad-89ac180e43fd | 1 | public void initialize(ConstPool cp, CodeAttribute attr) {
if (constPool != cp)
newIndex = 0;
} |
7d9dd72d-e350-46b2-9049-a86f7bfef00e | 0 | @Override
public void windowActivated(WindowEvent e)
{
} |
37644691-dc03-456a-9a3e-6379aa4cb090 | 6 | private static Attack createAttack(Element type){
Element attackElement = (Element)type.getElementsByTagName("attack").item(0);
if(attackElement == null){
return null;
}
SoundWrapper attackSound = ResourceLoader.createSound(attackElement.getAttribute("sound"),
Float.parseFloat(attackElement.getAttribute(... |
ff045283-5385-4c8e-8f48-3e98b431ea54 | 5 | public boolean isMobAllowed(final EntityType type) {
return type == EntityType.SPIDER || type == EntityType.CAVE_SPIDER || type == EntityType.SKELETON || type == EntityType.CREEPER || type == EntityType.PIG_ZOMBIE || type == EntityType.ZOMBIE;
} |
c0d39194-a327-4e1b-93bd-ac84f93f374c | 7 | private int getIssueCycle2(int[][] schedule, int instructionNumber) {
FunctionType function = executed.get(instructionNumber).getFunction();
int cycle = schedule[instructionNumber - 1][0] + 1;
if (function.ordinal() >= configuration.length - 1)
return cycle;
int minCycle = schedule[instructionNumber - ... |
91e0b8e8-25ce-4ec2-bb8e-99feb57e6296 | 1 | public static void connectToDB () {
try {
Driver driver = (Driver) Class.forName("org.sqlite.JDBC").newInstance();
DriverManager.registerDriver(driver);
} catch (Exception ex) {
ex.printStackTrace();
}
} |
cc6e85ff-1ec5-403d-b635-ba4217f4d8cd | 8 | private void habilitarMenuPerfil(Vector<Vector<Integer>>moduloTarea){
habilitarMenu(false);
for(Component cMenu:jMenuBar1.getComponents()){
for(Vector<Integer>modulo:moduloTarea){
if(cMenu.getName().equals("M"+modulo.get(0))){
... |
d3f6f3a4-b8a4-4829-9155-01b32a54053b | 0 | public JoinIterator(Iterable<T> outer, Iterable<TInner> inner, Selector<T, TKey> outerKeySelector, Selector<TInner, TKey> innerKeySelector, Joint<T, TInner, TResult> joint, Comparator<TKey> comparator)
{
this._outer = outer.iterator();
this._inner = inner;
this._innerKeySelector = innerKeySelector;
this._... |
329e14fd-dc84-4b74-bc56-c1d654dc65b0 | 9 | @Override
public void checkedDoPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
if (isLoggedIn(req.getSession()))
forceLogOut(req, resp);
String userName = req.getParameter("username");
String name = req.getParameter("nam... |
b08a1590-8c7b-4242-9175-8645c5202027 | 3 | public void loadAllObjects() {
ResultSet data = query(QueryGen.selectAllObjects());
while (iterateData(data)) {
ChunkyObject obj = (ChunkyObject) createObject(getString(data, "type"));
if (obj == null) {
Logging.warning("Created " + getString(data, "type") + " is ... |
d4583fc8-a3e0-4a19-8c67-4cdfa95a009d | 9 | public boolean isPalindrome(String s)
{
int b = 0, e = s.length()-1;
while(b <= e)
{
char x = s.charAt(b);
char y = s.charAt(e);
if (isCharacter(x) && isCharacter(y) && !isSame(x,y))
return false;
else if (isCharacter(x) && isCh... |
b1035dae-0ced-4ef3-b01d-d9cbaff3b6f0 | 0 | public void die() {
alive = false;
} |
6e4d0b8e-e8ce-4aaa-adbf-f2db1986dab9 | 4 | @Override
public Object solve() {
int count = 0;
int weekday = 2; // 1 - 7 mapping to Mon - Sun, 1st Jan 1901 is a Tuesday
for (int year = 1901; year <= 2000; year++) {
for (int month = 0; month < 12; month++) {
if (weekday == 7) {
count++;
... |
3e3ada3d-4d34-4063-98b5-c803119a3e27 | 0 | public final Set<Token.Kind> firstSet()
{
return firstSet;
} |
2845a0fe-b6ee-4b3b-ba53-1808e1e10e89 | 7 | private String dayOfWeek(int dayOfWeek)
{
String day;
switch (dayOfWeek)
{
case 1: day = "Sun"; break;
case 2: day = "Mon"; break;
case 3: day = "Tues"; break;
case 4: day = "Wed"; break;
case 5: day = "Thurs"; break;
case 6: day ... |
de3704f8-14dc-48cb-a9fd-cff9bedee59f | 9 | public void search (BayesNet bayesNet, Instances instances) throws Exception {
m_random = new Random(m_nSeed);
// determine base scores
double [] fBaseScores = new double [instances.numAttributes()];
double fCurrentScore = 0;
for (int iAttribute = 0; iAttribute < instances.numAttributes()... |
288ca153-d132-4dec-818e-45130a38acb8 | 8 | public static int getLevenshteinDistance(String first, String second) {
if (first.equals(second)) return 0;
if (first.length() == 0) return second.length();
if (second.length() == 0) return first.length();
int[] previousRow = new int[second.length() + 1];
int[] currentRow = new int[second.length() + 1];
f... |
773dcb5f-200f-46f4-98c7-cff5128af1ea | 1 | public void addNode(int pos, long nodeId) {
if (poligons.size() > pos)
nodes.get(pos).add(nodeId);
} |
bd95c721-bdbc-49aa-a493-df88d9114160 | 4 | public static void showRevealedBoard(BoardModel boardModel) {
System.out.print(" ");
for (int i = 0; i < boardModel.getBoardWidth(); i++) {
System.out.print(" " + i);
}
System.out.println("");
System.out.println(" -----------------------");
for (int i = 0; ... |
ff2bb298-4891-46e2-b0c3-f82635fbf327 | 1 | @Override
public URI getResourceIdentity() {
try {
return new URI(context() + name());
} catch (URISyntaxException e) {
e.printStackTrace();
return null;
}
} |
f939ddba-90c9-4783-bbfe-2c52522be3e8 | 4 | public static void main(String[] args) {
char again;
do{ // The main loop, everything is called from here.
double[] u = new double[3], v = new double[3],w;
print("Enter a vector in R" + "\u00b3"+": ");
for(int i = 0; i < 3; i++)
u[i] = scan.nextDouble();
print("Enter a second vector in R" + "\u00... |
f956aa64-8f62-46ec-9b43-67b350ba2fae | 4 | public void sort(){
java.util.Stack<Integer> spare_stack=new java.util.Stack<Integer>();
while(!this.stack.empty()){
int current=this.stack.pop();
while(!spare_stack.empty() && spare_stack.peek()>current){
this.stack.push(spare_stack.pop());
}
spare_stack.push(current);
}
while(!spare_stack.empt... |
3990e882-4502-45b1-8e93-c7c197009543 | 3 | public boolean isValidBST(TreeNode root) {
if(null != root) {
List<Integer> list = new ArrayList<Integer>();
travelTree(root, list);
for(int i=0; i<list.size()-1; i++) {
if(list.get(i) >= list.get(i+1)){
return false;
}
}
}
return true;
... |
c9fed1ef-337f-40dd-b274-32771ab1f130 | 6 | public void update(int delta) {
for (Building b : buildings) {
if (b.getStatus()) {
b.setBuildingtimeLeft(b.getBuildingtimeLeft() - delta);
}
if (b.getBuildingtimeLeft() <= 0) {
b.upgrade();
}
}
for (Building b : buildings) {
if (b instanceof ProductionBuilding) {
b.setTimeLeft(b.... |
27b96950-8e5d-4dd7-a601-472f3db03a71 | 6 | protected void processInput(String userInput) {
if (userInput.equals("!end")) {
exit = true;
try {
stdIn.close();
} catch (IOException e) {
logger.error("coulden't get inputstream");
}
// propper shutdown of the ExecutorService
Main_Client.clientExecutionService.shutdown(); // Disable new t... |
224b15ea-46a9-4d71-ac83-74ab443640a6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (ip == null) {
if (other.ip != null)
return false;
} else if (!ip.equals(other.ip))
return false;
if (n... |
a3b0e307-cb42-4901-a10d-409d52407481 | 0 | public String getContacter() {
return contacter;
} |
84ac1a39-096c-4a9f-9eef-3f70be99e75f | 2 | public void characters(char[] ch, int s, int len)
{
String content = new String(ch, s, len);
if(content.length() != 0)
{
if(Debug.debugLevel() >= 5)
{
Debug.println("Characters received:", 5);
Debug.println(" Characters: " + content, 5);
Debug.println("End of characters.", 5);
Debug.pri... |
1acea8e1-8e2b-45b5-a7e9-313e1d3f2d6c | 4 | public static void main(String[] args) {
//Test: CreateBlackBox
Circuit c1 = new Circuit();
int number1 = 0;
int number2 = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Length of binary numbers:");
int amount = Integer.parseInt(scan.nextLine());... |
e8bb1fbd-f1e4-4c3c-b88c-db06d303b85b | 6 | @EventHandler
public void WitchStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Strength.... |
4325377b-31ae-49a0-987e-fbddd1e52727 | 8 | private void verbindeNachbarn(int x, int y)
{
//Nord
if(istGueltigePosition(x, y - 1) && existiertRaumAnPosition(x, y - 1))
{
_raumArray[x][y].verbindeZweiRaeume(TextVerwalter.RICHTUNG_NORDEN,
_raumArray[x][y - 1], TextVerwalter.RICHTUNG_SUEDEN);
}
//Ost
if(istGueltigePosition(x + 1, y) && existie... |
d9c26e2b-2bbe-4459-ac68-98b493cb7871 | 3 | public void closeBraceContinue() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0)
print("} ");
else {
println("}");
if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0
&& currentIndent > 0)
untab();
}
} |
0077f256-fa22-4de2-8bdc-9670518a5a38 | 4 | private Entity readFromFile(int pos) {
ObjectInputStream ois = null;
Entity rslt = null;
try {
ois = new ObjectInputStream(new FileInputStream(file));
for (int i = 0; i < pos; i++) {
ois.readObject();
}
rslt = (Entity) ois.readObjec... |
96b01572-8d2d-4f72-ab22-d22cfb24832f | 5 | public void compileSource(String source){
//1.创建需要动态编译的代码字符串
//2.将预动态编译的代码写入文件中1:创建临时目录2:写入临时文件
File dir=new File("../webapps/JudgeOnLine/temp");//tomcat里工程下的临时目录
String className = source.substring(source.indexOf("public class") + 13,source.indexOf("{")).toString();//获取类名字符串
//如果/temp目录不存在创建temp目录
if(!d... |
14349cd9-5944-456e-be41-d9e0fca9e24e | 7 | private String unitConver(int len)
{
String reVal;
switch(len)
{
case 2:
reVal = "十";break;
case 3:
reVal = "百";break;
case 4:
reVal = "千";break;
case 5:
reVal = "万";break;
case 6:
reVal = "十";break;
case 7:
reVal = "百";break;
case 8:
... |
dc6226a4-52a2-4f05-b24c-05a9f7534574 | 2 | public void setCurrent(long current) {
this.current = current;
if (current > this.total) this.total = current;
if (this.job != null) this.job.updateProgress();
} |
cadcd452-991b-4601-b3e8-ae64f5dd457e | 3 | public Prime(int n) {
max = n;
bitSet = new BitSet(max + 1);
bitSet.set(0, 2, false);
bitSet.set(2, max, true);
for (long i = 2; i * i <= max; ++i) {
if (isPrime((int) i)) {
for (long j = i * i; j <= max; j += i) {
bitSet.set((int) j, false);
}
... |
5e010b0f-98fa-46d7-85b4-1da7c0cc697c | 3 | public void write(List<String> csvStrings, String fileNameDestination) throws IOException {
File file = new File(fileNameDestination);
logger.info("outfilename=" + fileNameDestination);
if ( !file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file, false);
fi... |
6aa28796-e98b-4a4b-9de3-671fbe111cba | 9 | public static void connectToChatRoom(String cHost, int cPort) throws IOException {
Socket joinedClient =null;
BufferedReader in;
PrintWriter out = null;
try {
joinedClient = new Socket(cHost, cPort);
} catch (IOException e) {
System.out.println("Could not connect to peer ");
return;
}
try {... |
54aeabfc-2ffc-4bc3-b383-ef85f13731c4 | 6 | @Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case boardPackage.BOARD__COUNTRIES:
return getCountries();
case boardPackage.BOARD__BORDERS:
return getBorders();
case boardPackage.BOARD__CONTINENTS:
return getContinents();
case boardPackag... |
553df11c-a60b-41e8-a333-120e8df71e64 | 5 | public void connect() throws RemoteException {
try {
registry = LocateRegistry.getRegistry(ipAddress, portNumber);
} catch (RemoteException ex) {
System.out.println("Client: Cannot locate registry");
System.out.println("Client: RemoteException: " + ex.getMessage());
... |
f83d2043-2d56-4b4e-90fb-12ddfc95d944 | 7 | public int candy(int[] ratings) {
if(ratings == null) return 0;
int people = ratings.length;
int[] candys = new int[ratings.length];
candys[0] =1;
for(int i=1;i<people;i++){
candys[i]=1;
if(ratings[i]>ratings[i-1]){
candys[i]=candys[i-1]+1;
} else {
candys[i] = 1;
}
... |
115c4e18-f809-4f5e-8793-6a36635d8a35 | 6 | private void jTextField7FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField7FocusLost
// TODO add your handling code here:
if ((evt.getOppositeComponent()!=jTextField3) &&
(evt.getOppositeComponent()!=campoFecha1) &&
(evt.getOppositeComponent()!=campoFecha... |
55773ebe-034f-4393-88bc-ac158a038e34 | 9 | private static void renderMethods(Class cls) {
Method[] methods = cls.getMethods();
Method m;
StringAppender appender = new StringAppender();
int mf;
for (int i = 0; i < methods.length; i++) {
appender.append(TextUtil.paint(' ', PADDING + 2));
if (((mf = (m = methods[i]).getModifiers())... |
11e923a8-65b6-47da-a36d-82801cadd9ff | 4 | private Vector<DashboardIcon> getCostensValues(Player player) {
// object variable costs
DashboardIcon variableCosts = new DashboardIcon();
variableCosts.setTitle("variable costs");
variableCosts.setIcon("align-left");
variableCosts.setColor("turquoise");
try {
variableCosts.setValue(Double.toString(play... |
388d22f3-11b0-4e9a-99f9-4afb5568eec6 | 9 | public GameState update(KeyboardInput keyboard) {
GameState nextState = GameState.PLAYING;
if (keyboard.keyPressed(KeyEvent.VK_TAB)) {
nextState = GameState.MENU;
}
else {
Direction dir = keyboard.getArrowKeyDirection();
if (keyboard.keyIsDown(KeyEvent.VK_A) && timeUntilNextBullet <= 0) {
shootBull... |
4f53e197-7b46-4c6a-9bf5-3f65063312e0 | 3 | @SuppressWarnings("unchecked")
public String loadMatches() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT match_number FROM match_record_2013 where e... |
b2ffff32-5e32-493b-adf1-8c8d2296a914 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Product)) return false;
Product product = (Product) o;
if (id != product.id) return false;
if (catalog != null ? !catalog.equals(product.catalog) : product.catalog != null) return fal... |
af0ebd67-6389-4718-8f4e-9d6887852efd | 3 | public Markers createGenomicRegions() {
Markers markers = new Markers();
// Add up-down stream intervals
for (Marker upDownStream : genome.getGenes().createUpDownStream(upDownStreamLength))
markers.add(upDownStream);
// Add splice site intervals
for (Marker spliceSite : genome.getGenes().createSpliceSite... |
0989ff89-4daa-4f8b-b479-1951227ef693 | 4 | public void loadCards() throws BadConfigFormatException {
try {
// open the cards file, which has 6 person, 6 weapon, then 9 room cards in that order
FileReader reader = new FileReader("cards.txt");
Scanner in = new Scanner(reader);
// stored to know card type
int lineNumber = 0;
Card card;
// lo... |
71b15397-03b8-42c3-8d63-f9e80cefa01c | 7 | public Template waitForMatch(Template tpl, int timeout) {
String queryString = "";
int i = 0;
for (i = 0; i < 9; i++) {
Integer min;
Integer max;
try {
min = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_min");
max = (Integer) PropertyUtils.getSimpleProperty(tpl, "property"... |
2816d670-94ad-4b17-82e3-d6e6140121e0 | 0 | @Basic
@Column(name = "CSA_ID_SOLICITUD")
public int getIdSolicitud() {
return idSolicitud;
} |
16e38893-2f5d-400f-851e-7d5bb4e2e1cd | 0 | @Test
public void testListHdfs() throws IOException {
System.setProperty("HADOOP_USER_NAME", "hduser");
Injector injector = Guice.createInjector(new Context());
HDFS hdfs = injector.getInstance(HDFS.class);
hdfs.init();
hdfs.listRoot();
} |
cb8455f1-14d3-4525-b857-09d6dda3cea7 | 2 | public boolean matchesOperator(String text) {
int operatorCount = this.operatorList.size();
for(int i = 0;i<operatorCount;i++) {
String currentOperator = this.operatorList.get(i).getLiteral();
boolean isMatchingExpression = text.equals(currentOperator);
if (isMatchingExpression) {
return true;
}
... |
5d3f0a92-bab4-41ec-a4c0-14f75a961df7 | 5 | public void dump() {
updateKnown();
File imgdir = new File(Constants.getCacheDirectory() + "rsimg" + System.getProperty("file.separator"));
if (!imgdir.exists()) {
imgdir.mkdir();
}
int count = imageArchive.countImages();
int total = count;
try {
for (int index = 0; index < count; index++) {
Fil... |
9d1a5dc1-5981-4cb3-9647-b353cc3e7b45 | 1 | public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals(Constantes.CLOSE)) {
this.setVisible(false);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.