method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
431a7677-0b7d-4728-a1eb-a175dd74ac26 | 5 | @Override
public int hashCode() {
int hash = 3;
hash = 53 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 53 * hash + (this.fromUser != null ? this.fromUser.hashCode() : 0);
hash = 53 * hash + (this.toUser != null ? this.toUser.hashCode() : 0);
hash = 53 * hash + ... |
5768067b-1e7b-4517-839d-b267bccd82e5 | 7 | private static void exploreJar(URL location, List<URL> urls, File tmpDir,
boolean includeWarLibs) throws IOException, MalformedURLException,
URISyntaxException {
JarInputStream jar = new JarInputStream(location.openStream());
JarEntry entry = null;
while ((entry = jar.getNextJarEntry()) != nul... |
1e2a11f4-f0ca-4614-ba29-36789092c6a6 | 2 | @Override
public synchronized final void run() {
OpenDataFileCommand.enablePassThrough();
if (AppWindow.getAllWindows().isEmpty()) {
noWindowsAreOpenAtStartup(false);
if (AppWindow.getAllWindows().isEmpty()) {
noWindowsAreOpenAtStartup(true);
}
}
finalStartup();
App.setNotificationAllowed(true);... |
1dd6e110-0438-4a2a-86fc-c88bbe0ba531 | 3 | @Override
public Iterator<E> iterator() {
final LinkedList<E> liste = new LinkedList<E>();
for(int i = 0; i < table.length; i++){
Node<E> node = table[i];
while(node != null){
liste.push(node.elem);
node = node.next;
}
}
return new Iterator<E>(){
@Override
public boolean hasNext() {
... |
fbebff97-1b59-44f6-9d46-9f68f52213e9 | 3 | public static LinkedListNode add (LinkedListNode n1, LinkedListNode n2) {
// number are stored in regular order
int length_n1 = n1.length();
int length_n2 = n2.length();
LinkedListNode l = null;
LinkedListNode s = null;
int dif = Math.abs( length_n1 - length_n2 );
if ( length_n1 > length_n2 ){
... |
dccc337e-c7e7-43cc-8403-b0e5d7f6cfab | 2 | public void flushBase64() throws java.io.IOException {
if( position > 0 ) {
if( encode ) {
out.write( encode3to4( b4, buffer, position, options ) );
position = 0;
} // end if: encoding
else {
throw... |
155110e2-0539-4ba5-8ec7-13e3f14e68de | 7 | private void botton_update_databaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botton_update_databaseActionPerformed
// TODO add your handling code here:
//get and check all data form table
//consilidated_table();
int row_Count;
row_Count = bang_tim_info_SP... |
fa429253-ab10-455c-9df9-7af1f3b9778f | 1 | public byte[] getSchedule(int bytes) {
byte[] schedule = new byte[bytes];
for(int i= 0; i < bytes; i++) {
schedule[i] = payload[i];
}
return schedule;
} |
b808e6f1-2002-482d-869e-49a728c114b9 | 5 | public static void render() {
for (Chunk chunk : ChunkManager.LoadedChunksList) {
for (float i = 0; i < 8; i += 1) {
for (float k = 0; k < 8; k += 1) {
for (float l = 0 ; l < 8; l += 1) {
Block block = chunk.chunkTree[(int)i][(int)k][(int)l... |
adf0c90d-ac0f-450d-9651-7f1878aa43b8 | 8 | private void sortPerimetro(ObjetoImagem objeto) {
List<Point> sorted = new ArrayList<>();
List<Point> toSort = new ArrayList<>(objeto.getPerimetro());
Point current;
current = toSort.get(0);
sorted.add(toSort.get(0));
toSort.remove(0);
while(!toSort.isEmpty()) {... |
9e81502e-222d-4cb8-ae9f-92f9922bda1c | 3 | public static Object[] sliceFromLastBoundary(Object[] sequence, Boolean[] boundaries) {
// Find the start and end of the word, which are the last and next
// to last boundary indices. If there's only one boundary, the next
// to last is effectively -1 (start of the text)
int start = -1;
int end = -1;
for (i... |
102f8561-b84b-4cb4-85df-e1051d6a3119 | 7 | private boolean solveFirstHeuristic(){
System.out.print("- Recherche heuristique : ");
boolean modified = false;
SearchResult searchResult;
// Squares
for(int squareIndex = 0; squareIndex < matrix.getMatrixSize(); squareIndex++){
//System.out.println("Recherche pour le square " + squareIndex);
sea... |
f313362a-bc6c-467d-b430-cc4d6474712f | 4 | public Visualisation(final JFrame window) {
JPanel contents = new JPanel();
window.setMinimumSize(new Dimension(1392,1000));
window.setMaximumSize(new Dimension(1492, 1052));
visualisation = new Display();
contents.add(visualisation, BorderLayout.CENTER);
window.getConten... |
417ab2cd-82c4-49d1-b8fe-5d4e59141c0b | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Location other = (Location) obj;
if (direction == null) {
if (other.direction != null)
return false;
} else if (!direction.equals(other.... |
9c48f886-0444-4dd3-bb77-4a47b75e2282 | 7 | private static void addFormatted(XWPFParagraph p, String str, String color, Lang lang, Lang explang, NumberGender ng) {
String s = str, ss; boolean first = true;
while (StringUtils.isNotBlank(s)) {
if (s.startsWith(StringHelper.LEFTPARENTHESIS)) {
//intf.-lang.-based content
... |
4afb518d-5629-4ceb-84a4-442edeee1199 | 1 | @Override
public Object getData(Column column) {
switch (column.getID()) {
case 0:
return getName();
default:
return Integer.valueOf(mName.length());
}
} |
c7865579-92e2-4649-990b-8e44b5a839c6 | 5 | private void idCmbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idCmbxActionPerformed
String id = null;
if (idCmbx.getSelectedItem() != null) {
id = idCmbx.getSelectedItem().toString();
System.out.println(id);
}
if (id != null && !id.equals("... |
827a5311-4151-499e-8a91-36afc68c0087 | 7 | private boolean necessarySwap(DependencyStructure gold, DependencyStructure parse, DependencyNode node, Stack<DependencyNode> input) throws MaltChainedException {
DependencyNode left = node;
int index = input.size() - 1;
if (index < 0) {
return true;
}
DependencyNode right = input.peek();
int rc = -1;... |
7f14a28c-a3c8-47b3-b3a9-1e25cf2641a0 | 8 | public void RotationSpeed(Object[] speed) {
if (! (speed.length == 3 && speed[0] instanceof Double &&
speed[1] instanceof String && speed[2] instanceof String))
throw new IllegalArgumentException
("\nRotationSpeed must be number, units, and time base") ;
doubl... |
8414d56c-c015-493e-9f3e-3a18e4d3c65f | 1 | @Override
public void writeName(final StateContext context, final String name) {
StateClient.addOutput(name.toUpperCase());
/* Change state after StateMultipleUpperCase's writeName() gets invoked twice */
if(++count > globalCount) {
context.setState(new StateTwo());
g... |
33873dda-38bf-40dd-8557-d4eb5984a298 | 4 | public void saveCaveMaps() {
synchronized (caveTex) {
Coord rc = null;
String sess = Utils.sessdate(System.currentTimeMillis());
File outputfile = new File("cave/" + sess);
try {
Writer currentSessionFile = new FileWriter(
"cave/currentsession.js");
currentSessionFile.write("var currentSessi... |
18dd4feb-c83f-43c6-9494-f56eada5e058 | 9 | public static String readFile(String fileName, String srcEncoding) throws FileNotFoundException, IOException {
File file = null;
try {
file = new File(fileName);
if (!file.exists())
return "";
if (file.exists() && file.isFile() == false) {
throw new IOException("'" + fileName + "' is not a file.");... |
df935981-b0af-4d3f-8fae-e3a80029871b | 5 | final String _decodeMask_(final int type) throws IllegalArgumentException {
if (this.symbol() != type) throw new IllegalArgumentException();
for (int symbol = this.skip(); symbol >= 0; symbol = this.skip()) {
if (symbol == type) {
if (this.skip() != type) {
if (this.isParsed()) return this.target();
... |
f0c4a108-0bd6-472b-b439-a140362364d5 | 9 | public void parseRobots(InputStream in) {
String line;
String[] rule;
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
while((line = br.readLine()) != null) {
if(this.isValidDirectiveLine(line)) {
// split our line ... |
8869680a-5000-4fc6-af56-1e5a5fa25314 | 9 | private MITMAdminClient( String [] args ) {
int remotePort = 8002;
String remoteHost = "localhost";
if( args.length < 3 )
throw printUsage();
try {
for (int i=0; i<args.length; i++)
{
if (args[i].equals("-remoteHost")) {
remoteHost = args[++i];
} else if (args[i].equals("-remotePort"))... |
e15aa349-f758-4436-8c13-bf7cf9216bba | 9 | protected int getSize(long value) {
if (!tree.contains(value)) {
return -1;
}
Long next = value < Long.MAX_VALUE ? tree.ceiling(value + 1) : null;
Long prev = value > Long.MIN_VALUE ? tree.floor(value - 1) : null;
int i = 0;
if (prev != null) {
for (i = 0; i < lengthMasks.length; i++) {
if (((p... |
141d687c-1603-4a3f-a996-586255bf8517 | 5 | void refresh() {
StringBuilder sb = new StringBuilder(L);
int gapCount = line.size() - 1;
if (gapCount == 0) {
sb.append(line.get(0));
for (int i = L - sb.length(); i > 0; i--) {
sb.append(' ');
}
result.add(sb.toString());
... |
d06b9bbb-0cda-48a8-99d8-38adbc75a3f8 | 6 | private GameState preacherDay(GameState state, Card card)
{
if(state.getPlayer(card.getFaction()).checkCPU())
{
HashMap<GameState, String> choiceMap = allPreacherDay(state, card);
GameState choice = state.getPlayer(card.getFaction())
.chooseState(choiceMap.keySet().toArray(new GameState[0]), card);
... |
efffe035-6ef3-4eaf-b045-d2f4715f8bc8 | 8 | public static void deletePrefix(File file, String prefix) throws Exception {
File tempFile = File.createTempFile(file.getName(), ".tmp");
tempFile.delete();
tempFile.deleteOnExit();
file.renameTo(tempFile);
byte[] buffer = new byte[1024];
ZipInputStream zipInputStream = null;
ZipOutputStream zipOutputStr... |
9a390cbc-cd92-48f3-9934-dfdcaab51933 | 2 | public void addBid(String username, Double bid) throws BidException {
if (username.equals(vendor)) {
throw new BidException("You cannot bid on your own item!");
}
Bid newBid = new Bid(username, bid);
Bid highBid = getHighestBid();
if (newBid.compareTo(highBid) <= 0) {
throw new BidException("Sorry, ... |
4aec32dc-778e-46f0-b19d-695b8880a6d2 | 5 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int nTest = in.nextInt();
Edmons_karp f;
for (int i = 0; i < nTest; i++) {
int nNodes = in.nextInt();
f = new Edmons_karp(nNodes);
for (int j = 0; j < nNodes - 1; ... |
38e6216f-8cf7-42ca-be00-54d7c402ef7c | 2 | @Override
public String toString()
{
StringBuilder strB = new StringBuilder();
if(isText())
{
strB.append("Text Element\n");
strB.append("[");
strB.append(text);
strB.append("]");
}
else
{
strB.append("Element <");
strB.append(name);
strB.append(">\n");
for(Entry<QName, ... |
3d3d1249-a995-49c4-8c2e-bc55a3dc5eb0 | 0 | public List<IBomber> getBombers() {
return bombers;
} |
21af2cf7-588a-4e73-a4ce-96611a06976e | 3 | @Override
public void run() {
while (this.isRunning) {
try {
// Tell model to update, send next key press.
// or 0 if no new keypress since last update.
this.gameModel.gameUpdate(nextKeyPress());
this.view.repaint();
Thread.sleep(this.updateInterval);
} catch (GameOverException e) {
/... |
0abd6bb0-6a64-4c32-b468-2db237051828 | 8 | public void run() {
// TODO Auto-generated method stub
try {
if("multi".equals(type))
{
for(int i=0;i<Student.studentListAudio.size();i++)
{
if(!Student.studentListAudio.get(i).ip.equals(ServerFrame.currentlySpeakingip))
{
client_speak = new Socket(Student.studentListAudio.ge... |
30b15477-fc6d-4597-9ca0-2e9d50219bf4 | 4 | public static void main(String[] args) {
ArrayList<Person> listPeople = new ArrayList<Person>();
ArrayList<String> fromList = new ArrayList<String>();
fromList = FileHandlerStat.load("people.txt");
if(fromList == null){
System.out.println("Something went wrong... lo... |
07ec617b-cf3b-4013-8789-53228a26a7b8 | 0 | @Override
public boolean propertyExists(String key) {
return current_values.containsKey(key);
} |
abca6458-08bf-441e-ad2a-a0146b315594 | 9 | protected static ByteBuffer decode(PDFObject dict, ByteBuffer buf,
PDFObject params) throws PDFParseException
{
// System.out.println("DCTDecode image info: "+params);
buf.rewind();
// copy the data into a byte array required by createimage
byte[] ary = new byte[buf.remaini... |
dbef7ec9-dbc9-4436-9dd5-5a716268bd8f | 1 | public ArrayList<GameObject> GetAllAttached()
{
ArrayList<GameObject> result = new ArrayList<GameObject>();
for(GameObject child : m_children)
result.addAll(child.GetAllAttached());
result.add(this);
return result;
} |
21d2dc6b-ccb5-4e23-85f7-fae07d1e10ca | 8 | public static Character escapeChar(char c) {
switch(c) {
case '\n':
case '"':
case '\'':
case '\\':
return c;
case 'n':
return '\n';
case 't':
return '\t';
case 'r':
return '\r';
case '0':
... |
24c8baa3-57da-4b27-bb30-9e7c15a72d09 | 6 | public int getMax(int start,int end){
if(this.start == start && this.end == end) return maxVal;
int mid = (this.start + this.end)/2;
if(start <= mid && end <= mid) return left.getMax(start,end);
if(start > mid && end > mid) return right.getMax(start,end);
retu... |
a80e1744-63b4-4e44-897e-a614b8711509 | 1 | public void setTransient() {
for(int i = 0; i < dropChances.size(); i++) {
dropChances.get(i).setTransient();
}
} |
48ba46c4-fbe5-4323-8c3a-d2f51a0d3d69 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ImgTag)) {
return false;
}
ImgTag other = (ImgTag) obj;
if (tagname == null) {
if (other.tagname != null) {
return false;
}
} else if (!tagname.eq... |
68c78d63-b592-49f9-8390-173846ee4050 | 6 | private String compileFactor(Node factor) throws CompilationErrorException {
StringBuilder builder = new StringBuilder();
if (factor.getNodeType() != NodeType.FACTOR) {
builder.append(compilePower(factor));
} else {
builder.append(compilePower(factor.getChild(0)));
... |
42752c58-44bc-431f-9f88-b1b15b9fa83f | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof ActionAndLocation))
return false;
ActionAndLocation other = (ActionAndLocation) obj;
if (action == null) {
if (other.action != null)
return false;
} else if (!acti... |
6a34593e-88d1-4acc-a5f8-d644d11e7a07 | 7 | public static void main(String[] args) throws Exception{
final int TOTAL_COUNT = 200;
String outputPath = "C:/z-ling/task/HEY/ResultTest/dataset.txt";
FileOutputStream fos=new FileOutputStream(outputPath);
OutputStreamWriter osw=new OutputStreamWriter(fos);
BufferedWriter... |
1b5d0ff7-9584-46f1-babf-41aebc5fe6a5 | 5 | public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... |
e5e3ec8f-10ec-4aeb-a77a-f64d064d1314 | 2 | @Override
public int entryCount(String word) {
int entryCount = 0;
for(String entry : internalStorage) {
if(entry.equals(word)) {
entryCount++;
}
}
return entryCount;
} |
25c5a480-6e41-49c1-b46e-15c15a37cb0d | 8 | public void putAll( Map<? extends Long, ? extends Character> map ) {
Iterator<? extends Entry<? extends Long,? extends Character>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Character> e = it.next();
this.put(... |
7df3bf29-28f7-46f0-9823-cece8152051f | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 174
v_1 = limit - cursor;
// tomark, line 174
if (cursor < I_pV)
{
return false;
}
... |
bfc98685-1837-4653-b003-41ef81903456 | 6 | @Override
public boolean mutate(Mutation.Type type) {
switch (type) {
case SWAP:
case CREATE_PARENT:
case REPLICATE:
return false;
case REMOVE:
return Mutation.removeMust(this);
case COPY_TREE:
return Mutation.copyMustTree(this);
case COPY:
return Mutation.copy(this);
default:
throw new ... |
b3ef1858-e13a-452b-acbf-befb47b9d448 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btnCerrar = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new j... |
18026836-6cf5-4ce7-9067-4d0e5e06c9cb | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(true);
... |
afc16858-4de5-4fe6-bea5-e8fae2956e9d | 0 | public static void process(Processor p, Object s) {
System.out.println("Using Processor " + p.name());
System.out.println(p.process(s));
} |
500edfb8-0b6f-4e40-8a09-47a9c0fcbb6b | 9 | private ListPanel getTimeSheetByAlarmId(int alarmId)
{
ArrayList<Time_Sheet> timeSheet = new ArrayList<Time_Sheet>();
ArrayList<Time_Sheet> timeSheetStatinsduty = new ArrayList<Time_Sheet>();
ListPanel list = new ListPanel(parent.getWidth());
try {
timeSheet = tsa.getData... |
6914bd81-c1d7-4d31-a627-a31e9f3bcde7 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Address other = (Address) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))... |
5e15a524-5756-4b3f-b1f2-632935e94fe7 | 8 | public synchronized void acceptMessage(Date time, OSCMessage message) {
Object[] args = message.getArguments();
if (args == null) {
return;
}
// only act if the message has our monome prefix
if (!message.getAddress().contains(monome.prefix)) {
return;
}
if (message.getAddress().contains("/grid/key")... |
0fe09018-9fe1-456a-b69c-0500ba4be2ea | 6 | @Override
public <A extends Annotation> Object getValue(Class<A> type, String name) {
try {
Method valueMethod = type.getMethod(name);
if (!annotationValues.containsKey(valueMethod)) {
// Fill in annotation value
try {
A annotatio... |
490cc328-453e-4625-921d-d723fe611044 | 8 | public static void sanitizeViews(Map<Address,View> map) {
if(map == null)
return;
for(Map.Entry<Address,View> entry: map.entrySet()) {
Address key=entry.getKey();
List<Address> members=new ArrayList<>(entry.getValue().getMembers());
boolean modified=false;... |
d1528e3e-4584-49aa-aece-1e3ea18ff887 | 6 | public static void deleteListeners() {
EventManager evt = getEventManager();
if (evt == null) {
return;
}
evt.removeListener(self);
if (Script.paint != null) {
evt.removeListener(Script.paint);
}
if (Script.motion != null) {
evt.removeListener(Script.motion);
}
if (Script.mouse != null) {
... |
27469ac9-750a-42e3-a492-3054b454c95b | 6 | private static Image createIcon(Component component, Color color) {
int rgb = color.getRGB();
int[] pix = new int[12 * 12];
for (int x = 0; x < 12; x++) {
for (int y = 0; y < 12; y++) {
pix[x + y * 12] = ((x > 0) && (x < 11) &&
(y > 0) && (y < 11)) ? rgb : 0xff666666;
}
}
return component.creat... |
8c9389fa-d229-4fc6-9eed-1c511bbdb2aa | 3 | public boolean equals( Match other )
{
if ( this.version != other.version
|| this.length != other.length
|| this.offset != other.offset )
return false;
else
return true;
} |
9647a6f2-8ee5-48d2-8ccb-461d09cc4cf9 | 2 | public void removeObserver(ObservableStreamListener observer)
{
if (observers != null && observers.contains(observer))
{
observers.remove(observer);
}
} |
fcb27195-3724-4fed-b1a5-c1bf04736b6e | 5 | @Override
public void itemStateChanged(ItemEvent e) {
Object source = e.getItemSelectable();
if (source == view.enableRelative) {
if (centerZoom) {
centerZoom = false;
} else {
centerZoom = true;
}
}
else if (source ... |
5f58b515-93aa-46a4-b48f-22505b854a7b | 0 | public SkipWhileIterable(Iterable<T> source, Predicate<T> predicate)
{
this._source = source;
this._predicate = predicate;
} |
c56ef640-f62c-4b36-a1d3-91f8543d3706 | 4 | public static Property constructBlankPropertyByType(String name){
if(!Types.containsKey(name))
return null;
try {
Class<? extends Property> clazz = Types.get(name);
return clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
return null;
} catch (IllegalAccessExcepti... |
ce3b4541-82b3-40a2-8b64-bb0dad311fed | 8 | public static void main(String[] args) throws Exception {
getStateCode();
getDistrictCode();
getLocationCode();
getStatusCode();
ICsvBeanReader beanReader = null;
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(
"E:\\Android\\workspace\\OfflinePinFinder\\app\\src\\main\\assets\\sql\\... |
9cb1cfb4-5410-43a3-a1c7-68865d088b26 | 3 | @Override
public int[] sort(int[] a) {
this.a = a;
for (int i = 0; i < a.length; i++) {
for (int j = i; j > 0; j--) {
if(a[j] < a[j - 1]) swap(j, j - 1);
else break;
}
}
return a;
} |
6da314d4-4db3-4b54-b381-4298b962d2e9 | 5 | void checkObjectiveCount(){
setPrimitiveObjectives();
if (prim_obj.size()<2)
pnlCon.constPane.setEnabledAt(1, false);
else
pnlCon.constPane.setEnabledAt(1, true);
double weights=0.0;
for (Iterator it = prim_obj.iterator(); it.hasNext();){
JObjective obj = (JObjective)it.next();
if (!obj.getWeight(... |
f0583df3-29e5-423d-a843-74f5d3194d78 | 4 | protected static ArtifactType disambiguateExtendedType(Entry entry, ArtifactType artifactType) {
String et = artifactType.getExtendedType();
boolean convertToDocument = false;
// Dis-ambiguate the extended types (or try to)
if (entry.getContent() != null) {
convertToDocument ... |
528a42bb-1cdf-437a-b24e-0abc88e62ada | 0 | public MessageBoard() {
this.messages = new ArrayList<Message>();
} |
b302795d-d281-40a2-8f77-b73dd79deebc | 3 | public JPopupMenu makeConstructorMenu(Collection<Class> classes,
Location loc)
{
this.currentLocation = loc;
JPopupMenu menu = new JPopupMenu();
boolean first = true;
Iterator<Class> iter = classes.iterator();
while (iter.hasNext())
{
if (first... |
c499dfbc-468c-4285-b521-641d4f572559 | 1 | public Toucan(Inet4Address ip) {
//EnableTask handles sending the JaguarPacket, EnablePacket out on time
//UDPReceiver handles receiving StatusPacket
try{
broadcastIP = ip; //Inet4Address.getByName("10.10.0.121");
receiver = new UDPReceiver(1218);
threadPool.execute(receiver);
e... |
35bccaf0-676b-4bf0-bce2-e9b7f28b8060 | 4 | public static BufferedImage perlinImage(int width, int height,int octave)
{
BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
float[][] perlin = GeneratePerlinNoise(GenerateWhiteNoise(width,height,(int) System.currentTimeMillis()),oct... |
dd4e350b-0eda-49ce-8675-54c2e7a16b4f | 6 | public static Location stringToLoc(String s){
if(s == null) return null;
StringBuilder sb = new StringBuilder();
for(char c : s.toCharArray()){
if(c == '*') sb.append(';');
else sb.append(c);
}String[] parse = sb.toString().split(";");
if(parse.length != 6) return null;
String worldName = parse[0];
... |
c706a55c-49df-4b5f-b523-1a4c5720368c | 8 | protected static byte getMask(int shiftValue) {
int mask = 0x00;
switch (shiftValue) {
case 0: {mask = 0xFF; break;}
case 1: {mask = 0x7F; break;}
case 2: {mask = 0x3F; break;}
case 3: {mask = 0x1F; break;}
case 4: {mask = 0xF; break;}
... |
b228ad7a-bddb-4f7c-ba26-acd9f606d0d3 | 2 | private void writeString(List<Byte> ret, String val) throws EncodingException
{
byte[] temp = null;
try
{
temp = val.getBytes("UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new EncodingException("Unable to encode string as UTF-8: " + val);
}
writeInt(ret, (temp.length << 1) | 1);
... |
c6b56c57-82b2-4dda-91a4-7e31c752c696 | 5 | public void place(Board b) {
int y = 0;
boolean added = false;
while (!added) {
int x = 0;
while (!added && x < y) {
b.setLocation(x * 504, y * 168);
added = this.add(b);
x++;
}
y = 0;
if (!added && y <= x) {
b.setLocation(x * 504, y * 168);
added = this.add(b);
y++;
}
... |
03422687-600f-4dd9-aab0-3e0c05b5adbc | 8 | @EventHandler
public void onSignCreate(SignChangeEvent sign)
{
Player player = sign.getPlayer();
if (player.hasPermission("EasyPvpKits.Sign.Create"))
{
if (sign.getLine(0).equalsIgnoreCase("[EPK]"))
{
if (sign.getLine(1).equalsIgnoreCase("Pvp"))
{
sign.setLine(1, ChatColor.DARK_BLUE + "[Pvp]"... |
d2334c77-7abf-4bc7-84f9-dba3f25a6898 | 3 | private void checkEdgesHaveEvenDegree() {
// check that all vertices have an even number of edges
// and that the graph is directed
if (graph.isDirected()) {
countAccess(1);
throw new IllegalArgumentException("Graph may not be undirected");
}
for (Long v : graph.getVertexes()) {
countAccess(1);
if... |
ad7b5a73-8bd1-4e6c-8bc9-558fba9629ed | 4 | public void remove(Recipe n) {
if (bevat(n)) {
if (head.getNext() == null) {
head = null;
} else {
LNode finger = head;
LNode previous = null;
while (!(finger.getElement().equals(n))) {
previous = finger;
finger = finger.getNext();
}
if (finger != head) {
LNode k = finger.... |
a6602c8c-1993-44dc-a1db-2f905f59e0cf | 8 | private BinaryNode<K> search(K pk){
// System.out.println("Aquitoy");
BinaryNode<K> current = this.root;
@SuppressWarnings("unused")
BinaryNode<K> previous = new BinaryNode<K>();
while(current.getData() != pk){
//Conditions of insert
if((Integer)pk > (Integer)current.getData() &... |
70c5b9d7-f78e-4cfd-b253-aaf263f4a877 | 0 | public void method1()
{
System.out.println("method1");
} |
0f9d9cb3-90d6-45a0-a3aa-ed31dec72424 | 9 | public void drawTrail(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(2));
while (!mousePath.isEmpty() && mousePath.peek().isUp()) {
mousePath.remove();
}
Point clientCursor = Mouse.getLocation();
mousePathPoint mpp = new mousePathPo... |
581b87e4-3ea3-4eaa-8ec6-d9a346fe8e4b | 8 | private void CommandNewLibrary( Class libraryClass )
{
initialized( SET, false );
String headerMessage = "Initializing ";
if( soundLibrary != null )
{
currentLibrary( SET, null );
// we are switching libraries
headerMessage = "Switching to... |
885e8453-e5f5-47a4-89ab-7f640aa25571 | 7 | public void setCurrentFeatures(String currentFeatures) {
switch(Integer.valueOf(currentFeatures) & 127){
case 1:
this.currentFeatures = " - 10 Mbps";
break;
case 2:
this.currentFeatures = " - 10 Mbps FDX";
break;
case 4:
this.currentFeatures = " ... |
86185401-58b3-4377-86fa-fb2be9a79ee8 | 5 | public void loadObject(String fullPath) {
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(fullPath);
ois = new ObjectInputStream(fis);
Object obj = ois.readObject();
SerialDTO dto = (SerialDTO)obj;
System.out.println(dto);
} catch (Exception e) {
e.pri... |
1bd7ee56-cb38-460f-a620-198889809cc4 | 4 | public double get(int i, int j){
if ((i>0)&&(i<=rows)&&(j>=0)&&(j<=columns)){
return elements[i-1][j-1];
}else{
System.out.println("got wrong indices, or matrix was not initialized");
return -1;
}
} |
2237fdbf-d2c7-4714-a41c-c1e3c76a02fe | 5 | @Override
public Account findAccountByAccountId(int accountId) {
Account account = null;
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_BY_ACCO... |
ec35df50-a76f-4b18-b817-cf0e7300d200 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Post)) return false;
Post post = (Post) o;
if (!author.equals(post.author)) return false;
if (!postedAt.equals(post.postedAt)) return false;
if (!title.equals(post.title)) ret... |
ea571ef8-463e-49b4-93a0-0455bf5bd398 | 1 | @Test
public void runTestFieldSensitivity4() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_FieldSensitivity4.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} |
aff00f35-8a41-445e-a583-01443526aca6 | 5 | @Override
public boolean execute(final CommandSender sender, final String[] split) {
if (sender instanceof Player) {
if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) {
if (!MonsterIRC.getHandleManager().getPermissionsHandler()
.hasCommand... |
38c60bff-5834-4f59-b80e-88ba8277ac7f | 1 | public static void main(String[] args) {
if(args.length != 1) {
System.err.println("Gebruik: java Opgave5 'filenaam'");
return;
}
inlezenFile(args[0]);
} |
72680a37-a4e0-4e46-a5a9-e2887652776d | 4 | public GameBoardGraphics(Grid grid, Player player1, Player player2)
throws IOException {
boolean test = false;
if (test || m_test) {
System.out
.println("GameBoardGraphics :: GameBoardGraphics() BEGIN");
}
addMouseMotionListener(this);
m_player1 = player1;
m_player2 = player2;
PLAYER1_COLOUR = ... |
dc3f5ee3-946e-4251-955d-d5f7d9a1affa | 8 | public void keyPressed(KeyEvent e) {
char keychar = e.getKeyChar();
int keycode = e.getKeyCode();
if (keycode>=0 && keycode < 256) {
keymap[keycode]=true;
lastkey=keycode;
lastkeychar=keychar;
if (wakeup_key==-1 || wakeup_key==keycode) {
if (!eng.isRunning()) {
eng.start();
// key is cle... |
382031ab-2a70-48ce-9816-d9c1c00f596d | 4 | public static void main(String[] args) {
JFrame frame = new JFrame(FRAME_TITLE);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.add(new Game());
frame.setVisible(true);
try {
UIManager.setLookAndFeel(UIMan... |
5dba13fe-b5de-4760-83e4-656b406c6f67 | 7 | private void generateReport(Date startDate, Date endDate, CategoryRecord category,
int sortMode) throws ReportException {
//
// Create the report data model
//
ReportModel reportModel = new TransactionModel(startDate, endDate, category, sortMode);
... |
09cf1f72-72be-4742-85bd-3825f7d37825 | 6 | private static boolean b2(int i, int j, BufferedImage image) {
Boolean left = ((image.getRGB(i-1, j-1) == BLACK) ||
(image.getRGB(i-1, j ) == BLACK) ||
(image.getRGB(i-1, j+1) == BLACK));
Boolean with = ((image.getRGB(i , j-1) == WHITE) &&
... |
7301fe5b-358d-42fc-805e-dc482516b614 | 5 | @SuppressWarnings("unchecked")
final public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
Iterator keys = keys();
writer.write('{');
while (keys.hasNext()) {
if (b) {
writer.write(',');
... |
64b55bb3-8c85-49c4-a9b9-c9f3589d1436 | 9 | private List getAllOverlaps(ProjectList pl, Project toBeAssignedProject){
Project p;
Project p2;
pl.goToFrontOfList();
//Secondary list. We need this list since we're gonna be parsing through it a couple of dozen times.
ProjectList plist2 = pl;
List allOverlaps = new... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.