method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
00c2bbf1-4b03-48ae-8c02-95a5abe7f0d8 | 7 | protected int parseComment() throws IOException {
// Either we are in a single-line comment or
// a multiline comment... we can tell by the next character
int c = read();
if( c == '/' ) {
// Continue to the EOL
while( (c = read()) >= 0 ) {
// The ... |
f8d320ca-caa9-4f6c-be36-6ed4f7d6de8d | 7 | protected void switchToBars() {
if (m_plotSurround.getComponentCount() > 1 &&
m_plotSurround.getComponent(1) == m_legendPanel) {
m_plotSurround.remove(m_legendPanel);
}
if (m_plotSurround.getComponentCount() > 1 &&
m_plotSurround.getComponent(1) == m_attrib) {
... |
f5526847-5cd2-4489-b5a5-e5a0d9ed7daf | 8 | public static void generateHashTable() throws Exception {
File logDir = new File(logDirectory);
if (!logDir.isDirectory()) {
System.err.println(logDir.getPath() + " is not a dir");
System.exit(-1);
}
File[] files = logDir.listFiles();
for (File file : fil... |
74f97710-7edc-492f-bd78-22fa13dc59e4 | 2 | private void combo_tasksItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_combo_tasksItemStateChanged
//заносим в глобальную переменную текущий ID дела
try
{
Globals.idCurrentTask = Integer.parseInt(String.valueOf(combo_tasks.getSelectedItem()));
}
cat... |
fb3ce30a-c831-439a-b4fc-db64e64010e9 | 2 | private void expurgate(Collection c, String strAuthor) {
for (Iterator i = c.iterator(); i.hasNext();) {
if (((String) i.next()).contains(strAuthor)) {
i.remove();
}
}
} |
4dda7a3a-5c75-441c-9171-ec9de4014471 | 6 | private static BufferedImage[][][] createImagesProt()
{
BufferedImage[][][] bilder = null;
BufferedImage[] imgs0 = Bilder.protN;
BufferedImage[] imgs1 = Bilder.protE;
BufferedImage[] imgs2 = Bilder.protS;
BufferedImage[] imgs3 = Bilder.protW;
BufferedImage[] imgs4 = ... |
086ad649-102f-4acb-afb6-c08c2ff3da0b | 3 | static void startExecution(final HashMap<TestRunner, ArrayList> testMap,final Boolean persist) {
for (Map.Entry<TestRunner, ArrayList> entry : testMap.entrySet()) {
final TestRunner tr = entry.getKey();
final ArrayList<Test> tList = entry.getValue();
try {
... |
f48c8f82-c550-4fe6-9f89-ced5b195168f | 3 | private void sort() {
timeKeyArray.clear();
for(int i=0; i<userArray.size(); i++) {
User user = userArray.get(i);
String[] timeKey = user.getTimeKey();
int monthNum = user.getMonthNum();
for(int j=0; j<monthNum; j++) {
if(!timeKeyArray.contains(timeKey[j])) {
timeKeyArray.add(timeKey[j]);
}... |
9ec418fd-0887-4d5a-916f-3a99e3f4ad30 | 8 | public void renderProjectile(int xp, int yp, Projectile p) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < p.getSpriteSize(); y++) {
int ya = y + yp; // ya = actual y position
for (int x = 0; x < p.getSpriteSize(); x++) {
int xa = x + xp; // ya = actual y position
if (xa < -p.getSpriteSize() || ... |
b7712b0d-d210-4b89-936a-1156ea7fc403 | 9 | public void loadPuzzle(String difficulty)
{
File file;
if(difficulty.equals("Easy"))
{
file = new File("easy9x9.txt");
}
else if(difficulty.equals("Medium"))
{
file = new File("medium9x9.txt");
}
else if(difficulty.equals("Hard"))
{
file = new File("hard9x9.txt");
}
else
{
file = ne... |
ee7f7a5c-56b8-4a28-9888-e4a04f0014b7 | 3 | protected void changerSelection(VueNoeud vueNoeud){
vNSelectionne = null;
Iterator<VueNoeud> itVN = vueNoeuds.iterator();
while(itVN.hasNext()){
VueNoeud vN = itVN.next();
if(vN.equals(vueNoeud)){
vN.setEstSelectionne(true);
vNSelectionne =... |
d743b23d-9c9c-4cdd-8f31-e50ac3db0961 | 4 | public boolean setOthelloButton(JButton newOthello) {
boolean test = false;
if (test || m_test) {
System.out.println("GameSelecter :: setOthelloButton() BEGIN");
}
m_othello = newOthello;
if (test || m_test) {
System.out.println("GameSelecter :: setOthe... |
6bdc7fd2-e2b3-4794-a283-0759d1cb65a2 | 0 | public void wakeUp() {
// do nothing
} |
40ec898c-1b0d-46b0-a814-ccdd660d720b | 5 | private DefaultMutableTreeNode listFile(File file, DefaultMutableTreeNode node){
int count = 0;
if(file.isFile())
return new DefaultMutableTreeNode(file.getName());
else{
File[] list = file.listFiles();
if(list == null)
return new DefaultMutableTreeNode(file.... |
df84fbe2-d3c9-42c6-b914-686cf747d864 | 0 | public void destroy() {
// TODO Auto-generated method stub
} |
6f5fe66c-2a12-4d95-a713-eae830c87aed | 1 | public String getExtension() {
if(this.getFile()==null)
return null;
return MediaFileUtil.getFileExtension(this.getFile());
} |
d4a1aa72-95a2-4883-9b69-6006bd5bb529 | 6 | private String nextQuotedValue(char quote) throws IOException {
// Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access.
char[] buffer = this.buffer;
StringBuilder builder = new StringBuilder();
while (true) {
int p = pos;
int l = limit;
/* the index of ... |
e1be406e-e3d9-4a91-8a1e-5476124f73c3 | 0 | public void add(CsvValue value) {
this.lines.add(value);
} |
92f64445-a254-44a8-926a-1eea7ddc3a5b | 4 | public static final void exampleAssertionManipulations() {
System.out.println("Starting assertion examples.");
try {
CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator");
CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE");
access.setCyclist(cyc... |
99aac45a-b51b-4e92-9a01-80bbb44d6f0d | 1 | public JPanel getShutdownChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.shutdownPanel;
} |
610d99b0-5dba-4234-b5e1-3bb7f9cf8eca | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In send chat handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
//TODO verify cookie method
String unvalidatedCookie = exchange.getRequestHeader... |
b3afd49a-e2d6-4bdb-973f-aeeb8f060410 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LatLonPoint other = (LatLonPoint) obj;
if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude))
return false;
if (D... |
913ba6c9-298a-4763-a66b-337b7c23150a | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i ... |
8fdd343f-f89e-4dc7-9b2e-fd6b0d757afd | 1 | @Override
public void valueChanged(ListSelectionEvent e) {
if (lstProductTypes.getSelectedValues().length == 1) {
btnEdit.setEnabled(true);
btnDelete.setEnabled(true);
}
else {
btnEdit.setEnabled(false);
btnDelete.setEnabled(false);
}
} |
ccd56a6b-cf03-4a6b-a2e7-88dcd0cab64c | 2 | private void loadFeatureFromFile(String featureFile) throws IOException
{
FileReader fr = new FileReader(featureFile);
BufferedReader br = new BufferedReader(fr);
String line = null;
while((line = br.readLine()) != null)
{
String[] tks = line.trim().split("[\t]+");
int fid = Integer.parseInt(tks[0]);
... |
489c6d20-4209-4ba7-9897-7a6aa8c6c482 | 3 | @Test
public void testUniqueMessageForEachClient() {
try {
int noOfSubscribers = 2;
final AtomicInteger msgCount = new AtomicInteger(0);
final String message = "TestMessage-testUniqueMessageForEachClient";
final CountDownLatch gate = new CountDownLatch(noOfSubscribers);
final Message expected = new Mo... |
bff41b26-264e-40a4-8608-3512412d3b68 | 9 | public void play() {
this.initialize(this.p1, this.p2);
Location attempt;
int currentPlayer = 1;
// repeat until game ends (method will return)
while (true) {
if (this.moveAvailable(currentPlayer)) {
this.output.println(this.board.toString());
this.output.println("Player " + currentPlayer + ":... |
6aebcc85-1a3a-4f03-8776-c50badbf0dc5 | 9 | @Override
public void onChange(int identifier, int value) {
if(identifier == GLTexture.FILTER_SMOOTH_MIN && this.smooth)
{
this.bind();
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER,
Globals.getTextureFilerSmoothMin());
this.unbind();
}
else if(identifier == GLTexture.FILTE... |
f64f27f7-35d2-4eea-99b7-1cd5eb4faae8 | 0 | public void mouseClicked(MouseEvent event) {
//do nothing
((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).restoreStatus();
// getView().repaint();
} |
40e75ff3-5722-4847-bb37-20bbf819ce70 | 3 | private void loadAvalibleKompetenser() {
cbAvalibleKompetenser.removeAllItems();
try {
ArrayList<String> komptemp = DB.fetchColumn("select kid from kompetensdoman");
ArrayList<Kompetensdoman> komp = new ArrayList<>();
for (String st : komptemp) {
komp.... |
56a36cb5-8387-4524-b399-48c0eedffd17 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TipoUsuario)) {
return false;
}
TipoUsuario other = (TipoUsuario) object;
if ((this.codtipousuario == null && o... |
6c20c42e-a5e2-47a3-8718-59800cb956d7 | 4 | @Override
public boolean hasInteractable(Interactable interactable)
{
for(Component component: components())
{
if(component instanceof InteractableContainer)
if(((InteractableContainer)(component)).hasInteractable(interactable))
return true;
... |
801f91f6-79d9-4ef6-a777-fcc9bb30600a | 4 | public final int compare(Object o1, Object o2)
{
TLanguageFile p1 = null ;
TLanguageFile p2 = null ;
try
{
p1 = (TLanguageFile) o1 ;
p2 = (TLanguageFile) o2 ;
}
catch (Exception e) {}
int back = 0 ;
if ((p1 != null) && (p2 != null))
{
... |
d95eb22b-5cbd-4839-854f-15ea67a9df95 | 1 | public Teacher(int aID, String aFirstName, String aLastName, Field[] aFields, Time aMWWH) {
this.firstName = aFirstName;
this.lastName = aLastName;
// Fields
this.fields = new ArrayList<Field>();
for (Field field : aFields)
this.fields.add(field);
this.maxWeekWorkedHours = aMWWH;
this.students ... |
fccef582-8ce1-4607-92b2-66a967f1ff2c | 4 | @Override
public void keyReleased(KeyEvent ke) {
if(ke.getKeyCode() == KeyEvent.VK_LEFT){
left = false;
} else if(ke.getKeyCode() == KeyEvent.VK_RIGHT){
right = false;
}
if(ke.getKeyCode() == KeyEvent.VK_UP){
up = false;
} else if(ke.getKeyCode() == KeyEvent.VK_DOWN){
down = false;
}
} |
6b7da91e-f5f2-4f58-ab1a-e7339ecf06b0 | 0 | public OsobaDialog(Component parent) {
super();
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle("Edycja danych osobowych");
setSize(400, 500);
setLocationRelativeTo(parent);
setModal(true);
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraint... |
b735cf42-1a9d-4e49-a148-cc966954a116 | 7 | public static void performCommand(final ProcessBuilder pb) throws IOSException {
pb.redirectErrorStream(true);
StringBuilder joinedCommand = new StringBuilder();
for (String segment : pb.command()) {
joinedCommand.append(segment + " ");
}
System.out.printf("Executing '%s'\n", joinedCommand.toString().tr... |
187dd206-fbc0-4b61-895d-f279db13bddd | 7 | @Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if(gameState == 0) { // Main Menu
menuControlsBuffer.enqueue(key);
return;
}
if(key == KeyEvent.VK_LEFT) {
moveRight = false;
moveLeft = true;
} else if(key == KeyEvent.VK_RIGHT) {
moveLeft = false;... |
b400e365-34a4-4cd0-a96d-80983b744103 | 3 | public static Image anisotropicDiffusion(Image original, int iterations, BorderDetectorFunction pf) {
Image diffused = original.shallowClone();
for(int i = 0; i < iterations; i++) {
for(int x = 0; x < diffused.getWidth(); x++) {
for(int y = 0; y < diffused.getHeight(); y++) {
diffusePixel(original, diff... |
0fd53a18-149c-408d-99f9-a4aef3ebfaeb | 4 | public String mapDesc(String desc) {
Type t = Type.getType(desc);
switch (t.getSort()) {
case Type.ARRAY:
String s = mapDesc(t.getElementType().getDescriptor());
for (int i = 0; i < t.getDimensions(); ++i) {
s = '[' + s;
}
... |
97f1ee11-6c1a-4e1d-a4e0-60bac339747e | 4 | @Override
public void keyReleased(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.VK_P)
new PlayButtonCallback().invoke();
else if (event.getKeyCode() == KeyEvent.VK_H)
new HighScoresButtonCallback().invoke();
else if (event.getKeyCode() == KeyEvent.VK_S)
... |
a83b4dae-101a-4db2-af93-d28c91054812 | 6 | @Override
public boolean equals (Object other){
if (other == null) return false;
if (other == this) return true;
if (!(other instanceof Solution))return false;
Solution c = (Solution)other;
if(c.weapon.equals(weapon) &&c.person.equals(person)&&c.room.equals(room))
return true;
return false;
} |
c751a50c-f1b0-4d69-9467-b7ff3e3d36eb | 4 | public ArrayList<Move> getRegularMoves(Board currentBoard, boolean onlyChainable, Checker checker) {
//List of possible moves.
ArrayList<Move> moves = new ArrayList<Move>();
//Add all regular moves to the list.
moves.add(new ForwardLeft(currentBoard, checker));
moves.add(new ForwardRight(currentBoard, chec... |
59f55fe4-e138-4376-8f84-edd48fdf2fae | 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 fe... |
8a8fc2c9-2922-4684-9064-b28499fcf774 | 5 | public static Map<String, LinkedList<Repository>> loadRepositoryMap() {
File file = new File(REPOSITORY_FILE);
if(file.exists() && !file.isDirectory()) {
try {
Map<String, LinkedList<Repository>> map = new HashMap<String, LinkedList<Repository>>();
InputStream stream = new FileInputStream(file);
Json... |
d370a9c8-d1a9-456a-8a98-7aabe56cc7bf | 3 | @Override
public Component getListCellRendererComponent(JList<? extends ICPBrasilCRL> jlist, ICPBrasilCRL e, int i, boolean isSelected, boolean bln1) {
String text = null;
String[] split = e.getIssuerX500Principal().toString().split(",");
for (String s : split) {
if (s.contains("... |
d8a62567-fc44-44c4-bc3c-c3bfdf16b256 | 5 | public void update() {
SpielfeldFeldZustand zustand = getModel().getFeldZustand(getZeile(),getSpalte());
if (zustand==SpielfeldFeldZustand.BESETZT1)
kreis.setFill(farbeSpieler1);
if (zustand==SpielfeldFeldZustand.BESETZT2)
kreis.setFill(farbeSpieler2);
if (zustand==SpielfeldFeldZustand.LEER_UND_BESETZBAR1... |
fe52dc6e-5b99-46e2-ae29-d74427937c47 | 2 | public void drawChessBoard() {
int i = 0;
for (char rank='8'; rank>='1'; rank--) {
for (char file='a'; file<='h'; file++) {
this.fields[i] = new Field(file, rank);
this.fields[i].addMouseListener(this);
this.add(this.fields[i]);
i++;
}
}
} |
6e641548-ca82-49bf-b949-a06c304086be | 9 | public Map read (Kryo kryo, Input input, Class<Map> type) {
Map map = create(kryo, input, type);
int length = input.readInt(true);
Class keyClass = this.keyClass;
Class valueClass = this.valueClass;
Serializer keySerializer = this.keySerializer;
if (keyGenericType != null) {
keyClass = keyGenericType;
... |
4ed24466-a1e8-43a6-97eb-0638747189af | 0 | public Boolean getActive() {
return this.active;
} |
fb12d0a8-6378-4bee-bb33-8256e010f47b | 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... |
5cefcd8e-18f3-4c61-a9b2-6a2f55529075 | 0 | @Override
public boolean subscribeObserver(Observer observer) {
return readers.add(observer);
} |
6c0f3449-8cc0-4498-8b39-8d2c2653a2b9 | 4 | public boolean mousePressed(Minecraft var1, int var2, int var3) {
return this.enabled && var2 >= this.xPosition && var3 >= this.yPosition && var2 < this.xPosition + this.width && var3 < this.yPosition + this.height;
} |
e02e6d97-f811-4d26-832d-e3481af4ec1c | 3 | private void writeConstantPool(final DataOutputStream out)
throws IOException {
out.writeShort(constants.size());
// Write the constants. The first constant is reserved for
// internal use by the JVM, so start at 1.
for (int i = 1; i < constants.size(); i++) {
writeConstant(out, (Constant) constants.get(... |
fad65728-ff18-4daa-acf1-7d52b6b4850d | 7 | private static void ativarLookFeel(boolean ativar) {
if(!ativar) return;
//<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
... |
ab8fc90e-2ff0-4f77-a558-96ae86ae00c5 | 3 | public void addResult(int res) {
if(!isFinish()) {
this.result = -this.bet;
if(res>0) this.result = res;
UserModel user = DataStore.getUser(getParis_userId());
if(res>0) user.addUserPoint(res);
user.addUserPointsResult(this.result);
DataStore.storeUser(user);
setFinish(true);
}
} |
c358eca3-501a-4241-b3b4-9fe4d15a0d9c | 6 | public boolean addCategory(DialogCategory category) {
if(editor.controller.categories.containsKey(category.getID())){
category.setID(editor.controller.getUniqueCategoryID());
}
if(editor.controller.containsCategoryName(category, category.getTitle())){
String[] buttons = {"Overwrite", "Change", "Cancel"};
... |
4d13d7a4-d5bf-46fc-b4bd-db7cf83fc279 | 3 | public static String layoutMatchingModeToString(LayoutMatchingMode mode) {
switch (mode) {
case NoMatch:
return "NONE";
case MatchSensitiveOnly:
return "PWD";
case MatchAll:
return "ALL";
default:
return "unknown";
}
} |
7c93b194-f9e1-48e3-a050-e56e81adc740 | 4 | public static boolean isFree(MovableEntity entity, Direction dir, int length){
Rectangle c = entity.getCollisionBox();
Rectangle testBox = new Rectangle (c.getX() + dir.getX() * length, c.getY() + dir.getY() * length, c.getWidth(),c.getHeight());
for (Entity e: entities){
if (!(e.equals(entity)) && e.get... |
746742f3-c882-4b86-933b-e92d0422b5b8 | 4 | private void generer() {
Generer g=new Generer(this,this.menu);
while(g.estEnCours() && !this.stop) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
g.masquer();
if(!this.stop) {
this.res=Interface.crypter(Fabrique.fabriquerMessage("Ce message est inutile"), g.getTypCode(), In... |
c994a72c-0b45-4613-beda-b486cb7098fd | 9 | public Map read (Kryo kryo, Input input, Class<Map> type) {
Map map = create(kryo, input, type);
int length = input.readInt(true);
Class keyClass = this.keyClass;
Class valueClass = this.valueClass;
Serializer keySerializer = this.keySerializer;
if (keyGenericType != null) {
keyClass = keyGenericType;
... |
80c9aa64-d56d-4c39-9a2b-5945c46ece84 | 0 | @Override
public Object getValue() {
return this.embeddedImageLink;
} |
bd2f3f58-eb6b-444b-a915-922fb1dd83aa | 0 | public Color getColor() {
return color;
} |
71a0621a-dd16-455d-a5cc-8b94999f1648 | 1 | public static int calcular(int numero){
if (numero < 0) {
throw new IllegalArgumentException();
}
return (numero * calcularFatorial(numero-1));
} |
58c258c3-a208-4019-982f-4a9e60a8e87a | 4 | private String getEntry(int row, int col)
{
String s = "";
State state = (State)this.dfa.getStates().get(row);
State toState = state.getTargetState((String)this.alphabet.get(col));
if (toState != null)
s = toState.getState_Properties().getName();
try
{
Transitio... |
ccc91eed-ed44-46a7-8c4f-da29a548b20e | 3 | public VistaIDList(ByteReader br, int size) throws ShellLinkException, IOException {
if (size < 0xa)
throw new ShellLinkException();
int s = (int)br.read2bytes();
while (s != 0) {
s -= 2;
byte[] b = new byte[s];
for (int i=0; i<s; i++)
b[i] = (byte)br.read();
list.add(b);
s = (int)br.read... |
7e827b0e-4895-42ec-8115-0a367ad6634c | 3 | int getTextX (int columnIndex) {
int textX = getContentX (columnIndex);
if (columnIndex == 0) {
textX += parent.col0ImageWidth;
if (parent.col0ImageWidth > 0) textX += CTable.MARGIN_IMAGE;
} else {
Image image = getImage (columnIndex, false);
if (image != null) {
textX += image.getBounds ().width + CTable... |
41be96c0-da86-42a7-a73b-099ba4a18b1a | 9 | private static boolean depthFirstSearch(int x, int y, String word) {
m_mark[x][y] = true;
m_wordStack.push(x * 4 + y);
if (word.length() == 0) {
return true;
}
/* horizontal increments allowed in matrix */
final int m_dx[] = {0, 0, 1, -1, -1, 1, -1, 1};
... |
4e2501fa-986c-4a06-8aba-2c95d3d8f9e8 | 8 | @Override
public int strstr(char[] pattern, char[] string) {
if( pattern.length > string.length )
return -1;
int y=0;
do {
int i;
for( i=y; i<string.length; i++ ) {
if( string[i] == pattern[0] ) {
y=i;
break;
}
}
if( i == string.length )
return -1;
boolean found = true;
... |
db44be3f-0b3e-46ce-98b4-d69838a5ba37 | 1 | @Override
public void draw(Graphics graphics, int x, int y) {
if (this.fontmetrics == null) {
this.fontmetrics = graphics.getFontMetrics(this.font);
}
// TODO set the font before drawing
graphics.drawString(this.str, x, y);
} |
779280d9-23d9-4c6f-a8ec-6faf8be01767 | 0 | private CommonUtil() {
} |
024103e6-77ee-47d7-b76f-1fa315955438 | 6 | public static void removePacks(String xml) {
ArrayList<ModPack> remove = new ArrayList<ModPack>();
int removed = -1; // TODO: if private xmls ever contain more than one modpack, we need to change this
for(ModPack pack : packs) {
if(pack.getParentXml().equalsIgnoreCase(xml)) {
remove.add(pack);
}
}
f... |
6c4e8469-a9ff-4b46-b740-308c335bb335 | 4 | public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) {
// Think of the tree like
// (NewMultiArrayExpr)
// / \
// count1 .
// / \
// count2 etc.
// since multianewarray manipulates the stack like
// count1, [count1 ...] => ...
final Expr[] dims = expr.dimensions();
if (dims.length > 0) ... |
01931913-4551-4069-9424-7fc0e08797f1 | 4 | public CycObject getFormatLanguageMt() {
if (DEFAULT.equals(formatLanguageMt)) {
try {
String command = "(denots-mt-for-language (get-language-for-code " + DefaultCycObject.stringApiValue(locale.getLanguage()) + "))";
formatLanguageMt = cyc.converseCycObject(command);
} catch (UnknownHos... |
9cc33b27-06b9-40ff-85ed-5b7d79fb5b09 | 7 | protected String getAttributeString() {
String attributeString = "";
for (String name : this.attributes.keySet())
attributeString += name + "=\"" + this.attributes.get(name) + "\" ";
attributeString = attributeString.trim();
if (this.classes.size() > 0)
attribu... |
d59c6294-7258-4b62-9472-e6713f290181 | 1 | @Test
public void every_park_stop_five_car_when_in_ten_car_and_average_strategy() {
parkBoy = new ParkBoy(new AverageStrategy());
parkBoy.handlePark(new Park(this.FIRST_PARK_SIZE));
parkBoy.handlePark(new Park(this.SECOND_PARK_SIZE));
for(int i = 0; i < 10; i ++) {
parkBo... |
6575bd04-5472-4b7a-91dd-e6d58c553733 | 0 | @BeforeClass
public static void setUpClass() {
} |
017f5d36-2aaa-4c96-969f-9d9acb559d6d | 8 | public boolean doSearch(VertexType vertex, PreWorkHandler<VertexType> handler)
throws InvalidVertexException {
//int vertexId = vertex.getId();
for (VertexType v : graph)
v.setMark(false);
vertex.setMark(true);
LinkedList<VertexType> queue = new LinkedList<Verte... |
3c3b23e0-d0c4-47d3-afd1-c074912c993c | 8 | private static List<String> processDeltas(List<String> origLines, List<Delta> deltas,
int contextSize) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter f... |
e1e417d9-6163-48e2-94e8-01be77583235 | 0 | public static String[] getBookList() {
return bookNames;
} |
4e81a056-ea33-4218-853b-a633f83d2a71 | 1 | public void bind(Object target) {
if (target instanceof Method) {
this.bind = true;
types = ((Method) target).getParameterTypes();
this.values = new Object[types.length];
} else {
this.bind = true;
types = new Class[]{target.getClass()};
... |
d124c9df-ba1e-4a63-9f82-f48fb3c25ef3 | 0 | public synchronized void addNotification(Notification notification) {
this.aNotification.add(notification);
this.notifyAll();
} |
50064418-dc2b-4ea1-8c39-e656cc3c2d42 | 0 | public String getStringToPush() {
return myStringToPush;
} |
73b7795b-3a49-424f-8924-71162940c9fe | 0 | public static void main(String[] args)
{
TalkingClock clock = new TalkingClock();
clock.start(1000, true);
// keep program running until user selects "Ok"
JOptionPane.showMessageDialog(null, "Quit program?");
System.exit(0);
} |
e2f160fc-501b-41a0-8677-6aaeb4323676 | 9 | public ReflectedObject[] getFields()
{
try
{
if (obj == null || type.isPrimitive()) return new ReflectedObject[0];
else if (type.isArray())
{
int len = Array.getLength(obj);
ReflectedObject[] ref = new ReflectedObject[le... |
cf448021-e39f-4309-b59d-6b2d302e933e | 3 | public void resetPosNumbers()
{
for(int i=0; i<9; i++)
{
for(int j=0; j<9; j++)
{
if(grid[i][j].getValue()==N._0)
{
grid[i][j].setValue(N._0);
}
}
}
} |
a0b64210-b075-4978-8d07-2d256a97b714 | 2 | private static String myDblToString(double value)
{
int approx = (int) value;
double remaining = value - approx;
if (remaining < 0.0001) return Integer.toString(approx);
if (remaining > 0.9999) return Integer.toString(approx + 1);
return Double.toString(value);
} |
82dd060c-f12c-4fcd-bc59-6fd11cea1c6a | 3 | private void encerraPartida() throws JogoNaoIniciadoException,
JogoNaoFoiFinalizadoException {
ranking.adicionar(jogador1);
ranking.adicionar(jogador2);
jogoAnteriorFinalizado = true;
if(jogador1.getPontuacao() > jogador2.getPontuacao())
vencedor = jogador1;
else if (jogador1.getPontuacao() < jogador2.... |
a169f169-fc8d-44f1-a4ea-c977fd66d691 | 1 | @Override
public boolean publish(Client client, PubMessage message) throws Exception {
String payload = new String(message.getPayload(), Charset.forName("UTF-8"));
if (payload.indexOf("Country Music") > -1) {
// We don't do that stuff here! Return true to suppress processing of the message
return true;
... |
34c43929-fe12-49eb-a6b4-8be52437ab68 | 3 | public static void selectChild(int index) {
RSInterface rsi = getInterface();
if (rsi != null) {
if (rsi.children != null) {
if (index < rsi.children.size()) {
selectedId = rsi.children.get(index);
}
}
}
} |
89a38363-2479-467d-8af6-d75d48f26575 | 6 | public static boolean loadSystem(String nativeDirPath) {
final String osName = System.getProperty("os.name").toLowerCase();
final String osArch = System.getProperty("sun.arch.data.model");
final File nativeDir = new File(nativeDirPath);
boolean isLoaded = false;
if (nativeDir != null && nativeDir.isDirector... |
ea37cc6b-7783-428d-b284-ed69da07fb88 | 7 | @Override
public MapConnector<String, Long> putAll(Map<? extends String, ? extends Long> map) throws Exception {
String stm;
try (Connection con = getConnectorInfo().getConnection()) {
stm = getCreateTableTmp(getConnectorInfo().getTableName());
try (PreparedStatement prepStm ... |
8219d848-99ad-4c7e-a19b-d8ab22317197 | 0 | public LogicClock() {
this.clock = 0;
} |
d4d793c5-4837-46f5-a664-19cedc42dac1 | 6 | private JobState buildJobState(Job job, Run run, CiLightProperty property) {
JobState jobState = new JobState();
jobState.setName(job.getName());
try {
InetAddress localhost = InetAddress.getLocalHost();
jobState.setServer(localhost.getHostName());
} catch (Unkno... |
958484e0-138f-4e00-b62a-d7363f263655 | 0 | public Unit getUnit()
{
return unit;
} |
45f7f90f-2574-4203-b3d2-3ca8fd4e0e86 | 1 | public void push(Locale loc) throws Exception {
// Check for stack overflow.
if (topPtr > 0) {
topPtr = topPtr - 1;
arr[topPtr] = loc;
} else {
Exception overflow = new Exception("Stack Overflow");
throw overflow;
}
} |
aad4c8e7-6af3-42a6-bf42-14e7180a6c6d | 6 | public void onTick() {
if (active) {
if (y > 416 && tick < NOTIFICATION_TICKS) {
y -= NOTIFICATION_SPEED;
} else {
if (tick >= NOTIFICATION_TICKS) {
if (y <= 480) {
y += NOTIFICATION_SPEED;
} ... |
06f1e21c-4273-4806-9044-24036a8b9dbf | 8 | public void playGame(int userid){
this.result.setQuizId(this.quiz.getId());
this.result.setUserId(userid);
this.result.setData(null);
String newline = System.getProperty("line.separator");
// question number
int $i = 1;
int finalScore = 0;
// show quiz question and answers
for(QuizGame qgame:... |
e99c3a3e-799e-4432-b497-fdf9143c986c | 3 | protected void print() {
System.out.println("Print for " + def + "------------------");
cfg.visit(new PrintVisitor() {
Phi phi = null;
public void visitBlock(final Block block) {
phi = exprPhiAtBlock(block);
super.visitBlock(block);
}
public void visitLabelStmt(final LabelStmt stmt) {... |
dcee49ed-e875-4503-bec0-1848234327c1 | 3 | public static String htmlEscapeHex(String input) {
if (input == null) {
return null;
}
StringBuilder escaped = new StringBuilder(input.length() * 2);
for (int i = 0; i < input.length(); i++) {
char character = input.charAt(i);
if (characterEntityReferences.isMappedToRe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.