method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
963eb7b0-22e0-411a-b105-6c2bd128f628 | 6 | public void letterSplit() {
int size = this.matrixList.size();
for (int i = 0; i < size; i++) {
String s = this.matrixList.get(i);
StringTokenizer stringTokenizer = new StringTokenizer(s);
int j = 0;
while (stringTokenizer.hasMoreElements()) {
... |
61c17cf0-2759-4b4b-bd6a-9709a42e2da3 | 0 | public WeaponItem(){
super();
this.attackScore = 1;
this.name = "Unknown WEAPON name";
this.attackSpeed = 10;
} |
92f7e9e6-96dc-4491-9dd9-d5579fdd2610 | 1 | private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alert.getText();
} finally {
acceptNextAlert = true;
}
} |
33efe230-2f61-4231-acac-7f6c7722e73b | 5 | public static void main (String args[]) throws IOException
{
Scanner kb = new Scanner (new File("pr08.txt"));
int times = Integer.parseInt(kb.nextLine().trim());
for (int i = 0; i < times; i++)
{
int temp = Integer.parseInt(kb.nextLine().trim());
System.out.print(temp + " ");
for (int j = 0; j... |
73257779-081e-499c-acec-20de60825fae | 5 | public boolean remove(Task task) {
if(task ==null) {
for ( int index=0; index <size; index++)
if(tasks[index] == null){
fastRemove (index);
return true;
}
} else {
for (int index = 0; index <size; index++)
if(tasks.equals(tasks[index])){
fastRemove(index);
return tru... |
23ce092b-7e1c-4b5b-9234-528f1754d5b9 | 3 | public void setEQ(float[] eq0)
{
this.eq = eq0;
if (eq==null)
{
eq = new float[32];
for (int i=0; i<32; i++)
eq[i] = 1.0f;
}
if (eq.length<32)
{
throw new IllegalArgumentException("eq0");
}
} |
2dfc30cf-97c3-4d3d-acf6-2ba9991b27c0 | 4 | private void setupAttributes(Actor actor) {
float minPhys = 0, minSens = 0, minCogn = 0 ;
for (Skill s : actor.traits.skillSet()) {
final float level = actor.traits.traitLevel(s) ;
actor.traits.raiseLevel(s.parent, level - Rand.index(5)) ;
if (s.form == FORM_COGNITIVE) minCogn = Math.max(level... |
33b342f8-fe1c-474c-b2eb-d0679026bac6 | 6 | public WebElement getElement(String elementIdentfier){
String indentifierType;
String identifierTxt = null;
WebElement webElement = null;
try{
if (elementIdentfier.split(",").length > 1) {
// path is other than id
indentifierType = elementIdentfier.split(",")[0];
identifierTxt = elementIdent... |
e09b3ea8-e5f4-46b4-84e2-f758f6902776 | 2 | public String getFormatName() {
if (format >= 0 && format < FORMAT_NAMES.length) {
return FORMAT_NAMES[format];
} else {
return "?";
}
} |
2083207c-92f4-4d93-9b01-2a51a58c4a93 | 0 | public static void main(String[] args) {
System.out.println(fill(new ArrayList<String>()));
System.out.println(fill(new LinkedList<String>()));
System.out.println(fill(new HashSet<String>()));
System.out.println(fill(new TreeSet<String>()));
System.out.println(fill(new LinkedHashSet<String>()));
System.out.... |
fd39b65e-a7c8-4bac-a139-3ea1da9ee6bd | 0 | public boolean isEmpty(Position pos){
return (getPiece(pos)==null) ;
} |
01b58160-65af-4cfc-9e97-b09129c0689c | 0 | public void setPower(PowerUp a){
power = a;
} |
72bcb3f0-7cb2-4c76-b874-7e44b9bdd875 | 7 | private void invite(Player player, String[] args) {
if (!player.hasPermission("buildingplanner.invite")) {
player.sendMessage("You do not have permission to invite collaborators");
return;
}
if (args.length < 2) {
player.sendMessage("You need to specify a player to invite");
return;
}
Player ... |
f5b59f0a-cee8-4d26-86ef-50504860647f | 2 | void compareCdf(double p, int k, int n, double result) {
double prob = Binomial.get().cdf(p, k, n);
double abs = Math.abs(prob - result);
double diff = abs / Math.min(prob, result);
if ((abs > 1E-300) && (diff > 0.00000000001)) throw new RuntimeException("Relative difference:" + diff + "\t\t" + prob + " != " +... |
4c9453bd-ce25-42f0-83b5-e01b55e8f86a | 8 | public void insert(Object changedObject){
ArrayList<String> fields;
ArrayList<String> values;
String table = changedObject.getClass().getSimpleName();
switch(table){
case "User":
User user = (User) changedObject;
fields = new ArrayList<>(Arra... |
a6635de3-31ae-4fa7-a126-a285f5359358 | 1 | public Object fireButNoSmoke() {
fireStarter.makeSomeFire();
if(!fireStarter.isSmoke()){
this.testResult = "Everything works";
}
return null;
} |
5744a456-7a5c-43a9-b2b9-826700aea056 | 4 | protected void closeConnections(ResultSet myResultSet, PreparedStatement myPreparedStatement, Connection connect) {
try {
if (myResultSet != null) {
myResultSet.close();
}
if (myPreparedStatement != null) {
myPreparedStatement.close();
}
if (connect != null) {
connect.close();
}
} ... |
78abe25a-6fb3-46d1-b3fa-8bf8b6aad3ae | 5 | private void processFile(FileSystem fs, Path inputPath) throws IOException {
logger.info("Process: " + inputPath);
FSDataInputStream in = fs.open(inputPath);
BufferedReader rd = new BufferedReader(new InputStreamReader(in));
Pattern tokenPattern = Pattern.compile("(\t)+|( )+|(,)+");
... |
dce91f89-5107-4044-91a7-b3c28637fbfc | 1 | public double getSubStackWidth(int index1, int index2) {
double width = 0;
for (int i = index1; i <= index2; i++) {
width += intervals.get(i).getWidth();
}
return width;
} |
dc578654-d09b-4a83-ad94-e5da555f2c22 | 1 | public OutputStream getOutputStream() throws IOException {
synchronized(this) {
if(out == null)
out = new HackOutputStream(super.getOutputStream());
return(out);
}
} |
3e44363d-b255-43e5-9fba-feac947f9280 | 9 | @Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length < 1) {
return false;
}
PermissionUser target;
try {
target = plugin.getDataManager().getUser(args[0]);
} catch (DataLoadFailedException ex) {
plugin.get... |
b22b53b3-dc93-4663-826a-98e3b545264b | 2 | public static <T> Collection<T> filter(Collection<T> collection, Predicate<T> predicate){
Collection<T> temp = new ArrayList<T>();
for(T t : collection){
if(predicate.evaluate(t)){
temp.add(t);
}
}
return temp;
} |
96d68173-a867-48a3-85c9-9111ec6e3dbd | 8 | public final WaiprParser.stats_return stats() throws RecognitionException {
WaiprParser.stats_return retval = new WaiprParser.stats_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal52=null;
ParserRuleReturnScope stat51 =null;
ParserRuleReturnScope stat53 =null;
CommonTr... |
582ed91c-e4f9-4d4a-89c8-d4f922ad21fd | 4 | public void drawObjects(JFrame frame, boolean addClickableFct) {
List<Item> itemsInDrawFunction = getItems();
for (int cntItemPic = 0; cntItemPic < itemsInDrawFunction.size(); cntItemPic++) {
if (Runtime.checkStep(itemsInDrawFunction.get(cntItemPic).getId(),
'i', 'd')) {
System.out.println("I want to d... |
84fb3601-32ba-404e-ad50-f6757bfdea11 | 0 | public void testClient() {
CameraCaptureTester tester = new CameraCaptureTester();
tester.run();
} |
13f8259d-22de-45c7-aa04-25ec6dce62c1 | 0 | public void setFunEndeudamiento(Integer funEndeudamiento) {
this.funEndeudamiento = funEndeudamiento;
} |
99a78ac6-0c6f-41d2-b1f7-f9824585ba7c | 5 | public static void main(String[] args)
{
Calendar c = Calendar.getInstance();
c.set(2008, Calendar.DECEMBER, 20);
c.setMinimalDaysInFirstWeek(5);
c.setFirstDayOfWeek(Calendar.SATURDAY);
System.out.print("Number of JAN days required in week 1 = " + c.getMinimalDaysInFirstWeek() );
SimpleDateFormat sdf... |
a389653c-6e30-497a-841a-16b943001bf6 | 5 | public int[] plusOne(int[] digits) {
int flag = 1;
for (int i = digits.length-1; i >= 0; i--){
if (flag == 1){
if (digits[i] == 9){
digits[i] = 0;
flag = 1;
}
else{
digits[i] ... |
0437d4cb-de11-4605-9a1e-63902e9a5759 | 2 | public Instruction(Opcode opcode) {
if(opcode==null)
throw new IllegalArgumentException("Opcode must not be null");
if(opcode.getCode()==null)
throw new IllegalArgumentException("Can't make Instruction object for fake Opcode");
this.opcode = opcode;
} |
8e8e3c83-d4c7-455f-952b-8d0e4cb164ae | 4 | private void fetchAlerts(HttpSession session, StudentBean student) {
List<AlertBean> alerts = EventDao.fetchAlerts(student);
if(alerts!= null && alerts.size()>0){
int alertCount=0;
session.setAttribute("alerts", alerts);
for(AlertBean alertBean:alerts){
if(!alertBean.isViewed())
{
alertCount++... |
4ffd1bea-96f9-4792-9784-598eb3b37734 | 7 | private void addGettersToMap(ISemiSpaceTuple examine, Map<String, Object> map) {
final Set<String> getters = new HashSet<String>();
final Method[] methods = examine.getClass().getMethods();
final Map<String, Method> keyedMethod = new HashMap<String, Method>();
final Map<String, String> k... |
ee49eb35-03b9-4ec5-b3e4-e231133e0db9 | 8 | public QuadTreeNode( int startX, int startY, int height, int width, int data[][] ){
// set coordination
this.height = height;
this.width = width;
// Initialize white pixel number and black pixel number
whitePixelNum = 0;
blackPixelNum = 0;
// Count white pixels and black pixels
for(int i=startX; ... |
f0b062ea-97da-4fda-9744-365ebc201cfb | 9 | public SetupHeader(VorbisStream vorbis, BitInputStream source) throws VorbisFormatException, IOException {
if(source.getLong(48)!=HEADER) {
throw new VorbisFormatException("The setup header has an illegal leading.");
}
// read code books
int codeBookCount=source.getInt(8)+1;
co... |
327121ba-f965-454c-a9e6-8caf9317d21e | 0 | public int getPriority() {
return priority;
} |
9638a7eb-3c62-4c2b-87a6-1a2731e3aebe | 3 | public JPanel createPanel(JFrame frame) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException {
String type = this.getType();
@SuppressWarnings("unchecked")
Class<? extends JPanel> panelCla... |
d3d32b15-1241-46ed-8cd1-4a6ef9f0543a | 4 | public static int[][] rotate_right(int [][] matrix)
{
System.out.println("Rotating to right 90 degrees: ");
int new_matrix [][] = new int [matrix.length][matrix.length];
int z = 0;
for(int i=2; i >= 0; i--)
{
for(int j=0; j<=2; j++)
{
new_matrix[j][z] = matrix[i][j];
}
z++;
}
for(int i... |
9ed1eb72-5c82-49a7-becf-ee78e818de0d | 5 | public void run() {
StringTokenizer stInput = new StringTokenizer(input.getText(), "\n");
String line;
int lineLength;
for (int i = 0; stInput.hasMoreTokens(); i++) {
line = stInput.nextToken();
lineLength = line.length();
if (lineLength > 0) {
if (i != 0) {
try {
... |
3346af1e-e39a-4752-a5d9-963f61f20ea3 | 8 | void readlineprim () throws IOException
{
StringParser sp;
char b = read();
L = 0;
while (true)
{
if (L >= linesize || b == '\n')
{
if (L >= linesize) Dump.println("IGS : Buffer overflow");
break;
}
C[L++] = b;
b = read();
}
Number = 0;
Command = "";
int i;
for (i = 0; i < L;... |
1464a5af-632a-4242-99cd-ae966fadb409 | 2 | public static Graph quick(int size) {
Graph g = new Graph();
for (int i = 0; i < size; i++) {
g.addVertex(new Vertex(0));
if (i > 1) {
g.addEdge(g.getVertices().get(i), g.getVertices().get(i - 1), r.nextInt((10) + 1));
g.addEdge(g.getVertices().get... |
976fb6e3-5b7f-4715-998f-94067f5897b9 | 8 | public String RolesToString(){
String output = "";
for(int i = 0; i < NumPlayers; i++){
output += "(" + (i+1);
if(PlayerRoles[i] < 0) output += " Dead";
switch(PlayerRoles[i]){
case 1: output += " Villager";
break;
case 2: output += " Seer";
break;
case -1: output += " Villager";
break;
... |
caf7c147-9b17-4a87-9631-52dd23a6ce59 | 0 | public String getName()
{
return Name;
} |
c135bce3-db87-4ef4-adb8-e20b375d9fab | 9 | public boolean writeResourcePredictionsToFile(String filename, int trainSize, int neighborSize) {
List<String> resourceList = this.reader.getResources();
Map<Integer, List<Integer>> resourcesOfTestUsers = this.reader.getResourcesOfTestUsers(trainSize);
try {
FileWriter writer = new FileWriter(new File("./da... |
24927558-7861-4a33-8d08-d1a4038b2782 | 1 | @Override
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
return null;
}
} |
735a2707-1b25-42e5-89ad-01f72712bc02 | 0 | public Image saveImage(Image image) {
imageTemplateRepository.save(image);
return image;
} |
72491b33-e9c8-44bc-9266-1d4830c41728 | 5 | static public void findPersonDomain(){
Iterator it = Person.iterator();
Person pers;
FileWriter fw = null;
PrintWriter pw = null;
String key = null;
try {
fw = new FileWriter("parserResult/authorDomain.csv");
pw = new PrintWriter(fw);
//pw.println("Authors' Domain");
while (i... |
3bb404da-5dd5-4fa4-bd46-64e13f3d6f3b | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Float.floatToIntBits(bitsPerPixelStored);
result = prime * result + bitsPerSample;
result = prime * result + ((codec == null) ? 0 : codec.hashCode());
resu... |
79287285-429b-422c-88f4-9b3ea94d363c | 7 | public List<ProfileInfo> Get_DataObjList(){
List<ProfileInfo> profileList = new ArrayList<ProfileInfo>();
ProfileInfo profileObj = null;
String sql = "select * from profile";
try {
con = getConnection();
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
... |
63ccddcf-a0af-4a7a-8be8-85c0f7aafebd | 8 | private static TwitterResponseWrapper sendRequestGet(String httpMethod, String baseUrl, Hashtable<String, String> httpParams, String oauthHeader) {
HttpURLConnection conn = null;
BufferedReader in = null;
TwitterResponseWrapper response = new TwitterResponseWrapper();
try {
String combinedHttpUrl = ... |
c3410cf6-0840-43ab-96be-fffa552bc493 | 1 | private void setElem(int rowIndex, int colIndex, Complex z) {
try {
matrix[rowIndex][colIndex] = z;
} catch (Exception e) {
e.printStackTrace();
}
} |
da422e57-383b-4340-94cb-ac1986631d35 | 0 | public void setAddressType(String addressType) {
this.addressType.set(addressType);
} |
e0f47def-2987-4d1b-bad6-fcdf54c58c88 | 9 | private static void addEvent(Calendar cal) {
Scanner in = new Scanner(System.in);
System.out.println("Please enter the name of the event:");
String name = in.nextLine();
System.out.println("Please enter the type of the event\n(class, meeting, work, other):");
String type = in.nextLine();
if (type.equalsI... |
db92a09f-a7c6-4003-a3f0-4e8d6fc7fc56 | 0 | protected Random getRandom()
{
return rand;
} |
34179c26-4adc-4794-9ace-eec5d7ca3899 | 0 | public void setIdSolicitud(int idSolicitud) {
this.idSolicitud = idSolicitud;
} |
dcdf03a1-ece4-4e35-9a07-b31461a76dc9 | 8 | public UCPPacket deserialize(ByteBuf ucpPacket) {
byte stx = ucpPacket.readByte();
if(0x02 != stx) {
throw new IllegalArgumentException("Packet should start with the STX character but starts with: " + stx);
}
int trn = Integer.parseInt("" + ((char) ucpPacket.readByte()) + ((char) ucpPacket.readByte()))... |
b44afbc4-79bb-4955-be77-e664157e2ef9 | 0 | public BigDecimal b()
{
return b;
} |
72ce96f3-c067-46f2-a171-5513e5880ab4 | 4 | public static long getTestSetFolderId(HierarchicalConfiguration testsetData, String testsetFolderName)
{
long testsetFolderId = 0;
List<HierarchicalConfiguration> testsetFoldersData = testsetData.configurationsAt(TESTSET_FOLDER_TAG);
if (testsetFoldersData != null && !testsetFoldersData.isEmpty()) ... |
2cd0c9ba-92f1-4eb9-b862-2ed2094dca4e | 6 | public void testDajStraneGoste() {
Osoba o=new Osoba(); o.setImePrezime("Alen Kopic");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
o.setDatumRodjenja(sdf.parse("1992-10-21"));
} catch (java.text.ParseException p) {
System.out.println(p.toString());
}
o.setAdresa("Vitkovac 1... |
4ca88aba-b756-41dc-8911-a96a87e6702e | 6 | @Override
public void run() {
while (!stopped) {
Set<Long> mappedIds;
synchronized (threadTimeMap) {
mappedIds = new HashSet<>(threadTimeMap.keySet());
}
long[] allThreadIds = threadBean.getAllThreadIds();
if (mappedIds != null) {... |
f08d38bf-d9af-42b5-8d99-b91ad116050d | 8 | private static void parseFunction(final Parser parser,
final PgDatabase database) {
final String functionName = parser.parseIdentifier();
final String objectName = ParserUtils.getObjectName(functionName);
final String schemaName =
ParserUtils.getSchemaName(functionNam... |
a08b66da-d94b-4f6e-bef1-9aaa56e76d9b | 7 | public static void startupMachineLearning() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$... |
e5636afc-76c5-463a-8cb1-c9bae0d7ada3 | 7 | @Override
public String toString() {
boolean deleteLastTab = true;
StringBuilder sb = new StringBuilder(toStringNoGt());
sb.append("\t");
// Is there any 'format' field? It is optional, so it could be 'null'
if (format != null) {
sb.append((format.isEmpty() ? "." : format) + "\t");
// If we have vcf... |
4c9536fc-c4a3-47a0-ac64-18f89be0586a | 3 | public void dispatchUnzipTask(final List<File> tasks) {
executorService.execute(new Runnable() {
@Override
public void run() {
try {
synchronized (tasks) {
for (File task : tasks) {
GutenbergCrawlerHelper.unzipFiles(task);
}
}
} catch (IOException e) {
// TODO Auto-gen... |
ce885b6a-6f1e-4ca2-83b3-5e6640f76a3e | 7 | public static List<String> readFile(String aFileName) throws KadaiException
{
// nullチェック
if (null == aFileName) {
throw new KadaiException(ErrorCode.FILE_IO);
}
BufferedReader br = null;
List<String> list = null;
// ファイル存在確認
if (!new File(aFileName).exists()) {
throw new KadaiException(ErrorCode.... |
3f23036b-5ce8-4fcd-ad11-b05faed532e1 | 6 | private Font resolveFont(Node fontNode) throws RrdException {
validateTagsOnlyOnce(fontNode, new String[] {"name", "style", "size"});
String name = getChildValue(fontNode, "name");
String style = getChildValue(fontNode, "style");
int size = getChildValueAsInt(fontNode, "size");
int stl = Font.PLAIN;
i... |
b6de3152-cf82-46a1-9fcf-c9a326ec92fe | 0 | public static void main(String[] args)
{
MyGridLayout myGridLayout = new MyGridLayout();
myGridLayout.go();
} |
2bbbb292-e9fc-42bf-80ab-73221bb17f49 | 6 | public static double[] createRandomDistributionWithNoZero(int size, int precision, double somme_distrib) {
double[] distribution = createRandomDistribution(size, precision, somme_distrib);
if (somme_distrib > 0) {
int nb_remplacement;
List<Integer> donotmodifie = new ArrayList<>(... |
a0743b91-72cf-407a-9d56-b2b9a0371815 | 5 | public void processMenu(UIMenu menu) {
StringBuilder b = new StringBuilder();
b.append(menu.getHeading());
b.append("\n");
b.append("Enter choice by number:");
b.append("\n");
for (int i = 1; i < menu.size(); i++) {
b.append(" " + i + ". " + menu.getPrompt(i));
b.append("\n");
... |
a6b0121b-115e-47d8-b4ed-0ff55e30394c | 8 | private void initModifiers() {
validModifiers = new HashMap<String,Method>();
validModifiersWithArgs = new HashMap<String,Method>();
@SuppressWarnings("rawtypes")
Class thisClass = this.getClass();
// Get the CommandLine (this) class methods
Method[] mList = null;
try {
mList = thisClass.getMetho... |
62f51bf9-3f84-464f-9e4e-3e19f206fdbb | 2 | public void filter(String searchString){
model.removeAllElements();
for(K o : map) {
if (o.toString().startsWith(searchString)) model.addElement(o);
}
} |
2d586793-5b35-4b13-821e-1ed8209fa12f | 3 | public void editAttributes(DragAndDropClassObject ddClassObject){
Vector<Object> attributes = new Vector<Object>();
ImageIcon icon = new ImageIcon("");
for (String attribute:ddClassObject.classObject.attributes){
attributes.add(attribute);
}
Object[] possibilities = attributes.toArray();
String s = (Stri... |
c0643531-cabe-4173-84c9-70c7263c6f4e | 9 | public int getValue()
{
if(uex!=null)
{
if(op.getName().equals("+"))return +uex.getValue();
if(op.getName().equals("-"))return -uex.getValue();
if(op.getName().equals("!"))return uex.getValue()==0?1:0;
if(op.getName().equals("~"))return ~uex.getValue();
throw new IllegalStateException("Invalid Unary... |
3bd6250c-5fdd-4fba-afa9-42dbc5ae95b2 | 4 | public static void main(String[] args) {
System.out.println("TestOAuthScribe");
OAuthService service = new ServiceBuilder().provider(TwoLeggedOAuth.class).
apiKey(OAUTH_API_KEY).
apiSecret(OAUTH_SHARED_SECRET).
build();
/**
* For 3-legged you would need to request the authorization t... |
fc992d7f-0255-423f-8d2e-33181af0da14 | 8 | private static void printLiterals(Function func)
{
Set<BasicBlock> explored = new HashSet<> ();
Queue<BasicBlock> frontier = new LinkedList<> ();
frontier.add(func.startingBlock);
while (!frontier.isEmpty())
{
BasicBlock block = frontier.remove();
if (explored.contains(block))
continue;
explored... |
0bf51d10-a8d2-4ea0-bdea-f11a8ba1633c | 7 | public Main() {
Dimension d = new Dimension(WIDTH, HEIGHT);
this.setSize(d);
this.setPreferredSize(d);
this.setMinimumSize(d);
this.setMaximumSize(d);
this.setFocusable(true);
this.setIgnoreRepaint(true);
game = new Asteroids();
this.addKeyListener(game);
//this.addMouseListener(game);
//thi... |
eea401c8-c911-456e-bc24-c3104f2cff62 | 3 | private void InitSchema(Object obj)
{
Class classInfo = obj.getClass();
if (fieldsMap == null || SchemaClassName != classInfo.getName())
{
fieldsMap = new HashMap<String, Field>();
}
SchemaClassName = classInfo.getName();
Field[] fields = classInf... |
8ed9f278-11e4-4ae7-8f50-ad06f6d929fc | 4 | private final boolean isInsideString( String line, int position )
{
if ( line.indexOf( '"' ) < 0 )
{
return false;
}
int index;
String left = line.substring( 0, position );
String right = line.substring( position );
int leftCount = 0;
int r... |
a979b0ef-ad8b-4006-8660-c2d5d3ad7d58 | 2 | private boolean trackImage(Image image) {
if (image == null)
return true; // Why not...
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image, 0);
try {
tracker.waitForID(0);
} catch (InterruptedException e) {
return false;
}
return true;
} |
bbdb5b22-8e26-4c37-8136-43d4c49a496d | 1 | public static String informShipAction(String ship, boolean isLoading) {
return new StringBuilder(ship)
.append(isLoading ? " is loading..." : " is unloading...").toString();
} |
8484d5f0-9f7c-4de2-b2b0-14bff697f706 | 9 | private Spatial isColliding(Spatial spatial) {
ArrayList<PhyInfo> spatialsInRange = getAllSpatialsWithinRange(spatial);
if (spatialsInRange == null || spatialsInRange.isEmpty()) {
return null;
}
for (int i = 0; i < spatialsInRange.size(); i++) {
Spatial oppositeSp... |
db3ebb9a-40cf-401f-b935-6de3b8fc4ba2 | 0 | public void setPersonid(int personid) {
this.personid = personid;
} |
6c0ffacf-3d95-4ef0-b1ae-aa04329a1a01 | 8 | private void updateLocalPlayerMovement(Stream updateBuffer) { // method117
updateBuffer.beginBitBlock();
int flag = updateBuffer.getBits(1);
if (flag == 0) {
return;
}
int type = updateBuffer.getBits(2);
if (type == 0) {
playerUpdateIndices[entityU... |
c140e8d8-66fe-4509-89a4-7ae74b75cef8 | 0 | public void setName(String name) {
this.name = name;
} |
85b5027c-f2fe-498c-96c0-2b9c425d33d5 | 9 | private int getIndex(char letter) {
switch (letter) {
case 'I':
return 0;
case 'V':
return 1;
case 'X':
return 2;
case 'L':
return 3;
case 'C':
return 4;
case '... |
24a841e8-0579-4bf3-9864-8c82129fd131 | 0 | public int peekRunTimeStack() {
return runStack.peek();
} |
315e07c5-6ca9-4e80-99e4-e9ede9da2fd3 | 1 | @Override
public int getRoll(){
Iterator<IStrategy> it = this.getStrategies().iterator();
int total = 0;
while(it.hasNext()){
total+=it.next().getRoll();
}
return total/this.getStrategies().size();
} |
1abc8045-e19c-4d05-91eb-6462de15d8cc | 2 | @Override
public int compare(NotifierTarget t1, NotifierTarget t2) {
int p1 = t1.getNotificationPriority();
int p2 = t2.getNotificationPriority();
if (p1 > p2) {
return 1;
}
if (p1 < p2) {
return -1;
}
return 0;
} |
03fa4201-6d0f-4f76-9985-5131a3d8b414 | 8 | private void UpdateVisualization() {
if(visualizationChooserComboBox.getValue() != null && mediaPlayer != null) {
if(visualization != null)
interfacePane.setCenter(null);
if(visualizationChooserComboBox.getValue() == "Spectrum Bars") {
AUDIO_SPECTRUM_INTERVAL = 0.06;
visualization = new ... |
3de0bfeb-0805-4303-a14b-88368725b740 | 5 | public void generateGenericDataset(String datasetFile, HashMap<String, Integer> files, int numOperations) throws IOException {
FileWriter fstream = new FileWriter(datasetFile);
BufferedWriter out = new BufferedWriter(fstream);
int fileNum = files.values().size() + 1;
int totalFiles = fileNum - 1;
Object[] ... |
7a681131-6b98-4973-a972-55e6e0f1db10 | 2 | public void randomizeSamples() {
for( int ns = 0; ns < numberOfSamples; ns++ )
for( int i = 0; i < n; i++ ) {
// Select 2 samples (1 of them is random)
int r1 = i;
int r2 = (int) (Math.random() * n);
// Swap these 2 samples
int tmp = samples[ns][r1];
samples[ns][r1] = samples[ns][r2];
... |
161fd0dc-492b-4181-9d18-8a383aaf058b | 1 | public void add(String prompt, UIMenuAction action) {
if (null == action)
throw new IllegalArgumentException();
_menu.add(new UIMenu.Pair(prompt, action));
} |
f1fe2dfe-6adc-4f30-a2bf-70fef8618011 | 7 | private int getScore(Point[] points) {
int playerone = 0;
int playertwo = 0;
for (int i = 0; i < points.length; i++) {
if (points[i].getState() == Board.PLAYER_ONE) {
playerone++;
}
else if (points[i].getState() == Board.PLAYER_TWO) {
playertwo++;
}
}
if ( (playerone+playertwo... |
0036e7ec-ae64-4f79-a3b8-668fe3be3f0a | 1 | private void init() {
for (int i = 0; i < CAPACITY; i++) {
arr[i] = null;
}
topPtr = CAPACITY;
} |
870e71cf-917e-4646-a08f-3daca2ade513 | 1 | @Override
protected Object encode(ChannelHandlerContext ctc, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof Message)) {
return null;
}
byte[] data = ((Message) msg).toBytes();
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
buf.writeBytes(data); // data
return buf;
} |
ff6a5dd2-308b-4c70-9bea-1606996474b3 | 4 | public static void main(String[] args)
{
System.out.println("Starting Example10");
try
{
// First step: Initialize the GridSim package. It should be called
// before creating any entities. We can't run this example without
// initializing GridSim first. We... |
3c691626-82a5-46ae-91b5-eca70a86b63b | 2 | public String toString()
{
String graveInfo = "";
for (Person current : gravePeople)
{
graveInfo += current + " is buried here.\n";
}
if (isLegible)
{
graveInfo += "This marker is legible.\n";
} else
{
graveInfo += "This marker is NOT legible.\n";
}
graveInfo += moreInformation;
retur... |
3b5a63f3-a82c-46c0-b010-ca427012a58c | 7 | @Override
public void run() {
try {
ObjectInputStream input = new ObjectInputStream(this.input);
String line;
while (this.socket.isConnected()) {
line = input.readUTF();
if (line.startsWith("JOIN")) {
this.game.join(input.readUTF(), this.player.... |
32e9c191-7b5e-4f4b-a54f-6635965cb07a | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Set the MIME type for the page
response.setContentType("text/html");
// Define variables
//#####################################
String ticketNumber = request.getParam... |
1e748365-06e3-46ef-9e18-2ff1fef9d9a6 | 0 | public void setRuscus(int ruscus) {
this.ruscus = ruscus;
} |
1c63d6a1-e647-455c-ac54-7ee0836a1967 | 7 | public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {
URI uri = request.getURI();
// Is this a CONNECT request?
if (HttpRequest.__CONNECT.equalsIgnoreCase(request.getMethod())) {
response.setField(... |
c7d84073-083b-40d6-8aeb-fd4f8b5a684c | 4 | public Tile getTile(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) return new TileVoid(x, y, this);
return tiles[y][x];
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.