method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
992e4c86-969a-45b4-a4a8-2f2669d65858 | 8 | private void checkPaddles(Paddle left, Paddle right) {
int edgeOfPaddle = left.getCoordinates()[0] + left.getWidth();
// if ball is to the left of left paddle in relation to X-position...
if(coordinates[0] + deltaX <= edgeOfPaddle && coordinates[0] + 2*radius + deltaX >= left.getCoordinates()[0]) {
int left... |
d16b03d3-8857-48ac-aa61-38769a5587ba | 5 | @Override
public Class<?> getColumnClass(int col) {
switch (col) {
case 0:
case 1:
case 2:
case 3: return String.class;
default:
return null;
}
} |
a59fa08f-c6b2-4248-a267-76576693c873 | 1 | public void passEvent(Event event) {
for(Processor processor : this) {
processor.recieveEvent(event);
}
} |
b8a03ac8-1412-408b-b1c0-cbee260080cd | 5 | public String processInputMessage(String message) {
/**
* Firstly: check to see if the message was a command:
*/
if(message.charAt(0) == '/') {
System.out.println("Client has issued a command!");
/*
* Handle any arguments provided, splitting into strings
* at spaces - all added into an array.... |
e8c480e0-35f5-4bc6-ab62-5f326b9e8697 | 5 | @Override
public String toString() {
String path = "";
String separator = System.getProperty("file.separator");
if(System.getProperty("os.name").contains("Windows")) {
if(isRoot) {
path += pathelements.get(0).toString().toUpperCase() + ":" + separator;
pathelements.remove(0);
}
}
else {
if(i... |
b53b3035-aa4b-410e-a1e7-944e42f8dd9d | 5 | @Override
public synchronized void onApplicationEvent(ContextRefreshedEvent event) {
try {
if (persistenceService.count(Beer.class) == 0) {
CSVReader reader = new CSVReader(new FileReader(resource.getFile()));
reader.readNext(); //skip first line with headers
... |
c5819afb-2bf6-4c2b-9e3a-0385bfc4db8d | 4 | public boolean validatePosition(EnumLine line, EnumColumn column,
boolean vertical, EnumElement vessel) {
final int initLinePosition = line.getPosition();
final int initColumnPosition = column.getPosition();
for (int i = 1; i < (vessel.getLength() + 1); i++) {
if (vertical) {
line = EnumLine.getEnumLi... |
21dfb5e3-0616-45d2-a35e-3a249635ba86 | 7 | private void separateCommonEdges(ArrayList shapes){
float offset = getMinimumOfCellDimension() / 5;
ArrayList<ShapeEdge> edges = new ArrayList<ShapeEdge>();
//get all adges
Iterator it = shapes.iterator();
while (it.hasNext()) {
DiagramShape shape = (DiagramShape) it.next();
edges.addAll(shape.getEdg... |
c9a15575-924c-4a36-909a-310435ccc0cd | 9 | private static Object fetchPrimitiveArrayValue(Object array, int index, Class<?> componentType) {
if (long.class.equals(componentType)) {
return ((long[]) array)[index];
}
if (int.class.equals(componentType)) {
return ((int[]) array)[index];
}
if (boolean.class.equals(componentType)) {
return ((boole... |
669db672-a54e-4220-8760-ebab2ac7cbb7 | 8 | @Override
public void valueUpdated(Setting s, Value v) {
String setting = s.getName();
if (setting.equals(Text)) {
if (!loopFlag_) {
loopFlag_ = true;
if (textField_ != null)
textField_.setText(v.getString());
} else
loopFlag_ = false;
} else if (setting.equals(Trigger)) {
try {
Tex... |
6681ea92-a4f3-4d21-ae40-c05d8d6152eb | 8 | public void move(){
if(getDirection() == Moveable.RIGHT)
setX(getX() + speed);
else if(getDirection() == Moveable.LEFT)
setX(getX() - speed);
else if(getDirection() == Moveable.UP)
setY(getY() - speed);
else if(getDirection() == Moveable.DOWN)
setY(getY() + speed);
if(getX() <= 0)
setDirecti... |
a3266656-0459-4b68-85f5-16c46732ace8 | 1 | public static void setPropertyDefaultAsString(PropertyContainer container, String key, String default_value) {
if (container != null) {
container.setPropertyDefault(key, default_value);
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} |
c73d6ee1-c849-4c38-829b-30ccf0eab278 | 0 | public String getName()
{
return name;
} |
630c6aa0-8c44-40a6-bc4c-2760ce06eba1 | 1 | public static void main(String[] args)
{
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("Javascript");
try
{
engine.eval("");
}
catch(ScriptException ex)
{
ex.printStackTrace();
... |
474bd405-7950-4d69-bacd-32f2a3685f66 | 4 | @Override
public void execute() {
Forum forum;
try {
forum = ForumParser.parse(controller.forumDisplay(REPORTED_POSTS_FORUM_ID));
} catch (IOException e) {
controller.getModel().setReportSearchTask(null);
logger.warn("Failed to parse forum.", e);
stop();
return;
}
for (ForumThread thread : fo... |
4855c96f-c8f9-4a4e-aff1-7997492c7b76 | 5 | public Object nextEntity(char ampersand) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... |
d17ac41e-d9de-431f-a742-83d20ac17121 | 8 | public static ArrayList<ArrayList<Integer>> obtenerRestricciones(String operacion) {
ArrayList<ArrayList<Integer>> restricciones = new ArrayList<>();
ArrayList<Integer> posiciones;
boolean existeRestriccion = false, bandera = false;
for (int i = 0; i < operacion.length(); i++) {
... |
acb7996d-6293-4de2-83e3-e5e12ab1ff3c | 9 | public void previewFile (String filePath) {
Ctabinterface singleSource = null;
String fileName = null, callableFunction = null;
if (filePath == null) {
synchronized (tabbedPaneLocker) {
singleSource = (Ctabinterface) tabbedPane.getSelectedComponent();
}
... |
0c40e1a7-f9d3-4d5d-8f7f-84852476e80a | 3 | public void actionPerformed(ActionEvent ev)
{
try
{
AreaConhecimento objt = classeView();
if (obj == null)
{
long x = new AreaConhecimentoDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION_MES... |
b0522f3d-46bb-4369-8ffd-16ec40d8e893 | 1 | public static Parametros getInstance(){
if (instance==null) {
instance = new Parametros();
}
return instance;
} |
cd2d9a64-9b8e-4152-8851-8ecb4f2fd6fd | 3 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled()) return;
if (!ChunkyManager.getChunkyWorld(event.getTo().getWorld().getName()).isEnabled()) return;
ChunkyChunk toChunk = ChunkyManager.getChunkyChunk(event.getTo());
... |
95a0a7bc-b38d-4488-a2ae-3336ce700f58 | 8 | public void run(long millisBetweenPhases) {
long time, sleepTime;
this.stop = false;
while(!stop && !this.finalStateAchieved()) {
time = - System.currentTimeMillis();
//Execute the handlers before running the phase
for(RunEnviron... |
66f3b493-caf3-4e18-a1bc-8a39ce1667dc | 6 | private int find(ArrayList<Integer> current, HashMap<Integer, Boolean> diagonal1,
HashMap<Integer, Boolean> diagonal2, int n) {
int result = 0;
if (current.size() == n) {
return 1;
} else {
//find available column
int row = current.size();... |
18af0a92-27e3-48bc-ab68-2f24c23df08a | 8 | @Override
public void getDatas() throws IOException, SAXException, ParserConfigurationException {
try {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream input = new FileInputStream("src/main/resources/xsd-xml/Delivery.xml");
XMLStreamReader stream... |
0a58bf29-f0b8-413a-a13b-42248cedcfa2 | 5 | public int editDistance(String s1, String s2)
{
int m=s1.length();
int n=s2.length();
int[][]d=new int[m+1][n+1];
for(int i=0;i<=m;i++){
d[i][0]=i;
}
for(int j=0;j<=n;j++){
d[0][j]=j;
}
for(int j=1;j<=n;j++){
for(int i=1;i<=m;i++){
... |
67d8ca9b-a533-4d4c-8b16-b6cf77005952 | 4 | private static boolean hasNodeStyleClass(Node node, String className) {
String c = DOM.getElementAttribute(node.<com.google.gwt.user.client.Element>cast(), "class");
if (c != null && c.length() > 0) {
String[] classes = c.split(" ");
for (int i = 0; i < classes.length; i++) {
... |
5f86f389-792e-44de-9914-4b3b9dd6a7db | 2 | public String getTag(String compSHDataStr) {
final String tagBase64Str;
final byte[] tagBytes;
final byte[] cipherTextBytes;
final String HMACType = "HmacSHA256";
// TODO clean correct/cleanup try/catch
try {
SecretKeySpec SKSHMACKey = new SecretKeySpec(HMACK... |
1e2cc156-2aab-4b76-b4af-49d3ef52ceb6 | 3 | public void setSetpointRelative(double setpoint){
if(m_pidMode == DRIVE_TO_DISTANCE_MODE){
super.setSetpoint(ultrasonic.getRangeInches());
super.setSetpointRelative(setpoint);
}else if(m_pidMode == DRIVE_TO_ANGLE_MODE || m_pidMode == ROTATE_TO_ANGLE_MODE){
super.setSe... |
d30efd53-9fe3-4532-8e52-39b1683e3da5 | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
f4a3e8bb-6cee-436f-a76e-cca6f7e11675 | 1 | @Test
public void tiedostonLukeminenToimiiFailillaSyotteella(){
kirjoitaFailinmuotoinenSyote();
tiedot.LueTiedotTiedostosta();
String mappiinTallennetutTiedot = "";
HashMap<String, Integer> kartta = tiedot.getOpiskelut();
for (String avain: kartta.keySet()){
... |
f415dc2d-e368-4fb3-a1ec-dc588053aae0 | 4 | public List<String> lerArquivo(String pArquivo)throws Exception
{
File f = new File(pArquivo);
List<String> retorno = new ArrayList<String>();
try
{
BufferedReader in = new BufferedReader(new FileReader(f));
String line;
... |
6dd7da52-9254-4de4-9767-2aa2104e3936 | 0 | @Test
public void compareHands_TwoFullHousesWithSameTripsSamePairs_HandsAreEqual() {
Hand p1 = Hand.FullHouse(Rank.Four, Rank.Nine);
Hand p2 = Hand.FullHouse(Rank.Four, Rank.Nine);
assertTrue(p1.compareTo(p2) == 0);
} |
f8e805ff-d9c3-444c-8f15-e32093cf0818 | 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 Endereco)) {
return false;
}
Endereco other = (Endereco) object;
if ((this.id == null && other.id != null) || (... |
1eb0a893-99ba-45c8-8842-a2446da8248a | 3 | public void sample(int position) {
// Ignore counts for zero or one-length chromosomes
if (length <= 1) {
// Gpr.debug("Warning: Chromosome '" + chrName + "' has length " + chrLength);
return;
}
int i = position / factor;
if ((i >= 0) && (i < count.length)) {
count[i]++;
total++;
} else Gpr.deb... |
16315357-1d1b-43aa-8b73-179ae3938d08 | 4 | private void loadID3v2(InputStream in)
{
int size = -1;
try
{
// Read ID3v2 header (10 bytes).
in.mark(10);
size = readID3v2Header(in);
header_pos = size;
}
catch (IOException e)
{}
finally
{
try
{
// Unread ID3v2 header (10 bytes).
in.reset();
}
catch (IOExcepti... |
e1143ff1-6af0-45a6-ba28-9f1abfc6ea6f | 7 | private void printMWList(){
CSVWriter csvW = new CSVWriter();
Set<String> callees = midwarereferences.keySet();
for(String callee : callees){
if(callee.equals("DEFAULT XFB-routine")){
ArrayList<String> callers = midwarereferences.get(callee);
if(callers!=null){
for(String caller : callers){
... |
29022c7c-1d4a-4ee1-b0af-d890d3ef7fdd | 7 | private Direction decideMove(CurrentCell cell) {
log(String.format("(%d, %d) [E:%s, W:%s, N:%s, S:%s]", cell.getX(), cell.getY(), cell.getEast(), cell.getWest(), cell.getNorth(), cell.getSouth()));
RouteState eRouteState = RouteState.valueOf(cell.getEast());
RouteState wRouteState = Rou... |
a36970cc-25bf-447e-a802-25cc664128a1 | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
acc9e4c5-1202-47ec-b756-d926c2182b4b | 7 | private static void update() {
if (enabled) {
panel.removeAll();
comps.clear();
for (String s : strings.keySet()) {
comps.add(new JLabel(s + ": " + strings.get(s)));
}
for (String s : integers.keySet()) {
comps.add(new ... |
fc777545-cfbd-45ca-8df8-286fdeeede9d | 2 | public static boolean channelExists( String name ) {
for ( Channel c : channels ) {
if ( c.getName().equals( name ) ) {
return true;
}
}
return false;
} |
074ef206-2986-43f5-baa8-812bc3480211 | 3 | private String showParamHelp(ParamCons cons) {
StringBuilder rtn = new StringBuilder();
rtn.append(cons.name);
rtn.append(' ');
rtn.append('{');
switch(cons.type) {
case ParamCons.INTEGER:
rtn.append("Integer");
break;
case ParamCons.STRING:
rtn.append("String");
break;
}
rtn.append("} ... |
f30fb6e0-b61a-44a5-b77c-d53ed8e152e2 | 7 | short deinitialize()
{
if (!is_init)
{
MsgDumperCmnDef.WriteErrorSyslog(__FILE__(), __LINE__(), "Library has been initialized");
return MsgDumperCmnDef.MSG_DUMPER_FAILURE_INCORRECT_OPERATION;
}
short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS;
// Notify to DeInitialize the worker thread
for (int i = 0 ;... |
367990b4-1fae-48ce-a124-ef9c44e07276 | 9 | public RPMInfo resolve(RPMRequest req) throws Exception {
loadRepoInfo();
List<RPMInfo> rpms=rpmInfo.get(req.name);
if(rpms!=null&&!rpms.isEmpty()) {
RPMInfo resolved=null;
for(RPMInfo info:rpms) {
if(req.arch==null||info.arch.equals(req.arch)) {
... |
db521b2c-d129-47c4-8254-edf89dd5a762 | 0 | public void setVerbose(boolean verbose) {
this.verbose = verbose;
} |
44f78240-ef4c-4239-8455-23f6af235a4f | 2 | public String getSaveFileFormatNameForExtension(String extension) {
String lowerCaseExtension = extension.toLowerCase();
for (int i = 0, limit = savers.size(); i < limit; i++) {
SaveFileFormat format = (SaveFileFormat) savers.get(i);
if (format.extensionExists(lowerCaseExtension)) {
return (String) saverN... |
ff50740e-09db-4f80-aba4-a62b84d6cab0 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.T... |
c94e7fd9-fdc9-4213-a7b0-72d37ea7828c | 5 | public void actionPerformed( ActionEvent e )
{
int hash = e.getActionCommand().hashCode() ;
// System.out.println("Action from " +e.getID() +" " +e.getActionCommand()) ;
// enter comes only, if the data of the sender has been changed
if ( hash == "enter".hashCode() )
{
adoptData( e.getID()... |
f9d7e478-e2f9-4807-8ba0-87b0d7335412 | 8 | public static void drawPortal(
QTRenderNode n, float nodeSize, float ncx, float ncy, float distance,
Display disp, float scx, float scy, float scale
) throws ResourceNotFound {
// clip to actual region on screen being drawn at
float dscale = scale/distance; // Scale, taking distance into account
float ... |
8723bfc2-aee0-4f5e-805d-80f1abf84a19 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
b495df5e-d3a6-4e5e-ac97-709161e9a405 | 0 | @Override
public BeerResponse addBeer(BeerRequest beerRequest) {
BeerReadOnly beerReadOnly = barService.addBeer(beerRequest);
return new BeerResponse(beerReadOnly);
} |
2fc54f16-00d7-4788-97f7-d29c1ffad56a | 2 | public static void main(String[] args) throws IOException
{
decodeCombined decoder = new decodeCombined();
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0])));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1])));
String recie... |
59f6a8bf-9bce-4757-9edf-a6272a38a4d9 | 0 | public GUI() {
setTitle("Snake Timo");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
setFocusable(true);
setBounds(new Rectangle(595, 624));
setExtendedState(Frame.MAXIMIZED_BOTH);
game = new Game(getBounds().getSize());
spie... |
3be33d2d-d31c-4179-8d25-8053e5abd6c3 | 8 | public void run() {
//start collectors
for (Konto collector : kontosbox) {
if (collector.getTyp().startsWith("SMTPOutgoingMailServer")) continue;
new MailCollectorThread(emailsbox, collector, sleeptime).start();
}
//start Keeperthread
//accept POP3 incom... |
f940df88-2d2f-42dc-a537-0e9db3fb97fa | 3 | @Override
public boolean lisaaTyopaiva(Tyopaiva tyopaiva) {
boolean loytyikoTyopaiva = false;
for (Tyopaiva tyopaiva1 : tyopaivat) {
if (tyopaiva.equals(tyopaiva1)) {
loytyikoTyopaiva = true;
}
}
if (!loytyikoTyopaiva) {
tyopaivat.... |
49cda8ff-82f6-4f43-8691-941afb4c21b8 | 9 | @Override
public void doSteps(){
if(lastImpr >= MIN_PROG){
stuck = true;
int addIndex;
double etime = System.currentTimeMillis() + repTime;
int i=0;
while(( (nrOfSteps > 0 && i < nrOfSteps)
|| (repTime > 0 && System.currentT... |
2f27e991-7156-4b08-8664-46672ad8a8e2 | 5 | private void updateBuddies(int characterId, int channel, int[] buddies, boolean offline) {
final PlayerStorage playerStorage = server.getPlayerStorage();
for (int buddy : buddies) {
final MapleCharacter chr = playerStorage.getCharacterById(buddy);
if (chr != null) {
final BuddylistEntry ble = chr.getBuddy... |
fd76f264-c2e2-4780-9c25-8e46303c7a04 | 2 | public void essayerSortirPrison(Dices dices) throws NoMoreMoneyException
{
//Si le nombre d'essai est dépassé
// TODO : incohérence dans les notifications
if(cptPrison == 3)
{
sortirPrison();
payer(50);
setChanged();
}
else
{
//Si on obtient un double
if(dices.isDouble()) {
sor... |
69e9c609-1046-4519-9b9e-ab5191f36a05 | 0 | public void setIsSelected(Boolean isSelected) {
this.isSelected = isSelected;
} |
b2d4841b-b4b9-4531-a91e-736e78a02bee | 0 | public void setPassRate(Integer passRate) {
this.passRate = passRate;
} |
907ed43f-7d9a-4089-b149-9a622201a377 | 9 | public int[] intersection(int[] nums1, int[] nums2) {
if (nums1 == null || nums1.length == 0 || nums2 == null || nums2.length == 0) {
return new int[0];
}
Arrays.sort(nums1);
Arrays.sort(nums2);
int i = 0, j = 0;
List<Integer> list = new ArrayList<Integer>();
while (i < nums1.length && j < num... |
fd9fcac4-1e11-41a5-b8b8-3c0ef3e12a2b | 7 | public static int getNextNullTerminator(byte[] buffer, int startingFrom, Charset charset)
{
int index=0;
if (charset.equals(CHARSET_ISO_8859_1))
{
for(index=startingFrom; index<buffer.length && buffer[index] != 0; ++index);
}
else if (charset.equals(CHARSET_UTF_16))
{
... |
784b8362-9e9a-42e2-8149-2998cb9cf0a8 | 7 | private static void buildFilesForRecoveryTemplates(
String indexFilename,
String templatesFilename,
char[] newTerminalIndex,
char[] newNonTerminalIndex,
String[] newName,
char[] newLhs,
String[] tokens) {
int[] newReverse = computeReverseTable(newTerminalIndex, newNonTerminalIndex, newName);
char[] newRecove... |
ee93f97f-62df-4aed-aada-9caf8c01c70c | 8 | public void updateSizesAndHeights() {
double assignedHeight = 0;
int unassigned = 0;
double hr = 0.0;
// for each btc in the tp
for (Iterator<BaseTableContainer> it = rowList.iterator(); it.hasNext();) {
BaseTableContainer comp = it.next();
hr = comp.getHe... |
1091b253-ff90-4666-ba4a-9a5c2fbe0282 | 5 | public ServiceDescriptor findServiceByName(String name) {
// Don't allow looking up nested types. This will make optimization
// easier later.
if (name.indexOf('.') != -1) {
return null;
}
if (getPackage().length() > 0) {
name = getPackage() + '.' + name;
}
fin... |
0ba2e471-1cb0-41bc-9fc3-661723679d7b | 4 | @Override
public void onSetFileAttributes(String path, int fileAttributes, DokanFileInfo fileInfo)
throws DokanOperationException {
try {
path = mapWinToUnixPath(path);
fileSystem.setWindowsAttributes(path, new WindowsAttributes(fileAttributes));
} catch (PathNotFoundException e) {
throw new DokanOpera... |
d14d66c9-9938-4807-8e14-e1ed013cbd6c | 3 | private void remove() {
try {
Agent agent;
int i;
int option;
UI.printHeader();
System.out.println(agents.size() + " agentes activos:");
System.out.println("");
for (i = 0; i < agents.size(); i++) {
agent = agents.get(i);
System.out.println((i + 1) + ") Agente: "
+ agent.getType()... |
bafe9c22-8e3a-4f72-9b44-18a3adad93a9 | 7 | private void closeChannels() {
try {
if (serverSocketChannel != null && serverSocketChannel.isOpen())
serverSocketChannel.close();
if (datagramChannel != null && datagramChannel.isOpen())
datagramChannel.close();
if (stdin != null && stdin.isOpen())
stdin.close();
} catch (IOException e) {
e... |
bb2f2751-5ed6-4308-98aa-44359a44e3c6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UnixTimeInterval other = (UnixTimeInterval) obj;
if (end == null) {
if (other.end != null)
return false;
} else if (!end.equals(other.en... |
8b55f3e5-4c00-4559-bd56-95184079ab28 | 9 | @Override
public void run() {
if (ctx == null) {
return;
}
if (ctx.getFile() == null) {
return;
}
File root = ctx.getFile();
if (!root.isDirectory()) {
logger.debug("root " + root.getAbsolutePath() + " is not directory!");
return;
}
if (!root.exists()) {
... |
600f83e2-c253-4c83-ad28-3c6e55702ca7 | 8 | public void actionPerformed(ActionEvent e) {
String ac = e.getActionCommand();
if (ac.equals("gotoStart")) {
pauseButton.doClick();
gotoStart();
update();
} else if (ac.equals("stepBack")) {
pauseButton.doClick();
stepBack();
update();
} else if (ac.equals("playBack")... |
a36956f8-3198-414c-a0c6-afef19569953 | 1 | private void emitCode() {
LinkedList worklist = new LinkedList();
// Create an instantiation of the "root" subroutine, which is just the
// main routine
worklist.add(new Instantiation(null, mainSubroutine));
// Emit instantiations of each subroutine we encounter, including the
... |
df5a7644-f3f9-40e1-8f95-8139f2d37148 | 2 | public OfflinePlayer[] getGhosts() {
validateState();
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>(ghostTeam.getPlayers());
// Remove all non-ghost players
for (Iterator<OfflinePlayer> it = players.iterator(); it.hasNext(); ) {
if (!ghosts.contains(it.next().... |
93747ee5-259f-4230-84d6-903936e7717d | 2 | public static void main(String args[])
{
// remember to have this print your own name instead of I. Forgot
System.out.printf("CS261 - Assignment 2 - Kevin Bui%n%n");
// get command line arguments
if (args.length != 5) {
System.out.println("requires 5 arguments: nGames,... |
8eb30820-8d7f-44a0-8da7-c970d7b783ab | 3 | public void setValue(int current) {
int newCurrent = current < 0 ? 0 : current > max ? max : current;
if(newCurrent != this.current) {
this.current = newCurrent;
updateBarSize();
}
} |
9b154f88-05da-4ba7-ac22-63b7ffb88256 | 3 | public void setPalette(int[] rgb)
{
if (rgb.length < 1 * 3 || rgb.length > 256 * 3)
{
throw new IllegalArgumentException("PNGEncodeParam0");
}
if ((rgb.length % 3) != 0)
{
throw new IllegalArgumentException("PNGEncodeParam1");
}
palette = (rgb.clone());
paletteSet = true;
} |
2bf73e15-4176-4b13-b17b-bb3caa714831 | 6 | public void refreshPanel() {
if (Sessie.getIngelogdeGebruiker().heeftPermissie(
PermissieHelper.permissies.get("INZIENALLESTUDENTEN"))) {
comboBox.removeAllItems();
comboBox.addItem("Selecteer een leerling...");
for (User student : Dao.getInstance().getStudenten()) {
comboBox.addItem(student);
}
... |
b0694d35-c10d-4a92-b18f-d8f98048a007 | 5 | public void move(int xa, int ya)
{
//Directions:
// 0
// 3 Player 1
// 2
if (xa > 0)
{
dir = 1;
}
if (xa < 0)
{
dir = 3;
}
if (ya > 0)
{
dir = 2;
}
if (ya < 0)
{
dir = 0;
}
if (!collision())
{
x += xa;
y += ya;
}
} |
b143de2a-fd6c-40fd-94c9-f498a29c3813 | 5 | public void testBigKey250() throws TimeoutException, MemcachedException {
String readObject = null;
String key = null;
StringBuilder keyPrefix = new StringBuilder();
for(int i=0;i<249;i++) {
keyPrefix.append("k");
}
//1 - String
key = keyPrefix.toString()+"1";
c.set(key, 3600, "World");
readO... |
30feb951-0df4-4e07-9a10-ad511519204e | 2 | public void changeQuestLevel(int level){
//to account for starting at level 0
level += 1;
for(Reward reward : this.rewards){
reward.scaleMoneyReward(level);
}
for(Objective objective : this.objectives){
objective.scaleToLevel(level);
}
} |
7e1682a6-899c-4a22-b4d0-33de20e0d39e | 6 | @Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if(!name.startsWith("javablock.plugin")){
}
ZipEntry entry = this.file.getEntry(name.replace('.', '/') + ".class");
if (entry == null) {
return global.Classes.loadClass(name);... |
03c92960-2a9d-4edf-82e2-760b4edcb338 | 8 | public synchronized boolean equals(Object obj) {
if (!(obj instanceof PingResult)) return false;
PingResult other = (PingResult) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
... |
ecc68f4a-9923-4d8b-a2f5-2d4399f9b4d1 | 7 | public static void main (String aa[]){
String hostname = "10.200.252.104";
String username = "loadruser";
String password = "PerfTest4QA";
Connection conn = new Connection(hostname);
try {
conn.connect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... |
3cec92e1-42e3-44ef-9761-49f9585f54fd | 3 | private void loadAttributes(boolean createIfNotExists) {
if (this.attributes == null) {
NbtTagCompound nbt = NbtFactory.readFromItemStack(this.stack);
this.attributes = nbt.getList("AttributeModifiers");
if (createIfNotExists && this.attributes == null) {
Nbt... |
9d80395e-acc7-44db-873b-925578ea486d | 3 | public Integer length() {
int length = this.s.length() + 2;
if (this.encrypt) {
length += 2;
}
if (this.conflict > 0) {
length += 2;
for (final String c : this.conflictFiles) {
length += 6 + c.length();
}
}
return length;
} |
ca09de2c-4b8a-4c79-a761-a502ee4ea5f7 | 3 | private void readZoomLevelHeader(long fileOffset, int zoomLevel, boolean isLowToHigh) {
LittleEndianInputStream lbdis = null;
DataInputStream bdis = null;
byte[] buffer = new byte[ZOOM_LEVEL_HEADER_SIZE];
try {
// Read zoom header into a buffer
fis.seek(file... |
94f049dd-a17b-41cc-985e-02fab9d7f762 | 6 | public void execute() {
Process pro;
try {
// This three lines gives you time to kill some process so that you
// can simulate node failure and see if it recovers correctly
/*
System.out.println("[Reducer] Force to sleep");
Thread.sleep(10000);
System.out.println("[Reducer] wake up");
... |
24903484-7a9b-4d24-830b-d926ce220634 | 4 | public static Path writeMatrix(double[][] matrix, Path path,
HamaConfiguration conf) {
SequenceFile.Writer writer = null;
try {
FileSystem fs = FileSystem.get(conf);
writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class,
VectorWritable.class);
for (int i = 0; i < matrix.length; i++) {
... |
59933b3f-90a3-4481-a6cb-6a43995ae73e | 4 | private void processBuffer()// throws EOFException
{
if(bufferLength < HEADER_SIZE)
return;
justConnected = false;
Boolean isPacketReceived = bytesNeeded <= bufferLength;
if (!isPacketReceived)
{
//log.debug("packet is not received yet " + bufferLength+", " + bytesNeeded);
return;
}
inputBuf... |
fff5b0d7-eb76-4f3f-a639-e40dbef2b9f9 | 6 | protected static Ptg calcMinA( Ptg[] operands )
{
Ptg[] alloperands = PtgCalculator.getAllComponents( operands );
if( alloperands.length == 0 )
{
return new PtgNumber( 0 );
}
double min = Double.MAX_VALUE;
for( Ptg alloperand : alloperands )
{
Object o = alloperand.getValue();
try
{
doubl... |
9b645959-d64d-4374-a78a-79f6f233cea0 | 1 | @Override
public boolean isDiagonalObstacle(Element elementPassingThrough, Element otherDiagonalElement) {
if (otherDiagonalElement instanceof LightTrailPart)
return ((LightTrailPart) otherDiagonalElement).isDiagonalObstacle(elementPassingThrough, this);
return false;
} |
2df91e12-8f25-43cc-833e-298169711875 | 8 | private static void svm_group_classes(svm_problem prob, int[] nr_class_ret, int[][] label_ret, int[][] start_ret, int[][] count_ret, int[] perm) {
int l = prob.l;
int max_nr_class = 16;
int nr_class = 0;
int[] label = new int[max_nr_class];
int[] count = new int[max_nr_class];
... |
a6543cde-b096-48b0-a74d-80c090bb112f | 4 | private String formatUrlParameters() {
List<String> params = new ArrayList<String>();
if (size != DEFAULT_SIZE)
params.add("s=" + size);
if (rating != DEFAULT_RATING)
params.add("r=" + rating.getCode());
if (defaultImage != GravatarDefaultImage.GRAVATAR_ICON)
params.add("d=" + defaultImage.getCode());... |
f85e94d5-a9f4-4f8f-849d-0aa5a5f6923e | 1 | private void compute_pcm_samples6(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[6 + d... |
a4b0ff25-b154-46df-8a3e-a5f46a03ac65 | 4 | private void modifyCard(){
Card c;
int index;
System.out.println("Enter the index of the card you want to modify:");
index = sc.nextInt();
sc.nextLine();
c = this.deck.searchCard(index);
if(c != null){
if(c instanceof EnergyCard){
this.deck.modifyCard(this.addEnergyCard(),index);
}else ... |
fbb73bcb-8926-4653-bf6b-f1bc5f0856d9 | 7 | public int TreeHeigh(TreeNode root) {
if(root == null) {
return 0;
}
if(root.left == null && root.right == null) {
return 1;
}
int leftHeigh = TreeHeigh(root.left);
int rightHeigh = TreeHeigh(root.right);
if(leftHeigh == -1 || rightHeigh == -1) {
return -1;
}
if(Math.abs(leftHeigh-rightHeigh)... |
1eda4fcb-ff31-4e6d-8150-93c21f5c2330 | 4 | private void acao128(Token token) throws SemanticError {
try {
idAtual = tabela.get(token.getLexeme(), nivelAtual);
if(idAtual instanceof IdentificadorConstante && !indexandoVetorParametro)
parametroAtualPodeSerReferencia = false;
if(idAtual instanceof IdentificadorVariavelCampoRegistro)
thro... |
ebcd5b56-3593-4a43-a66e-2bed130c2512 | 4 | private void drawColoredText(Graphics2D g, String text, int chatType, int startX, int y) {
int currentX = startX;
g.setColor(colorForChatType(chatType));
Pattern pattern = Pattern.compile("<(.*?)>");
Matcher matcher = pattern.matcher(text);
int foundMatches = 0;
int[] ... |
59343b9b-b03f-4dde-84f1-401c74ec9a2b | 8 | public void layoutContainer(Container parent) {
//System.err.println("layoutContainer");
synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets();
int ncomponents = parent.getComponentCount();
int nrows = getRows();
int ncols = getColumns();
if (ncomponents == 0) {
... |
98129079-3fdd-4e46-b1ea-40ed09fb6721 | 2 | public void printMap()
{
System.out.println("Map Dimensions: [" + x + ", " + y + "]");
for(int i = 0; i < height; i++)
{
System.out.print("[");
for(int j = 0; j < width; j++)
{
System.out.print(grid[j][i] + ", ");
}
... |
d366df81-b542-401e-b30b-bc356b71f89f | 8 | private void processFile(File file) throws IOException {
String name = file.getName();
String absPath = file.getAbsolutePath();
String newAbsPath = absPath.replace(REMOVE_FROM_PATH, "");
File newFile = new File(newAbsPath);
log.fine("NEW ABS PATH = " + newAbsPath);
if (name == null || name.length() == 0 ||
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.