method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
03b47972-08c0-4ac1-8855-8427923b9e58 | 1 | public void continueInference(InferenceParameters queryProperties) {
String command = createInferenceContinuationCommand(queryProperties);
DefaultSubLWorker newWorker = new DefaultSubLWorker(command, getCycServer(), true, getTimeoutMsecs());
/*newWorker.addListener(new SubLWorkerListener() {
public void... |
f9fc80aa-6944-45ce-a829-5841681b9bd8 | 9 | String encode(String value)
{
StringBuffer sb = new StringBuffer();
int len = value.length();
for (int i = 0; i < len; i++)
{
char c = value.charAt(i);
switch (c)
{
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '\'':
sb.append("'... |
f86775b4-158f-434f-b377-48caad51ea51 | 7 | private boolean checkInput(String input) {
try {
input = input.toLowerCase();
input = input.replace("$", "");
input = input.trim();
// Get the command, then strip it from the other data
String command = input.substring(0,1);
input = input.replaceFirst(command, "");
input = input.trim();
i... |
df7cc979-ae5a-4fb1-88de-2ed4b5f0fe11 | 8 | public NameNode(Library l, Hashtable h) {
super(l, h);
Object o = library.getObject(entries, "Kids");
if (o != null && o instanceof Vector) {
Vector v = (Vector) o;
kidsReferences = v;
int sz = kidsReferences.size();
if (sz > 0) {
k... |
f5206bf8-bb2b-4af3-85c4-c7599ab08578 | 0 | public String getAccessToken() {
return accessToken;
} |
5f12150c-9d44-4be0-9e99-e2c0e1b999e8 | 4 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("------------ RunningStatus ------------\n");
sb.append("[taskId] " + taskId + "\n");
sb.append("[RunningPhase] " + runningPhase + "\n");
sb.append("[isInMemMergeRunning] " + isInMemMergeRunning + "\n\n");
sb.append("---... |
b49dfa8f-68e3-4759-93fb-a70ca077e11f | 9 | public double ai(int x, int y, int vx, int vy, int l) {
double[] e = new double[5];
double d = Math.atan2(-(cy - y), (cx - x)) + Math.PI; // Calculate the
// distance
// The arc-distance values range from 0 to 2 PI. To solve border-cases
// in the from 1.5 PI to 0.5 PI, checking is needed.
i... |
0046799b-d2a0-457f-ac42-a1d9ea5002ed | 7 | public static void calculateDistanceToOpponentBorder(BotState state) {
List<Region> guessedOpponentSpots = HeuristicMapModel.getGuessedOpponentRegions();
// Give all guessed opponent spots a distance of 0
for (Region opponentSpot : guessedOpponentSpots) {
opponentSpot.setDistanceToOpponentBorder(0);
}
// G... |
1f9f23a1-998d-4e66-8e1c-50dd563695a2 | 2 | @Override
public void checkCollision(){
for(int i = 0; i < collisionThreads.length; ++i)
pool.execute(collisionThreads[i]);
//Give the collision threads as much time as we can, but this may cull them prematurely
try {
pool.awaitTermination(COLLISION_TIME, TimeUnit.MI... |
3cc0d993-158c-45eb-bd94-95e64f5678d7 | 5 | public static <T extends Number> ArrayList<ArrayList<T>> mulScalarWithMatrix(T scalar, ArrayList<ArrayList<T>> a, Class<T> type) {
ArrayList<ArrayList<T>> result = new ArrayList<ArrayList<T>>();
try {
if (a == null) {
throw new NullPointerException();
}
int rows = a.size();
int columns = a.get(0... |
39dcdd02-1eb5-4cc9-a0a6-87439c098690 | 0 | protected void finalize() throws Throwable {
super.finalize();
socket.close();
} |
15f109eb-8a32-4899-8560-974d1c3ae820 | 8 | private static boolean evaluatePairing ()
{
int toprank = 0;
int botrank = 0;
int topind = 0;
int botind = 0;
// gather the rank count data
for (int i=Rank.NUM_RANK-1; i>=0; i--)
{
//int rankhashi = _rankhash[i];
int rankhashi = (int)((_rankhash>>(4*i)) & 0xF);
if (rankhashi > topr... |
0f4edabe-4299-4189-a9ef-5643b90c3c2f | 3 | public static ByteBuffer toBuffer(String value)
{
if (value == null || value.length() == 0) {
return EMPTY;
}
ByteBuffer buffer = factory.allocate(value.length());
char[] chars = value.toCharArray();
// Convert from chars to bytes
for (int i = 0; i < chars.length; i++) {
buffer.put((byte)chars[... |
e1d176f2-4c4e-4826-8cc2-e7749d30165c | 7 | @Override
public String toString() {
switch (this) {
case TOP_LEFT:
return "TL";
case TOP:
return "T";
case TOP_RIGHT:
return "TR";
case BOT_RIGHT:
return "BR";
case BOT:
... |
a19ca574-c90e-4607-9aa6-983ae83bfc18 | 4 | private void parseName() throws IOException {
int c = in.peek();
while (Character.isLetterOrDigit(c) || c == '_' || c == ':' || c == '.') {
out.append((char) in.read());
c = in.peek();
}
} |
0ca656f3-c1d1-40f6-8148-b6be7400870d | 6 | public ArrayList ResultSetToString(ResultSet rs) {
String temp = "";
ArrayList<String> resultat = new ArrayList<>();
try {
ResultSetMetaData rsMetaData = rs.getMetaData();
for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
if (i == 1) {
... |
6aacca22-0c0f-45ca-a528-39c717ded2cf | 9 | private int get_next_page(Page page, long boundary) {
if (boundary > 0) {
boundary += offset;
}
while (true) {
int more;
if (boundary > 0 && offset >= boundary) {
return OV_FALSE;
}
more = oy.pageseek(page);
... |
576e037e-9498-451f-a39b-a246e0615218 | 1 | public void action(OutStream outStream) throws IOException {
outStream.writeSymbol('\n');
for (int j = 0; j < Format.indentLevel - 1; j++) {
outStream.writeString(Format.indentString);
}
outStream.writeSymbol('}');
outStream.writeSymbol('\n');
Format.indent =... |
23cb3828-184f-43d8-9b37-041b8fab17e7 | 4 | private void orderTrackList() {
for (int i = 0; i < calendarTracksListModel.getSize(); i++) {
String pistaname = calendarTracksListModel.get(i).toString();
for (Iterator<Track> it = calendarTracks.iterator(); it.hasNext();) {
Track pista = it.next();
... |
e0ca12cb-01e4-4e9c-8ad3-ca38e46d668b | 4 | public static Comparator printComparator() {
if (Type.printComparator != null) {
return (Type.printComparator);
}
Type.comparator = new Comparator() {
public int compare(final Object o1, final Object o2) {
// o1 < o2 : -1
// o1 == o2 : 0
// o1 > o2 : 1
if (!(o1 instanceof Type)) {
thr... |
947ab22d-209e-4690-bfff-2f784b0f9723 | 2 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.users");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
formUserList(request);
if(page == null ? prevPage == null... |
793785df-b8d3-4518-a9c9-8acffb9f09dc | 1 | private void notifyListeners()
{
for (TimeListener listener : listeners)
listener.onTimeChanged(time);
} |
1d2695fe-1f9b-4aca-8452-999ff3df2d86 | 9 | public static void main(String[] args) throws Exception
{
HashSet<Integer> placeboSet = getPlaceboSet();
HashMap<String, List<Double>> sampleMap = getsampleToPCOAMap();
System.out.println(sampleMap);
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getCrossoverExerciseDir() +... |
92640552-e305-4fc1-9569-de70e1d388d8 | 8 | public void setRegion(int left, int top, int width, int height) {
if (top < 0 || left < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (height < 1 || width < 1) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int right = l... |
acbaac1a-50ee-428f-8cfa-72943c137341 | 7 | public byte markTokensImpl(byte token, Segment line, int lineIndex)
{
if(line.count == 0)
return Token.NULL;
switch(line.array[line.offset])
{
case '+': case '>':
addToken(line.count,Token.KEYWORD1);
break;
case '-': case '<':
addToken(line.count,Token.KEYWORD2);
break;
case '@': case '*':
... |
2e45b309-aedc-4141-b503-a8623d0afbf0 | 6 | public boolean IsOpt(char c)
{
if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == ')')
return true;
else
return false;
} |
af978ce6-d656-4ad5-bdf8-4364f02ac44c | 2 | public void offsetMove(Coord offset) {
if(!isActual()) return;
if(UI.instance.mapview != null) {
Coord sz = UI.instance.mapview.sz;
Coord sc = new Coord((int) Math.round(Math.random() * 200 + sz.x / 2 - 100),
(int) Math.round(Math.random() * 200 + sz.y / 2 - 100));
Coord oc = position().add(offset);
... |
25939917-f427-4bb0-b549-da41849c7444 | 7 | public void switchTo(String newFolder) {
try {
long start = System.currentTimeMillis();
if (songFolderLoc != null && songFolderLoc.equals(newFolder)) {
Util.errorMessage(
"Please don't try to load your entire osu! Songs Folder here.\n"
+ "It'll probably take forever and lag your computer.",
this)... |
a15d2dc3-91fb-4f30-9856-a45a56a540bd | 9 | public void traineval(Vector vector)
{
for(int i = 0; i < maxRound; i++)
{
training = true;
BHypothesis.training = true;
BHypothesis.MARGIN_RATE = 48D;
for(int j = 0; j < sample.size(); j++)
{
System.err.println((new StringB... |
082de1aa-07bf-4755-aac7-acfd6c1ade09 | 1 | public static void evaluate(File fingerFile, Song song) throws FileNotFoundException
{
FileReader fr = new FileReader(fingerFile);
BufferedReader br = new BufferedReader(fr);
// Loop through the fingerfile
String content = new Scanner(fingerFile).useDelimiter("\\Z").next();
//System.out.println(content);
... |
c2978ec5-2665-4513-98a8-4b34fbb03738 | 8 | @Override
public void executaExercicio30() {
String nome;
int idade;
Character sexo;
double salario;
double abono;
nome = JOptionPane.showInputDialog("Digite o nome: ");
idade = Integer.parseInt(JOptionPane.showInputDialog("Digite a idade: "));
sexo = JOptionPane.showInputDialog("Digite o sexo: ").charAt(0);... |
aa7ebcd0-f90c-4d0a-ae08-5e2cb9c7581a | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
PieceCoordinate other = (PieceCoordinate) obj;
if (x != other.x) {
return false;
}
if (y != other.y) {
return false;
... |
80e782e0-e1ae-415d-92fb-c7cd18709702 | 4 | void reduce(String s, int a, int b) {
for (int i = 0; i < validSet.length; i++) {
if (!validSet[i]) {
continue;
}
if ((getA(s, answerSet[i]) != a) || (getB(s, answerSet[i]) != b)) {
validSet[i] = false;
}
}
} |
9ed6c594-95f9-40fb-aa1e-e4d88dbffcbe | 1 | public Models.DatabaseModel.Patient findPatient(int id){
String query = "SELECT * FROM `patients` WHERE `id` = %d LIMIT 1;";
Utils.DBA dba = Helper.getDBA();
Patient p = new Patient();
try {
ResultSet rs = dba.executeQuery(String.format(query, id));
rs.next();
... |
9ea7d788-f0eb-4157-b935-8ecd4e80a03d | 5 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode sum = new ListNode(-1);
int carry = 0;
ListNode head = sum;
sum.next = head;
while (l1 != null && l2 != null) {
int s = l1.val + l2.val + carry;
carry = s / 10;
s = s % 10;
head.next = new ListNode(s);
head = head.next;
l1 =... |
88e943cc-786b-4919-bf41-769f86fd4604 | 6 | public Boisson rechercheBoisson(String boisson){
for(Categorie cat : Categorie.values()){
ArrayList<Boisson> listes = new ArrayList<Boisson>();
if(cat.equals(Categorie.Bieres)){
listes = listeBoissons.getListeBieres();
}
else if(cat.equals(Categorie.Cocktails))
{
listes = listeBoissons.getL... |
0b93296d-4489-45d7-8690-9b7a26ebfd84 | 8 | private int retrieveEndingPositionAfterOpeningParenthesis(int sourceStart, int sourceEnd, int numberOfParen) {
if (this.referenceContext == null) return sourceEnd;
CompilationResult compilationResult = this.referenceContext.compilationResult();
if (compilationResult == null) return sourceEnd;
ICompilationUnit compi... |
5f9c10d8-10b8-40eb-b705-653a2b96a804 | 6 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
LinkedHashMap<String, Integer> votes = new LinkedHashMap<String, Integer>();
int invalid = 0;
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.startsWith("... |
f7218268-fe0f-437b-b5cb-56a274a2f18e | 1 | @Override
public void mouseEntered( MouseEvent e ) {
for( MouseListener listener : listeners( MouseListener.class )){
listener.mouseEntered( e );
}
} |
cd8221cd-a88a-4465-8069-beda5037f122 | 7 | public static int findPath(Node node, boolean existed) {
if(node.visited) {
return -1;
}
if(!node.inGrouped) {
return 0;
}
node.visited = true;
if(existed) {
for(Node nextNode : node.neigh) {
int result = findPath(nextNode, !existed);
if(result != -1) {
nextNode.inGrouped = true;
... |
47ad8079-f5e7-42c3-a8c3-8f841f704cb4 | 9 | public void removerUsuario(){
if ( this.num_usuarios == 0 ) System.out.println("\nNão existem "
+ "usuários.");
else{
System.out.println("\nQual dos usuários você gostaria de remover? "
+ "[ 1 - " + this.num_usuarios + " ]" );
int i = 1;
... |
badd4cd6-075b-4bd3-a3cf-4ced35679df2 | 1 | public String loadProperty(String key) {
if (properties != null) {
return properties.getString(key);
}
return null;
} |
552c5392-e6b1-4122-83b9-157e82a3072e | 9 | public void run() {
// Put a spiffy message in the console
try {
// Loop while we are active
while(active) {
MazewarPacket headQueuePacket;
headQueuePa... |
0f14013b-080f-4e48-b3af-fd268a31eb78 | 1 | private int sumOfSquares(int start, int end) {
int sum=0;
for(int i=start;i<=end;i++){
sum+=i*i;
}
return sum;
} |
3b8ece80-3403-4698-aeb9-da8bfde52ed0 | 4 | @SuppressWarnings("unused")
public void connect() throws IOException {
if (regLevel != 0) // otherwise disconnected or connect
throw new SocketException("Socket closed or already open ("+ regLevel +")");
IOException exception = null;
Socket s = null;
try {
s = new Socket(host, port);
exception = null;... |
13a99101-0148-4c4d-889d-065ebb3a7b60 | 8 | protected PathNode findNavalTarget(final int maxTurns) {
if (!getUnit().isOffensiveUnit()) {
throw new IllegalStateException("A target can only be found for offensive units. You tried with: "
+ getUnit().toString());
}
if (!getUnit().isNava... |
a9a4fbab-879b-4ec9-ac4f-249a64d94499 | 1 | public List<Problem> findPage(int page,int size) {
log.debug("finding page Problem instances");
try {
String queryString = "from Problem";
Query queryObject = getSession().createQuery(queryString);
queryObject.setFirstResult(page);
queryObject.setMaxResults(size);
List<Problem> list = queryObje... |
fe51a8e7-ca2d-4899-ac0b-ce42fe89e962 | 4 | @Override
public <T extends AggregateRoot<?>> Collection<T> loadBy(Class<T> type,
Specification<T> specification) {
final List<T> satisfied = new ArrayList<T>();
for (final Object aggregate : aggregates.values()) {
if (aggregate.getClass().isAssignableFrom(type)) {
if ... |
f5c5741a-06ec-4b1c-832a-4752432ad41b | 3 | BrandingVO(Path small, Path medium, Path large) {
if ((small == null) || (medium == null) || (large == null)) {
IllegalArgumentException iae = new IllegalArgumentException("One or more bitmaps are null!");
Main.handleUnhandableProblem(iae);
}
this.imgSmall = small;
... |
e1aee3fb-b1bf-4761-9ed2-4483472890b5 | 6 | public Point getCorner() {
System.out.print("Finding corner");
Color edge = new Color(0xbbada0);
int total = 500;
int current = 0;
for (int x = 228; x < GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth(); x++) {
for (int y = 0; y < G... |
da86fa2d-43ea-4253-a982-7fc02ea4dae4 | 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... |
15228b59-9907-4151-96dc-254180416ee2 | 1 | private Map unmarshal(InputStream in) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document doc;
try {
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
factory.setExpandEntityRef... |
a9c80eed-4f8c-46ee-aa8f-0197637a8eae | 3 | public void addFieldListener(Identifier ident) {
if (ident == null)
throw new NullPointerException();
if (fieldListeners == null)
fieldListeners = new HashSet();
if (!fieldListeners.contains(ident))
fieldListeners.add(ident);
} |
562a564c-a7a3-4183-ac60-f58c43b49c06 | 0 | @Override
public void restoreTemporaryToDefault() {tmp = def;} |
9b12879a-e64d-4ee0-a213-721536d43790 | 4 | public static void save(String filename) {
File file = new File(filename);
String suffix = filename.substring(filename.lastIndexOf('.') + 1);
// png files
if (suffix.toLowerCase().equals("png")) {
try {
ImageIO.write(onscreenImage, suffix, file);
... |
1b337c3c-3400-4b6f-a966-cb00295ad327 | 4 | @Override
public void valueChanged(ListSelectionEvent e)
{
if(e.getSource() == listeClassePersonnage)
{
afficheStatClasse();
}
if(e.getSource() == listeArme) // Si l'objet est une JList Equipement
{
afficheStatArme();
}
if(e.get... |
ccad3526-7380-456d-928b-a174da3d48fa | 0 | public void setFixedFee(String fixedFee) {
FixedFee = fixedFee;
} |
d244f689-9bb4-44ea-9f56-455a4704ed3a | 5 | @Override
public Field move() {
if (getTime() > Game.getInstance().getTime()) return null;
super.move();
if (isDrinking()) {
returnTimer--;
return null;
}
List<Comprised> items = getItems();
if (items.isEmpty()) {
HoboPathSearcher... |
0eb4708c-4781-421e-a2b8-627107a7ab3c | 6 | public boolean has_edges(String point_A, String point_B)
{
String []split_str;
if(point_A.charAt(0) == 'r')
{
split_str = point_A.split("\\.", 2);
point_A = split_str[0];
}
if(point_B.charAt(0) == 'r')
{
split_str = point_B.split("\\.", 2);
point_B = split_str[0];
}
String edge_one = this.p... |
c63d9b61-33ef-4ab4-b148-4bbf7860cd0c | 2 | public Student(ResultSet rs) throws Exception{
rs.beforeFirst();
if(rs.next()){
setPersonID(rs.getInt("personid"));
setLastName(rs.getString("lastname"));
setFirstName(rs.getString("firstname"));
setEmail(rs.getString("email"));
setPersonType(r... |
8d8abd2f-40fa-4dc9-b717-535e3ced9dd7 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
14d94f4d-da6f-4c11-a606-431b35e41dcc | 6 | public Genre analyzeBook(Book book) {
// This is a fake genre analyzer, do not take the following serious
Genre genre = Genre.NA;
String details = book.getDetails();
if (details != null) {
if (containsKeyword(details, romanceKeyWord)) {
genre = Genre.ROMANCE;
... |
611b3ed1-9d54-4e91-9945-772d1fa31efd | 7 | private Geometry createFace(Direction dir){
Geometry geo = new Geometry(dir.name(), quad);
geo.setMaterial(blockType.getMaterial());
if(isTransparent()){
geo.setQueueBucket(Bucket.Transparent);
}
geometries[dir.ordinal()] = geo;
switch (dir) {
case NORTH:
geo.setLocalTranslation(centerX+SIZE, cen... |
e13d0c31-7e16-482d-a31c-2b2cdef85563 | 9 | public Map<String, Object> toConfigurationNode() {
Map<String, Object> output = new HashMap<String, Object>();
if (subgroups != null && subgroups.size() != 0) {
output.put("subgroups", subgroups);
}
if (permissions != null && permissions.size() != 0) {
Map<String, List<String>> tmp = new LinkedHashMap<Str... |
cd2d7d9a-835b-4443-b5c8-b6bebdc2e9ca | 8 | public void setup(Object comp) {
if (obs == null || sim == null) {
throw new ComponentException("obs/sim variable not set.");
}
if (comp instanceof Compound) {
Compound c = (Compound) comp;
c.addListener(new Listener() {
@Override
... |
17b61982-799d-4925-a046-b255c9ee5a03 | 7 | public void render(Bitmap bitmap, int xOffset, int yOffset) {
int yPixPos, xPixPos;
int src;
for (int y = 0; y < bitmap.getHeight(); y ++) {
yPixPos = y + yOffset;
if (yPixPos < 0 || yPixPos > width) continue;
for (int x = 0; x < bitmap.getWidth(); x++) {
... |
890672e4-4f9a-49e0-ae3e-17362685606c | 7 | private void login() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
Cliente c;
Funcionario f;
String cpf;
int tam;
cpf = jTextField1.getText();
cpf = cpf.replaceAll("[^0-9]", "");
//System.out.println(cpf);
tam = cpf.length();
if ((tam != 11 && !cpf.mat... |
9cc069be-d163-45dd-81fc-311d1f5dda71 | 5 | public void setFullScreen(DisplayMode displayMode) {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setIgnoreRepaint(true);
frame.setResizable(false);
device.setFullScreenWindow(frame);
... |
002a6a69-0157-4e5f-93a6-1287f74e9164 | 3 | public String getGeraGMP2() throws SQLException, ClassNotFoundException {
String sts = new String();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
try {
Statement stmt... |
c19d3cc9-54c5-4119-8da0-a1e88d770900 | 3 | private void processProjectsForTraining(List<Position> positions) {
Iterator<Position> iterator = positions.iterator();
while (iterator.hasNext()) {
Position position = iterator.next();
String managerId = position.getCreatedBy();
List<SkillRating> projectSkillRatings = position
.getRequiredSkillRating... |
6f0fdf70-0849-4927-b4b0-200521a20589 | 8 | private void convertInstanceNumeric(Instance instance) {
double [] vals = new double [outputFormatPeek().numAttributes()];
int attSoFar = 0;
for(int j = 0; j < getInputFormat().numAttributes(); j++) {
Attribute att = getInputFormat().attribute(j);
if ((!att.isNominal()) || (j == getInputFormat... |
5f2f720a-96f0-4d68-a452-e692e722959e | 9 | public void map(LongWritable lineid, Text nodetxt,
OutputCollector<Text, Text> output, Reporter reporter)
throws IOException
{
Node node = new Node();
node.fromNodeMsg(nodetxt.toString());
int fdegree = node.degree("f");
int rdegree = node.degree("r");
... |
58fb8c28-bd6c-40ef-b932-8879ec3e2759 | 2 | public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
String str1=request.getParameter("q1");
int i1=Integer.parseInt(str1);
String st1=request.getParameter("a1");
Connection conn;
Statement stmt;
PrintWriter out=response.getWriter();
response.setContentT... |
3dc618d9-4d15-4d15-a347-a86a7a90d532 | 7 | public boolean firstName(String firstName) {
if (firstName == null || firstName.isEmpty()) {
return false;
}
if ((int) firstName.charAt(0) < 65 || (int) firstName.charAt(0) > 90) {
return false;
}
for (int i = 1; i < firstName.length(); i++) {
... |
27389f3d-6727-43af-9fd6-565f78251e4e | 3 | public String reconstructString() {
StringBuilder reconstructedString = new StringBuilder();
List<String> listWithAllOutgoingStrings = getListWithAllOutgoingStrings();
List<String> listWithAllIncomingStrings = getListWithAllIncomingStrings();
String start = findStart(listWithAllOutgoing... |
bcea9fba-6ec2-491e-b60c-c14471f8de0c | 4 | public Race load() {
String toLoad = "";
switch( raceName ) {
case PROTOSS:
toLoad = PROTOSSFILE;
break;
case TERRAN:
toLoad = TERRANFILE;
break;
case ZERG:
toLoad = ZERGFILE;
... |
fad3a7e5-ccec-47aa-b5f2-2615872a5b9c | 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;
... |
1b093e8a-d9cb-43a9-a8eb-5c00bc817d48 | 1 | public void testConstructor_ObjectStringEx1() throws Throwable {
try {
new LocalDate("1970-04-06T+14:00");
fail();
} catch (IllegalArgumentException ex) {}
} |
79671c7c-bfde-4340-bd14-3a752f5e4d1a | 8 | public CreateNetworkGame(Window owner, GeneralAttribute ga, StartWindows sw) {
super(owner, ModalityType.APPLICATION_MODAL);
this.generalAttribute = ga;
this.startWindow = sw;
generalAttribute.addObserver(this);
getContentPane().setBackground(new Color(102, 102, 102));
getContentPane().setCursor(
Cursor... |
92e97ff3-ae0c-4769-b0ea-f32689f99199 | 7 | private static int guessFontStyle(String name) {
name = name.toLowerCase();
int decorations = 0;
if ((name.indexOf("boldital") > 0) || (name.indexOf("demiital") > 0)) {
decorations |= BOLD_ITALIC;
} else if (name.indexOf("bold") > 0 || name.indexOf("black") > 0
... |
f46770bb-6d4b-4bde-85e2-b209dd3d4f5f | 4 | /* */ public void paintGUI(Graphics g)
/* */ {
/* 548 */ int offY = 280;
/* 549 */ g.setColor(Color.WHITE);
/* 550 */ g.setFont(this.font);
/* 551 */ g.drawImage(guiUnits.getTileImage(0), 12, 12 + offY, this);
/* */
/* 553 */ if (units.contains(commander)) {
/* 554 */ g.setCol... |
6ad582b3-f21d-46c4-801e-cd890503d4cf | 7 | public static void main(String[] args){
Set<Integer> amicable = new HashSet<Integer>();
int[] div = new int[10000];
for (int i=1;i<10000;i++){
div[i] = sumOfDivs(i);
}
for (int i=1;i<10000;i++){
for (int j=1;j<10000;j++){
if (i==j) continue;
if (div[i]==j && div[j]==i){
amicable.add(i... |
584600a0-5a65-4f30-9547-bbfb05496d95 | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
5bc67f50-d73e-45e5-b924-dee00a48811f | 4 | @Override
public void deserialize(Buffer buf) {
fightId = buf.readInt();
fightType = buf.readByte();
if (fightType < 0)
throw new RuntimeException("Forbidden value on fightType = " + fightType + ", it doesn't respect the following condition : fightType < 0");
fightStart =... |
f453f55a-9ad9-4e24-9b54-c0040d549a30 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
3215b4cf-d4dd-49ef-8b56-c9e75ce1aa91 | 2 | @Test
public void testSanitizeHtmlLongLengthMax() throws Exception {
String test = "";
for(int i = 0; i < 2001; ++i) {
test += 'c';
}
try {
Sanitizer.sanitizeLongText(test).getCleanHTML();
} catch (org.owasp.validator.html.ScanException e) {
... |
70d83350-1a57-4f29-b70c-274df99e91d5 | 2 | public static Image crop(int height, int width, int x, int y, Image original) {
Image image = new RgbImage(width, height);
for (int i = 0; i < height; i++) {
for (int j = 0; j < height; j++) {
image.setPixel(i, j, RED, original.getPixel(i + x, j + y, RED));
image.setPixel(i, j, GREEN,
original.getP... |
f8bf6008-5516-4366-926b-a3dc450fd68f | 8 | public Void visitDeclarationStatements(DeclarationStatementsContext ctx) {
if (ctx.children == null) return null;
int loc = 1;
for (ParseTree child : ctx.children) {
if (child instanceof DeclarationStatementContext) {
visitDeclarationStatement((DeclarationStatementContext) child);
if ... |
d2fe92b0-7bf1-4737-a179-a552b2d1477e | 9 | @SuppressForbidden(reason = "Needs access to private APIs in DirectBuffer and sun.misc.Cleaner to enable hack")
private static Object unmapHackImpl() {
final Lookup lookup = lookup();
try {
final Class<?> directBufferClass = Class.forName("java.nio.DirectByteBuffer");
final Method m = direc... |
696766e3-9122-48f7-aa80-77576f2b660b | 1 | public static Logger getInstance(){
if(Logger.logger == null)
Logger.logger = new Logger();
return Logger.logger;
} |
e03ab448-d87f-4562-9d6a-bf849ba7e583 | 5 | static final boolean method2797(String string, byte i) {
anInt4763++;
if (string == null)
return false;
for (int i_1_ = 0; ((Class348_Sub40_Sub30.friendListLength ^ 0xffffffff)
< (i_1_ ^ 0xffffffff)); i_1_++) {
if (string.equalsIgnoreCase(Class83.friendListUsernames[i_1_]))
return true;
}
if (st... |
6b34dcfa-0472-41f2-93ca-061e97bb7465 | 8 | public boolean hasAxe() {
if(playerHasItem2(6739) || playerHasItem2(1351) || playerHasItem2(1349) || playerHasItem2(1353) || playerHasItem2(1355) || playerHasItem2(1357) || playerHasItem2(1359) || playerHasItem2(1361))
{
return true;
}
return false;
} |
53ba3501-46fe-4949-a651-cd14af6814fa | 5 | public FenetreConnexion(final Portail p1) {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds(100, 100, 401, 348);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
textField = new JTextField();
t... |
5f0dff59-0a99-4d7b-a5ed-ea40f6e0daad | 5 | private void checkCollisions() {
for (Ball ball : balls) {
if (ball.getBoundsInParent().intersects(leftPaddle.getBoundsInParent())) {
ball.collision();
ball.move();
rightPaddle.computeOptimalPoint(balls);
leftPaddle.computeOptimalPoint(balls);
continue;
}
if (ball.getBoundsInParent().inte... |
bdb49143-85c4-4303-a000-4af4181b59f4 | 4 | public void loadProperties(String fileName) throws FileNotFoundException {
InputStream in = null;
try {
in = PropertiesReader.class.getClassLoader().getResourceAsStream(fileName);
if(in == null ){
in = new FileInputStream(System.getProperty("user.dir")+ File.separ... |
972d6a43-f6c2-43eb-8823-f521c815a0d7 | 9 | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static void main(String[] args) throws Exception {
// 先使用hexedit 编辑package
FileInputStream is = new FileInputStream("/tmp/AndroidManifest.xml");
byte[] data = IOUtils.toByteArray(is);
Map<String, String> map = new HashMap<String, Str... |
c4299abf-1658-4a1d-9c4e-46722701c23a | 9 | private final void method550(byte[] bs, int[] is, int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_, int i_8_, aa var_aa, int i_9_, int i_10_) {
aa_Sub1 var_aa_Sub1 = (aa_Sub1) var_aa;
int[] is_11_ = var_aa_Sub1.anIntArray5487;
int[] is_12_ = var_aa_Sub1.anIntArray5488;
int i... |
ce69f03b-eaa8-486f-b057-8d063600536c | 3 | public void transformBlockInitializer(StructuredBlock block) {
StructuredBlock start = null;
StructuredBlock tail = null;
int lastField = -1;
while (block instanceof SequentialBlock) {
StructuredBlock ib = block.getSubBlocks()[0];
int field = transformOneField(lastField, ib);
if (field < 0)
clazzAn... |
cb1fdde3-60c2-4381-9692-2b21d2f109e4 | 3 | private int nextState(char c, int state)
{
int start = SCANNER_TABLE_INDEXES[state];
int end = SCANNER_TABLE_INDEXES[state+1]-1;
while (start <= end)
{
int half = (start+end)/2;
if (SCANNER_TABLE[half][0] == c)
return SCANNER_TABLE[half][1]... |
8e90ea25-fd1c-4c49-9e28-2a99eb80aa84 | 7 | private boolean jj_3R_52() {
if (jj_3R_92()) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_93()) jj_scanpos = xsp;
if (jj_scan_token(K_IN)) return true;
if (jj_scan_token(91)) return true;
xsp = jj_scanpos;
if (jj_3R_94()) {
jj_scanpos = xsp;
if (jj_3R_95()) return true;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.