method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
36056ff3-7d39-4a2a-bcbc-8abd892d4c3f | 1 | @Override
public void save() throws DataSaveFailedException {
super.save();
getSection().set("rank", rank);
getSection().set("inheritence", inheritence);
if (defaultGroup) {
getSection().set("default", true);
}
} |
87ede914-efb5-4951-9f6d-de154dc3bc05 | 6 | protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.id == 0)
{
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if (par1GuiButton.id == 5)
{
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSett... |
80b673f6-6d8d-4734-b9f2-14531bed6a9d | 1 | public OutputStream getOutputStream() throws IOException
{
if (mos == null)
{
mos = new MonitoredOutputStream(super.getOutputStream(), listener);
}
return mos;
} |
c8412a07-8395-4e45-afa8-5c38b8aec218 | 9 | public void endTurn() {
if(!night) {
DataOutputStream dOut = this.outputs.get(this.firstPlayer);
String msg = "END_ALL_TURN";
Set<Player> pSet= outputs.keySet();
for(Player p : pSet)
{
if(!p.getName().equals(renfield.getName()))
{
if(firstPlayer.getName() != p.getName()) {
msg += ";"... |
0c3cc7ac-3c8a-45c9-ac85-e2c4aeb2bf41 | 2 | public static void rename(String sourceFile, String newFile) {
File fs = new File(sourceFile);
File fd = new File(newFile);
if (fs.exists()) {
if (fs.renameTo(fd)) {
// log.info(fs.getName() + " has been renamed to " + fd.getName());
} else {
... |
c9ae1847-4487-45eb-b574-6d90de9ba34b | 0 | public static int input(String nameOfVariable) throws NumberFormatException, IOException{
System.out.println(String.format("Please, input %s", nameOfVariable));
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int number = Integer.parseInt(bf.readLine());
return number;
} |
ba2588f4-6573-49bf-b91e-f915012e7737 | 6 | final Interface2 method3731(int i, boolean bool, int i_8_, byte[] is,
int i_9_) {
try {
if (i != 2)
method3781((byte) -13, 54);
anInt7530++;
if (aBoolean7873 && (!bool || aBoolean7869))
return new Class135_Sub1(this, i_8_, is, i_9_, bool);
return new Class119_Sub1(this, i_8_, is, i_9_);
} ... |
0c799fe6-aefe-455a-976d-62c4a6decf04 | 3 | public void shiftLeft(int anzShifts, boolean fillIn) {
if (anzShifts <= 0)
return;
for (int i = size - 1 - anzShifts; i >= 0; i--)
bits[i + anzShifts] = bits[i];
for (int i = 0; i < anzShifts; i++) {
bits[i] = fillIn;
}
} |
7e5863cd-0a11-42c9-90a4-464b90177693 | 0 | private void resize()
{
contents.setDividerLocation((int)(0.25*WIDTH));
display.setSize((int)(0.735*WIDTH),(int)(0.91*HEIGHT));
this.revalidate();
} |
ad30330b-ddef-4a53-801c-126dcdd2a382 | 6 | public void selectionChanged(IAction action, ISelection s) {
if (s != null) {
if (s instanceof IStructuredSelection){
m_selection = (IStructuredSelection)s;
}
if (s instanceof ITextSelection){
IEditorPart part = RsyncPlugin.getActivePage().getActiveEditor();
if (part != null) {
... |
a2e57527-4d88-4f3e-8be5-3bbc1e14f96b | 4 | private void closeTextOutFile()
{
try{
if (out != null) {out.close();}
if (outputStreamWriter != null) {outputStreamWriter.close();}
if (fileOutputStream != null) {fileOutputStream.close();}
}
catch(IOException e){
//ignore error while trying to close the file
//c... |
a06d11d5-3597-4805-a73d-682a186b711e | 2 | private static String setSimpleLine(int divisions, int columnSize) {
String simpleLine = "+";
for(int i = 0; i < divisions; i++) {
for(int j = 0; j < columnSize; j++) {
simpleLine += '-';
}
simpleLine += '+';
}
return simpleLine;
} |
34d9e62d-4d2b-4c9b-bd09-4059ef200563 | 2 | private static void readMagicItemsFromFileToList(String fileName,
ItemList lm) {
File myFile = new File(fileName);
try {
Scanner input = new Scanner(myFile);
while (input.hasNext()) {
// Read a line from the fil... |
7aec951d-5748-4abb-a2e7-c9de23e06a7e | 2 | public void repaintColumn(TreeColumn column) {
Point pt = fromHeaderView(new Point(getColumnStart(column), 0));
int width = column.getWidth();
int count = mColumns.size();
if (count > 0 && column == mColumns.get(count - 1)) {
width = Math.max(width, getWidth() - pt.x);
}
Rectangle bounds = new Rectangle(... |
e2cc3933-89a3-4034-b170-1f8fc6650fc0 | 9 | public void remove(int key) {
HashPrinter.tryRemove(key);
/** Run along the array */
int runner = 0;
int hash = (key % TABLE_INITIAL_SIZE);
int secondValue = TABLE_INITIAL_SIZE;
while (table[hash] == null || (table[hash] != null && (table[hash].getKey() != key)) && runner < TABLE_INITIAL_SIZE) {
runn... |
092d74a8-67d3-4a35-8bfd-4932597e86eb | 2 | public void updateButtons(LinkedList<ClickableObject> selection) {
for(ClickableObject selectable : selection) {
for(Ability ability : selectable.getAbilities()) {
addAbility(ability);
}
}
} |
b6ae828e-7acc-4919-ab30-aedf599596e0 | 3 | static void downloadFile(final String url) throws IOException {
synchronized (downloadedUrls) {
if (downloadedUrls.contains(url)) {
SparkUtils.getLogger().info("url already downloaded:" + url);
return;
} else {
downloadedUrls.add(url);
synchronized (downloadedUrlWriter) {
downloadedUrlWrit... |
e5b4f77d-2abd-4216-a678-924c8bd142da | 2 | public static Environments getInstance() {
if(Environments.instance == null) {
try {
Environments.instance = new Environments();
} catch (Exception e) {
logger.error("Unable to create connection due to " + e.getClass().toString(), e);
}
}
return Environments.instance;
} |
f23fa75a-213f-47bf-a9a9-65aa5dabda48 | 9 | protected int getWeaponAttackIndex(final int weaponDamageType, final int weaponClassification)
{
switch(weaponClassification)
{
case Weapon.CLASS_RANGED: return (weaponDamageType==Weapon.TYPE_LASERING) ? 5 : 0;
case Weapon.CLASS_THROWN: return (weaponDamageType==Weapon.TYPE_LASERING) ? 5 : 1;
default:
swi... |
183f0c7d-aaef-433a-83db-255c785cd538 | 1 | private void doDelete() {
System.out.print("\n[Performing DELETE] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("DELETE FROM COFFEES WHERE PRICE > 6");
} catch (SQLException ex) {
System.err.println(ex.getMessage());
}
} |
58519f80-c64e-4fb1-a6e0-5498daf0e835 | 6 | public Food(ConfigurationSection config, List<Nutrient> nutrients) {
hunger = 0;
saturation = 0.0;
setsHunger = false;
if (config.isSet("hunger")) {
setsHunger = true;
hunger = config.getInt("hunger");
}
if (config.isSet("saturation")) {
setsHunger = true;
saturation = config.getDouble("satur... |
1cf8c45b-42dc-407d-a52f-f583ed08d820 | 5 | @Override
public void unlockFile(FileHandle handle, long byteOffset, long length)
throws PathNotFoundException, AccessDeniedException,
NotAFileException, UnsupportedFeatureException {
if (hardlinks)
{
if (RedirectedFileHandle.class.isInstance(handle))
{
handle = ((RedirectedFileHandle)handle).getRe... |
24307aa4-19b7-450a-9c24-b69b4506f719 | 4 | public SubjectName(Node nameNode) {
Map<String, String> namespaces = XMLLabels.STANDARD_NAMESPACES;
this.name = new NameDetails(nameNode);
try {
NodeList aliasNodes = Utilities.selectNodes(nameNode, "./m:Alias", namespaces);
this.aliases = new ArrayList<NameDetails>();
for(int i = 0; i < aliasNodes.g... |
7df1935e-e719-4b56-822f-b8f69be2d7a0 | 8 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String s;
boolean home;
char[] c;
StringBuilder cur;
LinkedList<StringBuilder> list;
... |
b735b5eb-c74b-4ab9-bf7f-461fc44c17bf | 6 | private String rmRepeated(String s){
int len = s.length();
int k = 0;
int count = 0;
String str = "";
char[] c = new char[len];
for(int i=0;i<len;i++){
c[i] = s.charAt(i);
}
for(int i=0;i<len;i++){
k=i+1;
while(k... |
8977ba1c-31eb-44bd-b315-bb74540a0b89 | 0 | @Override
protected void onBinaryMessage(ByteBuffer arg0) throws IOException {
// not supported
} |
54792750-8c27-4fdb-a2bc-fd1dd16209e3 | 3 | @Override
public Token parse() {
Token test = first;
factor = new Factor(test, scope);
test = factor.parse();
while (test.isOperator()) {
Operator testOp = test.getOperator();
if (Operator.MULTIPLY.equals(testOp) || Operator.DIVIDE.equals(testOp)) {
ops.add(testOp);
Factor f = new Factor(te... |
4c0ceda5-ca0d-40a2-a44c-3c24bc1464ea | 4 | @Override
public V put(K key, V value) {
V oldValue = null;
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new LinkedList<MapEntry<K, V>>();
}
LinkedList<MapEntry<K, V>> bucket = buckets[index];
MapEntry<K, V> ... |
ee548cb5-5062-4057-9769-94b21a6f00f3 | 7 | public int postErrorTweet(int message){
switch(message){
case ALREADYSTARTED:postTweet("すでに掃除を始めています");break;
case ALREADYBACKED:postTweet("すでに終了段階に入っています");break;
case ALREADYFINISHED:postTweet("すでに掃除は終わりました");break;
case NOTCLEANEDYET:postTweet("まだ清掃をしていません");break;
case NOENERGY:postTweet("清掃を行う電力がありません"... |
2350ec67-1a5e-4ecc-ae19-b60b17efa155 | 7 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Department other = (Department) obj;
if (departmentName == null)
{
if (other.departmentName != null)
return false;
} else if (!depart... |
f514314b-2217-4aad-923d-5297b89bdff5 | 9 | public BAISReturn processFile(List<FormDataBodyPart> fields, String combineFiles, String noDuplicates, String sorting, WordDAO wordDao) throws IOException {
this.wordDao = wordDao;
totalFiles = fields.size();
if (totalFiles < 1) {
br.setErrorMessage("You must submit at least one file!");
return br;... |
389b09c2-46ca-455a-b62d-6bcfdda63905 | 5 | MultipleRevisionIterator(final String element, final String startType, final Object start, final String endType, final Object end, final boolean getContentImmediately) {
super(startType, start != null ? (start instanceof Date ? dateToTimestamp((Date) start) : start.toString()) : null);
getParams = paramValuesToM... |
505a5e55-6cb4-4d97-90e1-36ae7b0fcbba | 3 | public synchronized void close() {
try {
for (DBConnection dbc : free)
dbc.close();
for (DBConnection dbc : used)
dbc.close();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
} |
0d26018a-bffa-48eb-b973-3c5fd875b10e | 4 | protected static void send(String reqcode, String req, InetAddress address){
int ok=0;
System.out.println(Serveur.connectList.toString());
for(int i = 0; i < Serveur.connectList.size();i++){
if(Serveur.connectList.get(i).equals(address)){
ok = 1;
break;
}
}
System.out.println(ok);
if(ok == 0){... |
aa335078-4103-492e-9200-54389772a5f8 | 7 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PrioSetMember other = (PrioSetMember) obj;
if (symbolCode != other.symbolCode)
return false;
if (relationToPrevMember == null) {
if (other.relationT... |
bce7e31b-ee5b-4986-ac3b-9fe5b1ffa5ff | 8 | public static URL getVideoUrl (Map<String, String[]> parameterMap)
throws MalformedURLException {
StringBuffer uriSearch = new StringBuffer(URI_JSON_VIDEO);
for (String key : parameterMap.keySet()) {
if (key != null) {
if (key.equalsIgnoreCase(PARAM_QUERY)) {
uriSearch.append(URI_PARAM_SEP).append(p... |
4a303865-909c-41c3-b603-22dd85522282 | 9 | public int liveNeighbours(int x, int y) {
int liveNeighbours = 0;
for(int i = -1; i <= 1; i++) {
int corY = y+i;
for(int j = -1; j <= 1; j++) {
int corX = x+j;
if(corX >= 0 && corY >= 0 && corX < gridSize && corY < gridSize && (corX != x || corY != y)) {
if(state[corY][corX] == 1)
liveNe... |
a13b60a9-48ef-43e0-8425-0914e0b0bcd1 | 5 | public TetrisFrame(final GameBoard game) {
super("Tetris");
this.game = game;
graphicalViewer = new GraphicalViewer(this.game);
game.addBoardListener(graphicalViewer);
final Action rotate = new AbstractAction() {
@Override
public void actionPerformed(Ac... |
83837795-b3f5-4689-8510-6c1b971dfde0 | 6 | public static String formatCountdownTime(long l) {
String out = "";
if (l >= 3600) {
int h = (int) Math.floor(l / 3600);
out += h + " hours";
l -= h * 3600;
}
if (l >= 60) {
int m = (int) Math.floor(l / 60);
out += (out.length() > 0 ? out += ", " : "") + m + " minutes";
l -= m * 60;
}
if (... |
86283e0c-5aea-4c38-8ac8-b0caf31ca10a | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(mob.isInCombat()&&(mob.rangeToTarget()>0))
{
mob.tell(L("You are too far away to kick!"));
return false;
}
if(mob.charStats().getBodyPart(Race.BODY_LEG)<=0)
{
mob.tell(L("You need l... |
1b9b3332-be8f-4556-921f-013fb13d02af | 2 | public SpriteSheet get(String fileName, int spritesPerX, int spritesPerY,
int spriteBorderSize, int filter) throws IOException {
SoftReference<SpriteSheet> ref = loadedSpriteSheets.get(fileName);
SpriteSheet current = ref == null ? null : ref.get();
if (current != null) {
return current;
} else {
loade... |
20c8220d-4d27-414d-9dbe-b6e998679ac6 | 7 | public static MapaRutas fromElement(Node tuberias, Mapa mapa, Dinero d)
throws NoSeCumplenLosRequisitosException,
FondosInsuficientesException, CoordenadaInvalidaException,
SuperficieInvalidaParaConstruir {
MapaRutas mapaRutas = new MapaRutas(mapa);
NodeList hijosDeRed = tuberias.getChildNodes();
for (... |
27347cf1-dadd-45f3-9f05-06abbe102dc6 | 5 | public void initialize() {
boolean shouldLoadJson = false;
final VisualEditorFrame window = this;
this.addWindowFocusListener(new WindowFocusListener() {
@Override
public void windowLostFocus(WindowEvent arg0) {
// TODO Auto-generated method stub
hideAutoComplete(false);
}
@Override
... |
b03fc109-d41a-4a6b-950c-1cf59f48cf44 | 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... |
a3227ae6-54e3-4d3e-85b1-8158e78576e9 | 2 | @Test
public void testMissingFile() {
GithubExploreMessageParser parser = new GithubExploreMessageParser();
try {
System.out.println(parser.parse("src/test/resources/Example-Fail.msg"));
// If we reach here, we've failed. It should throw an IllegalArgumentException
... |
21a92532-ae4d-4c44-bcbf-b9659ba00620 | 6 | public void processOtherEvent(Sim_event ev){
switch(ev.get_tag()){
// receives the application and submits each one of its
// gridlets (jobs) to the broker.
case GridSimTags.EXPERIMENT:
// Requesting the GridInformationService
// to send a list of resources
... |
84b2b609-3ecd-4934-8947-67fff21562a1 | 7 | public StringTemplate getLabel() {
StringTemplate label = StringTemplate.key(type.getNameKey());
if (tileItemContainer != null) {
List<String> keys = new ArrayList<String>();
for (TileItem item : tileItemContainer.getTileItems()) {
if (item instanceof Resource) {
... |
90921a7b-7b9f-47dc-87fd-ac6449d31642 | 0 | public void setWatchSubtree(boolean watchSubtree) {
this.watchSubtree = watchSubtree;
} |
80867d01-7d46-49bc-9526-c4292c0b76fc | 2 | private void costruisciDamiera() { // aggiunge caselle alla griglia e il corrispondente ascoltatore
for( int i = 0; i <8; i++)
for(int j = 0; j <8; j++){
bottoni[i][j] = new Casella(i, j, damiera);
add(bottoni[i][j]);
addListener(bottoni[i][j], i, j);
}
} |
90145461-fa93-40e2-8eab-af1209d2d13c | 4 | User(String nick, boolean yourself) {
char prefix = nick.charAt(0);
if((prefix >= 'A' && prefix <= 'Z') || (prefix >= 'a' && prefix <= 'z'))
this.nick = nick;
else
this.nick = nick.substring(1, nick.length());
userID++;
} |
a4be962c-4106-497e-add9-1d7c1d8f7c3a | 1 | public static LoggerCollection getInstance() {
if (loggerCollection == null) {
loggerCollection = new LoggerCollection();
}
return loggerCollection;
} |
b952a2b2-ef11-4e36-98db-f32ab018d15e | 9 | static void destroyPopupMenu(JPopupMenu pm) {
if (pm == null)
return;
pm.setInvoker(null);
Component c;
AbstractButton b;
for (int i = 0, n = pm.getComponentCount(); i < n; i++) {
c = pm.getComponent(i);
if (c instanceof AbstractButton) {
b = (AbstractButton) c;
b.setAction(null);
ActionL... |
64f31c58-92d3-4fd2-8a38-c66449f6a300 | 4 | public Sphere(Location centerLocation, int radius) {
Location centerBlockLocation = centerLocation.getBlock().getLocation();
this.centerLocation = new Location(centerBlockLocation.getWorld(), centerBlockLocation.getX() + 0.5,
centerBlockLocation.getY() + 0.5, centerBlockLocation.getZ() + 0.5);
World world =... |
c15e88fc-1c73-4b4a-a1c4-c423d1793fcb | 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);
... |
8dd43e75-4080-4255-be45-831bc3ec242c | 7 | public void updateChangedExit(MOB mob, Room baseRoom, Exit thisExit, Exit prevExit)
{
thisExit.recoverPhyStats();
CMLib.database().DBUpdateExits(baseRoom);
try
{
for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
{
Room room=r.nextElement();
synchronized(("SYNC"+room.roomID()... |
16adcfe7-8f68-4866-b931-3401f0d69235 | 4 | public boolean sendImage(FrameType type,String filename,File imageFile){
try{
if(sendString(FrameType.ImageFileName,filename)){
Log.Print(LogType.Log, "Sending file: "+filename);
if(writeMessageHeader(type.val, (int)imageFile.length())){
FileInputS... |
4230fcc9-9d1c-4b1a-bd05-7aa1f4aba793 | 5 | public void handleStartTag(HTML.Tag tag, MutableAttributeSet a, int position) {
String href = null;
if (tag == HTML.Tag.A) {
href = (String) a.getAttribute(HTML.Attribute.HREF);
}
if (tag == HTML.Tag.FRAME) {
href = (String) a.getAttribute(HTML.Attribute.SRC);
}
if (href != null) {
links.add(href);... |
893f1b14-9fb3-48bf-acf3-3183fa8efcda | 2 | public static void zmq_setsockopt(SocketBase s_, int option_, Object optval_) {
if (s_ == null || !s_.check_tag ()) {
throw new IllegalStateException();
}
s_.setsockopt (option_, optval_);
} |
20141e51-2eba-4c65-8397-894cb15c4e49 | 9 | public void solve(int [] weights, int [] values, int kpSize){
int maxWeight = weights[weights.length-1];
int [][]kp = new int [weights.length+1][maxWeight+1];
for(int i=0;i<=weights.length;i++){
kp[i][0]=0;
}
for(int i=0;i<=maxWeight;i++){
kp[0][i]=0;
}
for(int i =0;i<weights.length;i++){
for... |
1d90763c-0e73-4d37-902a-aa567e5ac5ad | 4 | public DomainLister(final int amount, final int length, String tld) {
if (amount <= 0) {
throw new IllegalArgumentException("invalid amount.");
}
if (length <= 2) {
throw new IllegalArgumentException("invalid length.");
}
tld = tld.trim().toLowerCase();
if (tld.isEmpty()) {
throw new IllegalArgume... |
80fa0988-4c74-4fd7-b46b-50d22df19082 | 9 | public static void benchmarkENTS(File resultDir, String outputName) {
System.out.println("Benchmark ENTS, " + outputName);
HashMap<String, String> classifications = loadClassifications();
TreeSet<Hit> hits = new TreeSet<Hit>();
Workbook workbook = null;
WritableWorkbook temp = null;
try {
File sprea... |
e9ecc471-ce89-4d94-87e3-94fa4aba8526 | 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... |
57854e46-15ee-40db-aa08-00b82720bc53 | 9 | private void btn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_buscarActionPerformed
ocultarMensaje();
try{
// buscar por numero de factura
if((!campo_buscar1.getText().equals(""))&&(!campo_buscar1.getText().e... |
e7fff338-4cc8-4b6a-af29-ba7976ab3859 | 7 | @Override
public void fetch(ObjectMapper mapper) throws IOException, ClassNotFoundException,InstantiationException, IllegalAccessException
{
String caption = "";
String username = "";
Integer status;
if(!(paginateURL == null || paginateURL.isEmpty()))
{
in... |
bebebcca-910a-466f-88e5-d9ccd3953a3c | 8 | public Finder(final DjVuBean bean)
{
searchField=null;
if(classTextField != TextField.class)
{
try
{
searchField = (Component)classTextField.newInstance();
}
catch(final Throwable exp) {}
}
if(searchField == null)
{
searchField = new TextField();
}
... |
48addb74-08c4-4ce6-8f3d-04f5e8fe5688 | 9 | private void CheckTailPieces(GameTime gameTime)
{
if (mDoubleTimer == -1)
{
mDoubleTimer = gameTime.GetRuntime() + timeToDouble - mHealingBonus;
}
if (gameTime.GetRuntime() > mDoubleTimer && mCurrentTailPieces < maxPieces)
{
AddTailPiece();
mDoubleTimer = gameTime.GetRuntime() + timeToDouble ... |
5e8f6cc6-e39c-4a8d-a70f-07693ca19681 | 5 | public void close()
throws IOException
{
while (! this.atEndOfData) {
char ch = this.savedChar;
if (ch == 0) {
ch = this.reader.read();
} else {
this.savedChar = 0;
}
if (ch == ']') {
char ch2 = this.reader.read();
... |
3cb8985c-272a-4c1c-b2f7-568e73e5bfcf | 8 | private static Method findListenerMethod(Object obj, String methodName) {
final Class<?> type = obj.getClass();
final Method[] methods = type.getDeclaredMethods();
Method foundMethod = null;
for (Method m : methods) {
if (!methodName.equals(m.getName())) {
c... |
8b1154d6-e145-46d2-bbd6-063372a002bd | 2 | public void setNextGlied(SchlangenGlied glied) {
if (nextGlied != null) {
nextGlied.removePreviousGlied();
}
nextGlied = glied;
if (glied.getPreviousGlied() != this) {
glied.setPreviousGlied(this);
}
} |
c7ada4af-e5ea-4ed2-bd0f-6d51f870fb8d | 9 | public void calcuateTFIDF(BufferedReader oBufferedReader)
throws IOException {
Hashtable<String, Integer> oTermVsTF = new Hashtable<String, Integer>();
String strLine = null;
while ((strLine = oBufferedReader.readLine()) != null) {
if (strLine.trim().startsWith("<desc>"))
totalDocs++;
if (strLine.sta... |
b4d0c0ca-e80c-4640-81b4-dae61c2e0c27 | 0 | public void setPrpFecha(Integer prpFecha) {
this.prpFecha = prpFecha;
} |
cd4f99e8-3ecc-4bc3-8c87-0d202c3a5baa | 0 | King(int t, boolean w, int x, int y){
super(t,w,x,y);
dist = 1;
int[][] ex = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1}, {-1, 1}, {-1, -1}, {1, -1}};
moves = ex;
} |
f5dfed11-587e-4582-99a8-abc8812deed1 | 1 | @Override
public boolean onPointerMove(int mX, int mY, int mDX, int mDY) {
if(super.onPointerMove(mX, mY, mDX, mDY)) {
return true;
}
targetX = mX;
targetY = mY;
return false;
} |
150f5a7e-fe2b-4242-8e66-a54b1a0e2fd0 | 1 | public static void updateInventory(int[] inv) {
inventoryList.setText("");
for(int i=0; i<inv.length; i++) {
inventoryList.append(Actions.GetItemName((int)inv[i])+"\n");
}
} |
5b680689-0bee-45f1-839f-e77682b8aaf3 | 8 | final public BigDecimal Expression() throws ParseException {
BigDecimal i ;
BigDecimal value ;
value = Term();
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
case MINUS:
;
break;
default:
jj_la1[1] = jj_gen;
break labe... |
92c61a68-59c7-47d9-a445-c685955a261f | 2 | private void parcoursVision(List<ObjectMap> l, Coord v, int i, Coord dep){
//System.out.println(env);
for(int j = 0 ; j < i ; j++){
if(this.env.getCellule(this.coord.add(v)) != null){
l.addAll(this.env.getCellule(this.coord.add(v)).listeObjet());
}
v.addEgal(dep);
}
} |
d64457d3-5372-4937-be9e-d5fef0eee289 | 2 | static final public Map mapOf(Object... objs) {
HashMap<Object, Object> m = new HashMap<>();
for (int i = 0; i < objs.length; i += 2) {
Object key = objs[i];
if (i + 1 < objs.length) {
Object value = objs[i + 1];
m.put(key, value);
} else {
m.put(key, null);
}
}
return m;
... |
5eb49971-0b71-4b1d-877d-26c6871d3a09 | 1 | public long getActiveUserId() {
return this.has("activeUserId")?(long)this.get("activeUserId"):0;
} |
a2012256-c3ab-442b-adf2-f0c01e22d508 | 6 | public static boolean conflitos(Celula[][] sudoku){
for(int g=0;g<=8;g++){
for(int h=0;h<=8;h++){
if(sudoku[g][h].getNumero()!=0){
if((conflitoLinha(g, h, sudoku[g][h].getNumero(), sudoku)) || (conflitoColuna(g, h, sudoku[g][h].getNumero(), sudoku)) || (conflitoBo... |
179d6768-a9e7-46c3-b721-d8830f58bbde | 4 | @SuppressWarnings("unchecked")
private void logEvent(EventType type, Object value, StateMachine<?, TransitionInput> machine) {
if (allowedEventTypes == null || allowedEventTypes.contains(type)) {
observedEvents.add(new Event(type, value, (StateMachine<?,Object>)machine));
}
} |
108a8488-38fd-4971-a195-5c51bc6b5899 | 0 | protected String[] getViewChoices() {
return new String[] { "Noninverted Tree", "Inverted Tree",
"Derivation Table" };
} |
27f952f5-9c26-40c7-86cb-2cd04a8d8fa7 | 7 | public void HandleInputData(byte[] data) {
// String out = new String(data);
// System.out.println("Read bytes from socket:" + out);
// System.out.print("Len: " + data.length + ": ");
// System.out.println(" " + Hex.encodeHexString(data));
for (int i = 0; i < data.length; i++) {
... |
80a1e64b-21f0-4ac9-a0d3-63e22ed2ca56 | 1 | @Test
public void testListImpl() {
NoteService s = new FilebasedNoteService("f:/tmp/MySecretNoteStorage_DEBUG/");
for (Iterator<NoteEntity> iter = s.list().listIterator(); iter.hasNext();) {
NoteEntity note = iter.next();
System.out.println(note);
}
} |
460c4362-7d41-4b14-84ae-bfc218513033 | 3 | public static boolean movement() {
return RIGHT.press() || LEFT.press() || UP.press() || DOWN.press();
} |
af7875a3-1e04-4001-b586-c011c9656cc4 | 8 | private Object execSub(Context cx, Scriptable scopeObj,
Object[] args, int matchType)
{
RegExpImpl reImpl = getImpl(cx);
String str;
if (args.length == 0) {
str = reImpl.input;
if (str == null) {
reportError("msg.no.re.input.... |
c276ff2d-aaec-42ac-a903-88128c240482 | 1 | private static String checkNotNull(String value) {
if (value == null) {
return "";
}
return value;
} |
85d2227c-e673-4b0b-97d8-17e76537b8c5 | 8 | @Override
protected ColumnNode selectColumn() {
ColumnNode resultNode = null;
int minSize = Integer.MAX_VALUE;
int ties = 0;
for (ColumnNode node = head.right; node != head; node = node.right) {
if (node.size < minSize) {
minSize = node.size;
resultNode = node;
ties = 1;
} else if (node.size ... |
3cf42c31-43b6-4e5c-9599-8586794fbbfc | 5 | private void paintRow(Graphics g, int rowIndex) {
DataTableModel model = (DataTableModel) table.getModel();
DataRow row = model.getRow(rowIndex);
DataCategory category = null;
if (row instanceof DataCategory) {
category = (DataCategory) row;
}
int numColumns = table.getColumnCount();
for (int column ... |
a48bfda2-2708-458e-807a-a6f1cdceb05a | 4 | private void updateContent(InetAddress iaIn, String strStatus) {
InetAddress iaTmp = this.normalizeAddressIfLocal(iaIn);
int iIdx = this.idxContact(iaTmp);
if(iIdx<=-1) return;
EzimContact ecTmp = this.getElementAt(iIdx);
if(ecTmp ==null||!(ecTmp.getAddress().equals(iaTmp))) return;
int... |
8e267151-0e15-414c-b41f-bbeb7700e56d | 6 | private String indexToMsg(int i) {
switch (i){
case 1: return "callnumber";
case 2: return "isbn";
case 3: return "title";
case 4: return "mainAuthor";
case 5: return "publisher";
case 6: return "year";
}
return "";
} |
0ea4a14a-97c9-4be5-b6f5-55f51e1a4c74 | 3 | private double getTypicalCost(Location startLoc, Location goalLoc) {
int left = Math.min(startLoc.x, goalLoc.x);
int top = Math.min(startLoc.y, goalLoc.y);
int right = Math.max(startLoc.x, goalLoc.x);
int bottom = Math.max(startLoc.y, goalLoc.y);
int count = 0;
int sum = 0;
for (int i = left; i <= right;... |
d181f1db-b06d-4f5c-a594-ab95efb486ef | 1 | public RTsemBuffer () {
Buffer buff = new Buffer();
Producer p = new Producer(buff);
Consumer c = new Consumer(buff);
c.start();
p.start();
System.out.println("\n\n"+"RTsemBuffer: Threads are running ...");
try {
p.join();
// Give consumer 10s to complete its work, then stop it.
Thread.sleep(1000... |
d18362b7-f055-48d3-a0b8-7bb3d2b98c3c | 9 | @Override
Action afterReadingFromServer(ClientSession session) {
if(!this.hasRestrictions) {
Action r = super.afterReadingFromServer(session);
if(BufferUtils.byteBufferToString(r.getBuffers()).startsWith("+OK")) {
session.getClient().dropMail();
}
return r;
}
if(this.retrievalErr... |
eb2f143d-59b9-487a-83d6-0761cae1f20d | 7 | static private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 40:
return jjStopAtPos(0, 12);
case 41:
return jjStopAtPos(0, 13);
case 42:
return jjStopAtPos(0, 7);
case 43:
return jjStopAtPos(0, 5);
case 45:
return jjStopAtPos(0,... |
ff350b2a-0465-4b85-8388-9fc9f5da2930 | 0 | public static void main(String[] args) {
Random rand = new Random(47);
List<Pet> pets = Pets.arrayList(7);
System.out.println("1: " + pets);
Hamster h = new Hamster();
pets.add(h); // Automatically resizes
System.out.println("2: " + pets);
System.out.println("3: " + pets.contains(h));
pets.remove(h);... |
e45bb8f6-09e9-4542-8fe0-7af168662f6f | 6 | private final void activateItemReactors(final MapleMapItem drop, final MapleClient c) {
final IItem item = drop.getItem();
for (final MapleMapObject o : getAllReactor()) {
final MapleReactor react = (MapleReactor) o;
if (react.getReactorType() == 100) {
if (reac... |
bbcb4497-00d2-4b52-a64a-b4192d5cfe56 | 8 | private void selectedMenu_Item_Selection(){
Ray ray = new Ray(mouseWorldPosition(), mouseWorldDirection());
CollisionResults results = new CollisionResults();
((Node)mainMenu).collideWith(ray, results);
if(results.size() > 0){
ButtonControl bc = results.getC... |
d22ab816-1530-403a-b2ec-ab6df56eb3bf | 1 | public void fillWithSquares(Map<Position, Square> squareMap) {
if (!squares.isEmpty())
throw new IllegalStateException("This Grid already has squares.");
squares.putAll(squareMap);
} |
7aacbc73-c09d-416d-9057-64a5b9f2e52e | 8 | @Override
public void mousePressed(MouseEvent e) {
Tile temp = (Tile) e.getSource();
System.out.println("x: " + temp.x + "y: " + temp.y + "z: " + temp.z);
if (isFree(temp) && firstTileSelected == null) {
firstTileSelected = temp;
select(firstTileSelected);
return;
} else if (temp == firstTileSelected)... |
718f995f-70b5-47e6-a53b-80cb7469c1c5 | 0 | public void setZ(double z) {
this.z = z;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.