method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
70ca726a-80f0-4c60-9e63-15b6f6a6ce0f | 6 | private void addTargetControlsToPanel(JPanel panel, final IntValueHolder targetTypeValueSource, final IntValueHolder targetNumberValueSource)
{
Integer validTargetTypes[] = Event_3_46.getTargetTypes();
Integer targetTypes[] = new Integer[validTargetTypes.length + 1];
targetTypes[0] = new Int... |
e8ccbe1c-3797-408a-bad0-d7324deb6c9d | 2 | public boolean hasRelWithSubsection(int question_ID) {
boolean hasRel=false;
try {
StringBuffer sql = new StringBuffer();
sql.append("select Subsection_ID ");
sql.append("from subsectionquestion_ID ");
sql.append("where Question_ID=" + question_ID);
... |
fb9d6c4a-bfc4-4b0f-858a-e23cbd48b319 | 8 | public String toString() {
StringBuffer sb = new StringBuffer();
// balanced or ordinary OSDL
if (m_balanced) {
sb.append("Balanced OSDL\n=============\n\n");
} else {
sb.append("Ordinary OSDL\n=============\n\n");
}
if (m_weighted) {
sb.append("Weighted variant\n");
}
... |
971c7cf0-08a6-4503-a992-c96c71c401b4 | 1 | public String getValue(String key) {
if(containsKey(key)) {
return getKeyValuePair(key).getValue();
} else {
return null;
}
} |
ead1fe7c-1217-44b8-9f26-4ec9bac86929 | 5 | private void transmitText(String text) {
if (byteJRadioButton.isSelected()) {
boolean ready = false;
Scanner scanner = new Scanner(text);
while (! ready) {
try {
outputStream.write(scanner.nextInt());
}
catch... |
c3926112-7ab5-4b82-885d-e3475ba30707 | 5 | public double mean_as_double() {
double mean = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
for (int i = 0; i < length; i++) {
mean += dd[i];
}
mean /= length;
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
BigDecimal meanbd = BigDecimal.ZERO;... |
b7eb7798-3da0-46b0-892a-ccf730303674 | 3 | private boolean whiteCanEnPassantLeft( int position ) {
return ( this.previousMove != null && pieceTypeAt( position - 1 ) == PAWN && this.previousMove.from() == ( position + 31 ) ) && this.previousMove.to() == ( position - 1 );
} |
e669e1d3-c843-440e-acdd-e52b374a5052 | 2 | private static void enchantedBag() {
System.out.println("enchantedBag");
for (int i = 0; i < enchantedBag.length; ++i) {
if (enchantedBag[i] != null) {
System.out.println(i + ":" + enchantedBag[i]);
}
}
} |
326fdd6e-1399-4ed7-a55f-44791731ef3e | 1 | private boolean isRed(Node node) {
if (node == null)
return false;
return node.color == RED;
} |
9190c09a-2649-49bf-8ffa-16149bde39e0 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,null,givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!target.subjectToWearAndTear())
{ mob.tell(L("@x1 cannot be reinforced.",targe... |
2a81552e-14ab-4613-a811-392951b30281 | 3 | @Override
public boolean logoutClient(final String name) throws RemoteException
{
ServerManager.invokeLater(new Runnable()
{
@Override
public void run()
{
_connectedClients.remove(name);
_spiel.meldeSpielerAb(name);
if(name.equals(_hostName))
{
for(ClientInterface client : _connec... |
5d6959ef-d8e7-4d64-8df2-4dc0c13e72bf | 8 | public void build() {
FileConfiguration fc = new YamlConfiguration();
File f = new File(plugin.getDataFolder(), "custom.yml");
if (f.exists()) {
try {
fc.load(f);
} catch (Exception e) {
if (plugin.getDebug())
plugin.log.warning(e.getMessage());
}
}
for (String name : fc.getKeys(false)) ... |
b2f38c54-07e7-4710-a5a3-0606791bf8bb | 7 | @Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint2 = IntCache.getIntCache(par3 * par4);
... |
5490c5a4-c103-4f61-b665-b9be4cf8993c | 3 | static double[] spawnAveragesArrayFromPricePair(String ticker,
int neighborsToCount) {
double[] priceData = spawnTimeSeriesForFFT(ticker);
double[] avgPriceData = new double[priceData.length];
for (int J = neighborsToCount; J < (priceData.length - neighborsToCount); J++) {
float sum = 0;
int n = 0;
f... |
5cdd26c1-6238-4a5d-a7e3-00c3c3b59b55 | 5 | public void drawEntitiesOnMap(Renderer r) {
Graphics g = r.getGraphics();
for (EntityXML e : entities) {
if (e.getPos().x >= mapDisplayStart.x && e.getPos().x < mapDisplayStart.x + MAP_DISPLAY_NB_TILE_X
&& e.getPos().y >= mapDisplayStart.y && e.getPos().y < mapDisplayStart.y + MAP_DISPLAY_NB_TILE_Y) {
... |
9c789292-7103-40d3-9bbe-ac39d8d62708 | 5 | public static void dump(File f) throws IOException {
try (BTXParser p = new BTXParser(f)) {
String indent = "";
l:
while (true) {
switch (p.next()) {
case ATTRIBUTE : {
BTXAttribute at = p.getEventData().getAttribute();
byte[] buf = new byte[at.getLength()];
at.fill(buf);
Sys... |
101859ca-622c-4ae1-8a9e-5052dbbea311 | 1 | public final int getInt(int index) throws JSONException {
Object o = get(index);
return o instanceof Number ?
((Number)o).intValue() : (int)getDouble(index);
} |
766f3948-119c-42b6-81b4-5e8b3bb5c1b6 | 1 | @Override
public void run() {
if(Thread.currentThread().getId() % 2 == 0)
init("Achtung Die Kurve");
else
init("TicTacToe");
} |
2a25d691-2cc1-458f-bc68-218790489456 | 9 | public static String getSeptaServiceID() {
String servid = null;
String strDateFormat = "EEEE";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
sdf.setTimeZone(TimeZone.getTimeZone("America/New_York"));
String weekday = sdf.format(date);
Format formatter;
String s;
// TODO check cal date for... |
b537c1ac-19f2-4c47-9fea-fd7b6e49509a | 5 | public void random(){
if(leafNode != null){
this.randomNumber = (int)(Math.random()*RANDOM_SINCOS);
}else{
this.randomNumber = (int)(Math.random()*RANDOM_XY+RANDOM_SINCOS);
}
if(this.randomNumber == 0){
this.textFunction = "sin(PI*x*";
}else if(this.randomNumber ==1){
this.... |
858bbb99-bae9-4e81-91c3-db176da7d0a7 | 1 | private void bootToRecoveryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bootToRecoveryButtonActionPerformed
try {
device.reboot(DeviceState.RECOVERY);
adbController.executeADBCommand(false, false, device, new String[]{"wait-for-device"});
} catch (IOEx... |
f6d82537-bfec-4803-ae8a-a112ef35c913 | 3 | public Point[] getCorners() {
Point[] corners = new Point[4];
switch(orientation) {
case X_AXIS:
corners[0] = center.add(new Point(0, 0.5f, 0.5f, 1));
corners[1] = center.add(new Point(0, 0.5f, -0.5f, 1));
corners[2] = center.add(new Point(0, -0.5f, -0.5f, 1));
corners[3] = center.add(new Point(0... |
9c54ad91-eef4-479a-b888-31e3d7b1e12e | 6 | static public boolean hasImageFileExtension(File cl_f) {
String lstr_ext = getFileExtension(cl_f);
lstr_ext = lstr_ext.toLowerCase();
if (lstr_ext.equals("jpg") || lstr_ext.equals("jpeg") || lstr_ext.equals("png") || lstr_ext.equals("bmp") || lstr_ext.equals("tga") || lstr_ext.equals("gif")) {
return true;
... |
8dac3309-cc61-443b-9082-b574bfa2905a | 3 | public void loadPlayers() throws BadConfigFormatException {
//This needs way way way more error checking
try {
FileReader reader = new FileReader("people.txt");
Scanner in = new Scanner(reader);
// set a marker that is true only for the first line
boolean marker = true;
// loop through all the lines
... |
2fe09485-2fca-4865-ae1f-d1d335c9edd4 | 3 | public void registerValueVisitor(Class<?> targetClass, ValueVisitor visitor) {
if (visitors == null) {
visitors = new HashMap<Class<?>, ValueVisitor>(4);
}
visitors.put(targetClass, visitor);
} |
aad520e1-fab9-44d6-af8d-1bd2d312e9a8 | 1 | @Override
protected void processFocusEvent(FocusEvent event) {
super.processFocusEvent(event);
if (event.getID() == FocusEvent.FOCUS_GAINED) {
selectAll();
}
} |
12bae2af-451c-46e7-8e75-545ca3f8379c | 5 | public AnimatedSprite getAnimatedSprite(String imageURL, int rows, int columns) {
/*Get the animated sprite (load it if nescessary)*/
AnimatedSprite sprite = sprites.get(imageURL);
if(sprite == null) {
BufferedImage image = getTransparentImage(imageURL);
if(image == null) {
System.err.println("Breakout:... |
8947528e-08d6-48d8-8352-25eccbe9c76f | 0 | private void jCheckBoxQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxQuitActionPerformed
//Récupération de la méthode contrôleur 'close'
this.getCtrlM().close();
}//GEN-LAST:event_jCheckBoxQuitActionPerformed |
367e98e3-b726-4ac1-9f6e-588b5040f3d6 | 8 | public Date ceil(Date date, int field) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
for (int currentField : fields) {
if (currentField > field) {
if (currentField == Calendar.DAY_OF_MONTH
&& (field == Calendar.WEEK_OF_MONTH || field == Calendar.WEEK_OF_YEAR)) {
continue;
}
... |
b3e4fb68-7d29-493a-b811-3dd6adb8ce30 | 3 | public static void main(String[] args){
Date now = new Date();
LinkedList<Room> rooms = new LinkedList<Room>();
rooms.add(new Room("chilloutRoom",Property.Dim,Property.Private,Property.Sitting));
rooms.add(new Room("officeRoom",Property.Bright,Property.Public,Property.Sitting));
Constraint c = new Constraint(... |
18990993-f446-46cc-a430-3d85eee500e5 | 6 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
//cargo Parametros del Reporte
generarTabla();
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_social()... |
0f589288-5c79-46f7-bb11-8f65dab35e18 | 8 | public ImageConfig getCurrentConfig(SurfaceSelection selection) {
Node ancestor = selection.getSelection().getRange().getCommonAncestorContainer();
if (ancestor != null && ancestor.getNodeType() == Node.ELEMENT_NODE) {
ImageElement img = (ImageElement) DOMUtil.getFirstChildOfType((Element) ancestor, "img"... |
eb4cbeb8-a826-4792-b79c-d09e9322ac27 | 1 | private static String convertParameter(Object parameter) {
if (QueryBuilder.isBsonPrimitives(parameter.getClass())) {
return convertWithDriver(parameter);
}
String message = "无法将非BSON基本类型(non-bson-primitive)参数[" + parameter + "]绑定到查询json字符串中";
throw new IllegalMongoShellException(message);
} |
36a28d1a-6fec-418d-a45b-2c8e16d28582 | 2 | public Exon queryExon(Marker interval) {
for (Exon ei : this)
if (ei.intersects(interval)) return ei;
return null;
} |
c5ba8ece-08f2-4610-9655-ab847da1cd73 | 3 | private synchronized void insert(Packet np, double time)
{
if ( timeList.isEmpty() )
{
timeList.add( new Double(time) );
pktList.add(np);
return;
}
for (int i = 0; i < timeList.size(); i++)
{
double next = ( (Double) timeList.... |
60f6b761-8713-4db7-8157-c83852978e34 | 3 | public void crossing(ArrayList<Solve> population) {
ArrayList<Integer> tmp = new ArrayList();
Random rand = new Random();
int ind1, ind2;
for (int i = 0; i < populationsize; i++) {
tmp.add(i);
}
int k = populationsize;
while (k >= 2) {
ind1... |
1c2b1746-62b1-44d7-b759-4be03b01849c | 4 | @SuppressWarnings("unchecked")
public <T extends Object> T createProxyWithType(Class<T> Interface, InvocationHandler handler, Class<?> TYPE){
if(Interface.isInterface() == false || TYPE.isInterface() == false) throw new RuntimeException("Class is not an Interface");
ClassLoader sysLoader = ClassLoader.getSystemCla... |
93410323-0e8f-454e-a0e7-748fd1f9685d | 9 | private void jump(int S) {
jumps.clear();
jumps.push(S);
while (!jumps.isEmpty()) {
if (getWinner() != null) {
return;
}
int nxt = jumps.pop();
if (getSquare(nxt).spots() > neighbors(nxt)) {
getSquare(nxt).setSpots(g... |
6ed59a11-9ebc-4e2d-9252-0a8961971b01 | 8 | public LevelOneQueue(Integer maxSize) {
queue = new PriorityQueue<Aircraft>(100, new Comparator<Aircraft>() {
@Override
public int compare(Aircraft x, Aircraft y)
{
if( x == null || y == null ) {
throw new IllegalArgumentException("");
}
//Default to having max f... |
50046615-3bca-471a-8acd-d899a1114778 | 7 | private ConcurrentLinkedDeque<String>
merge(ConcurrentLinkedDeque<String> left, ConcurrentLinkedDeque<String> right) {
ConcurrentLinkedDeque<String> result = new ConcurrentLinkedDeque<String>();
while (left.size() > 0 || right.size() > 0) {
if (left.size() > 0 && right.size() > 0) {
if (left.pee... |
d4ecbd58-4c73-4b7a-ae42-39bd7ff50bc2 | 3 | private int compileShader(String source, int type) {
int shader = glCreateShader(type);
glShaderSource(shader, source);
glCompileShader(shader);
String infoLog = glGetShaderInfoLog(shader, glGetShader(shader, GL_INFO_LOG_L... |
97e279da-77be-4be7-9657-e1d738e48e3c | 4 | void begin() {
while(true){
if(toDo.isEmpty() == true){
toDo.addAll(done);
toDo.add(new DefaultState(as));
done.clear();
}
if(toDo.peek() == null){
toDo.remove();
}
else{
toDo.peek().show();
try{
done.add(toDo.poll().next());
}
catch(Exception e){
}
}
}
} |
28c1c380-6955-4cea-9db6-d8ee84cd97b0 | 1 | public StructuredBlock appendBlock(StructuredBlock block) {
if (block instanceof EmptyBlock) {
moveJump(block.jump);
return this;
} else {
SequentialBlock sequBlock = new SequentialBlock();
sequBlock.replace(this);
sequBlock.setFirst(this);
sequBlock.setSecond(block);
return sequBlock;
}
} |
5d5e6425-99ce-45b2-9d66-b62c94a7a7d2 | 3 | private void showDir(){
String dirPath = tf.getText();
File dir = new File(dirPath);
if(dir.exists() && dir.isDirectory()){
tf.setText("");
String[] names = dir.list();
for(String name:names){
ta.append(name+"\r\n");
}
}else{
String info = "Ya directory "+"\'"+dirPath+"\'"+" is wrong";
lab... |
ded0ae05-33d2-4aee-aee5-13ee4f331605 | 8 | public Map<String, List<String>> askQuery(String property, String target, String... otherProperties) throws IOException {
// Build the query (relying on the SMWAskAPI extension to be installed
StringBuilder prop = new StringBuilder("[["+property+"::"+target+"]]");
StringBuilder url = new StringBuilder(qu... |
82609133-6971-438b-9ac2-77f929d9a692 | 9 | public static String toJSONString(final String value)
{
final StringBuilder strBldr = new StringBuilder("");
for(final char c : value.toCharArray())
{
switch (c)
{
case '\"':
case '\\':
case '/':
strBldr.append('\\').append(c);
break;
case '\b':
strBldr.append('\\').append('b');
... |
0b4b0e8c-2dff-48c7-b8ce-9c185a56ad97 | 2 | private static boolean isLocationInScreenBounds(Point location) {
GraphicsDevice[] graphicsDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
for (int j = 0; j < graphicsDevices.length; j++) {
if (graphicsDevices[j].getDefaultConfiguration().getBounds().contains(location)) {
... |
28b4ad8c-50c2-4c51-a4e2-7760a879a148 | 4 | public void editArena() {
if (this.arenastate == ArenaState.STAT_READY
|| this.arenastate == ArenaState.STAT_STARTED)
this.endGame(EndReason.END_REASON_ARENAEDIT);
else if (this.arenastate == ArenaState.STAT_OPEN) {
for (Player p : players) {
this.removeplayer(p);
p.sendMessage(ChatColor.RED + "༭ģ... |
be677eb3-e15f-4136-bf15-52c1d819bad2 | 4 | public boolean equals(BoundingBox other)
{
if (min_x == other.minX() && min_y == other.minY() && max_x == other.maxX() && max_y == other.maxY())
{
return true;
}
else
{
return false;
}
} |
44e29ce6-b20f-4039-8487-8ddd7126a84f | 2 | public static void checkChatYAML() {
File file = new File(path + "Chat.yml");
if(!file.exists()){
try{
file.createNewFile();
FileConfiguration f = YamlConfiguration.loadConfiguration(file);
f.set("Format", "&f+channel &7[+world&7]&f +name&7:&f +message");
f.set("World.defaultPrefix", "&4&lX");
... |
4fd37737-2c5b-48f0-bdd4-9b1119e93d61 | 5 | @Override
public void update(Task task) {
try {
connection = getConnection();
ptmt = connection.prepareStatement("UPDATE Task SET description=? title=? id_executor=?"
+ " active=? done=? WHERE idtask=?;");
ptmt.setString(1, task.getDescription());
... |
aa0c3f6a-f9c9-42f1-add7-e3bd4fcd1fef | 9 | public int[] merger(int[] a , int[] b){
int curA=0,curB=0,curResult=0;
int[] result=new int[a.length+b.length];
while (curA<a.length && curB<b.length){
if(a[curA]>b[curB]){
result[curResult++]=a[curA++];
}else if(a[curA]<b[curB]){
result[cu... |
deb2464c-e972-44df-bfef-340149345433 | 7 | public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null || object.getClass() != getClass()) {
return false;
}
Slope other = (Slope) object;
if (isVertical() && other.isVertical()) {
return true;... |
0da2554a-6fa4-4cb0-bc43-e195e0a8bc51 | 7 | public static void main(String[] args) {
int searchForEach = 10;
int warmup = 100000;
int count = 1000000;
int length = UUID.randomUUID().toString().getBytes().length;
System.out.println("length: " + length);
// prepare warmup data
System.out.print("preparing warmup data...");
List<byte[]> warmupData =... |
9bf5eeb6-7700-478b-a5f8-ffb3e22a418f | 0 | static public int getDefaultTypeId() {
return Id3PictureType.defaultTypeId;
} |
3251827a-29f3-4b72-a203-f54de2306394 | 2 | public ArrayList get_PatientMRN(MsgParse mp)
throws SQLException {
ArrayList<String> arr = new ArrayList<String>();
try {
ResultSet rs = stmt.executeQuery("SELECT last_name, first_name, mrn, admission_type FROM Patient JOIN VISIT "
+ "ON patient.pid = visit.pati... |
4815d1ab-6feb-4411-826e-2d62cff00647 | 7 | public static void netToUai(BeliefNetwork bn, List vars, String filename) {
System.err.println("Saving network : " + filename);
java.io.PrintWriter pw = getPrintWriter(filename);
// preamble
Map<FiniteVariable,Integer> var2index = getVarToIndexMap(vars);
pw.println("BAYES");
pw.println(vars.size());
... |
6c6331b8-f501-4e1f-9f01-4c1c0268007d | 9 | private boolean isValidPhone(){
if(phone.length()!=12){
JOptionPane.showMessageDialog(null,"Invalid phone number entered. Must be 12 digits.","Error",JOptionPane.WARNING_MESSAGE);
return false;
}
if(phone.charAt(3)!='-'||phone.charAt(7)!='-'){
JOptionPane.showMessageDialog(null,"Invalid phone number ente... |
3e758c01-4832-4f80-a482-3028e5dff177 | 1 | public void upkeep(){
level+=(Empous.Gov.getStat("infrastructure")-7)*repair_rate;
if (level>max_level)
level=max_level;
} |
27beee29-34dd-4faa-bc74-6da5f0564833 | 7 | public Node ceiling(int x){
Node cur = root;
while(true){
if(cur.value==x) return cur;
if(x<cur.value){
if(cur.left==null){
return cur;
}
cur = cur.left;
} else{
if(cur.right==null){
... |
06dffdef-594a-4992-a9f4-f767bd8a760c | 0 | public static String getQualifiedMethodName(Method method) {
Assert.notNull(method, "Method must not be null");
return method.getDeclaringClass().getName() + "." + method.getName();
} |
a9e5a53c-99da-4e86-b519-40dad8f9799f | 3 | public static boolean promptQuestion(String question, boolean warning, String yes, String no) {
boolean answer = false;
Object[] options = {
yes,
no
};
int choice = JOptionPane.showOptionDialog(
null,
question,
warni... |
adc07201-3a04-4bb8-b32d-e239835d1b83 | 4 | private static String getMessage(Field field) {
Localize[] annotations = field.getAnnotationsByType(Localize.class);
if (annotations.length > 0) {
for (String locale : LOCALES) {
for (Localize one : annotations) {
if (locale.equals(one.locale())) {
return one.value();
}
}
}
}
retur... |
de15499d-db50-4491-99d7-dc4be9d51426 | 8 | public void paint(Graphics graphics) {
if (tree == null) return;
final Graphics2D g2 = (Graphics2D) graphics;
if (!calibrated) calibrate(g2, getWidth(), getHeight());
Paint oldPaint = g2.getPaint();
Stroke oldStroke = g2.getStroke();
for (Node selectedNode : selectedNodes) {
Shape branchPath = treeLay... |
3c986511-4976-49c3-a087-55815925d3b7 | 5 | public static boolean handleOption(int option, int longind, String arg) {
if (arg == null)
options ^= 1 << option;
else if ("yes".startsWith(arg) || arg.equals("on"))
options |= 1 << option;
else if ("no".startsWith(arg) || arg.equals("off"))
options &= ~(1 << option);
else {
GlobalOptions.err.print... |
514f56a1-bfcf-4938-97ef-2fd5de80e6cd | 6 | */
public void moveOnAxisX(Direction direction) {
if (direction.equals(Direction.RIGHT)) {
if (this.position.x + moveStep <= desert.length && !isHurdle(this.position.x + moveStep, this.position.y)) {
this.position.x += moveStep;
} else {
move();
... |
c6df934e-8221-4d67-b76d-e24802af940d | 4 | public SpinnerTimeEditor(JSpinner spinner) {
super(spinner);
if (!(spinner.getModel() instanceof SpinnerNumberModel)) {
throw new IllegalArgumentException();
}
final Pattern pattern = Pattern.compile("([0-9]+)((:|.|h)([0-5]?[0-9]))?");
DefaultFormatter formatter = new DefaultFormatter() {
@Ove... |
e4a026b7-7e94-4ad2-8c2a-253f03112eca | 3 | public int getLabelIdx(String label) throws IOException {
if (labels == null) setLabels();
if (labelMap == null) return -1;
if (!labelMap.containsKey(label)) return -1;
return (labelMap.get(label)).intValue();
} |
08bc2166-09d3-4e7e-acf7-a5c5160a9f4b | 6 | private HashMap<String,byte[]> readChars(byte[] d) {
// skip thru data until we find "/"+key
HashMap<String,byte[]> hm = new HashMap<String,byte[]>();
int i = findSlashName(d, "CharStrings");
if (i < 0) {
// not found
return hm;
}
PSParser psp = ne... |
8b6f0137-293a-4459-9843-192a7ecc40fe | 3 | public boolean jumpMayBeChanged() {
for (int i = 0; i < subBlocks.length; i++) {
if (subBlocks[i].jump == null && !subBlocks[i].jumpMayBeChanged())
return false;
}
return true;
} |
83d0c14a-6036-4f9e-a419-3252412c7348 | 4 | void lpc_to_curve(float[] curve, float[] lpc, float amp){
for(int i=0; i<ln*2; i++)
curve[i]=0.0f;
if(amp==0)
return;
for(int i=0; i<m; i++){
curve[i*2+1]=lpc[i]/(4*amp);
curve[i*2+2]=-lpc[i]/(4*amp);
}
fft.backward(curve);
{
int l2=ln*2;
float unit=(floa... |
f77ba440-b782-424b-a317-82964b8ebfe9 | 0 | public Worker () {
//initial settings
results = new ArrayList<String>();
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} |
ff2bf009-8610-4a78-9eaf-0ac93d499355 | 2 | public static Collection<BufferedImage> getFromSpritesheet(BufferedImage spritesheet, int width, int height, int spacing, int border) {
// GET THE NUMBER OF TILES VERTICALLY AND HORIZONTALLY
int horizCount = (spritesheet.getWidth() - 2 * border + spacing) / (width + spacing);
int vertCount = (sp... |
8f1ed1e7-0729-4772-ad60-7a9412c18baa | 9 | final public SimpleNode Start() throws ParseException {
/*@bgen(jjtree) START */
SimpleNode jjtn000 = new SimpleNode(JJTSTART);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
... |
74346c8c-0211-4e05-8452-845f768ad5dd | 9 | public static void main(String[] args) {
try {
Experiment exp = null;
// get options from XML?
String xmlOption = Utils.getOption("xml", args);
if (!xmlOption.equals(""))
args = new XMLOptions(xmlOption).toArray();
String expFile = Utils.getOption('l', args);
Str... |
7ec605d1-fa2f-488d-8c68-b04a5960928d | 5 | public static void main(String[] args){
User user = new User();
List<User> userList = new ArrayList<User>();
int minSize = 5;
int maxSize = 10;
user.setNick(getRandomString(minSize, maxSize));
user.setSessionKey(getRandomString(30, 50));
for (int i = 0; i < 10; i++) {
User u = new User();
u.setNick(... |
771971f8-3cdb-4c0a-8c37-561040a03120 | 1 | private void leave() {
if(!oldLoc.containsKey(player)){
player.sendMessage(ChatColor.AQUA+"[CopsAndRobbers]"+ChatColor.DARK_RED+"You are not in a game!");
}else{
team.removePlayer(player);
player.teleport(oldLoc.get(player));
}
} |
4ac4f283-2f78-4807-b08a-bf0493afa3f0 | 4 | @Override
public E peek()
{
// This ensures a previous wakeup has ended.
E item = queue.peek();
if (blocking && item == null) {
synchronized (lock) {
// Only block if the item is null, else return it.
item = queue.peek();
if (item == null) {
try {
lock.wait(timeout);
} catch (Int... |
cb0460e2-cc7b-435a-83c0-c47a728aad46 | 6 | public void destroy(ItItemHasEmpleadoPK id) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
ItItemHasEmpleado itItemHasEmpleado;
try {
... |
c5815a8e-06ac-4e57-adbd-3d76d13c507a | 6 | public static Task getSelectedTask()
{
if (DEBUG) log("Attempting to determine selected task");
Task selectedTask = null;
if (tasks != null)
{
for(Task t : tasks)
{
if (t.isSelected())
{
selectedTask = t;
break;
}
... |
ea37c6bf-2375-474e-b421-109becdddc4e | 6 | public static void main(String[] args) {
base db = new base();
db.create("/SAMPLE1.DBF", "Npk N(10), Name C(20), Rating F(5,2), Birth D, Notes M, ieee B(8,4), Id I, Salary Y");
db.Field[0].setByLong(1);
db.Field[1].setByString("Mickey");
db.Field[2].setByDouble( 3.15 );
db.Field[3].setByString("20050328"... |
faffdd5e-77bf-4373-9387-403aeb227660 | 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... |
c546f555-35e5-4e23-884c-9935dc6b021f | 0 | public void setCost(double value) {
this.cost = value;
} |
dbf316b1-3ca5-4c6a-9f8f-28f8ff14a8f2 | 6 | private static String unescape(String in, String escChars) {
if (in == null) return null;
if (in.length() == 0) return ""; //can't be any escapes in 1-char String, and we need to guarentee one pass through the loop
escChars = escChars.concat("\\");
StringBuffer out = new StringBuffer(in.length());
char c=' ',... |
276614f3-bc80-4ef5-b9ea-99e82e9f5e2c | 5 | public String toDiffString(String jobId) {
String f1 = "%1$-3.0f";
String f2 = "%1$-3.1f";
float xOUdf = exOU - rxOU;
float mNGUdf = exNGU - rmNGU;
float xNGUdf = exNGU - rxNGU;
float xHeapUdf = exHeapU - rxHeapU;
float RSSdf = exHeapU - rxRSS;
float xOUrt = rxOU == 0 ? 100 : Math.abs(xOUdf) * 100... |
f3fac0b3-2178-4a14-a46f-fa1bfef880f7 | 1 | @Test
public void tokenize_allTokenTypes() throws Exception {
// given
final String code = "+-<>[]rw";
// when
final List<Token> tokens = tokenizer.tokenize(code);
// then
final List<Token> expectedTokens = new LinkedList<>();
for (char c : code.toCharArray(... |
7b6180df-04ba-4845-a48e-153ee75fd6ff | 7 | public void removeEdge(Vertex v1, Vertex v2) {
for (int i = 0; i < edges.size(); i++) {
//if this edge connects v1 and v2
if (((MyEdge) edges.get(i)).contains(v1, v2)) {
//find vertices of this edge and remove them
for (int j = 0; j < vertices.size(); j++ ) {
if (v1.getElement().getX() == vertices.... |
81bc548e-1307-469f-a66a-b956ae3cd636 | 1 | public void kill(Player p)
{
if(p.setStackInNextAvailableSlot(getDrops()[rand.nextInt(drops.length)])){
this.remove = true;
}else{
health = maxHealth;
}
} |
9ce50d00-3ac7-4231-bb32-4e35d288962b | 6 | public String toString() {
switch(subtype){
case 'B': {si = 0; break;}
case 'N': {si = 1; break;}
case 'P': {si = 2; break;}
case 'A': {si = 3; break;}
case 'R': {si = 4; break;}
case 'D': {si = 5; break;}
}
return "Group: "+group+"\n"+
"Address: "+address+"\n"+
"Nickname: "+nicknam... |
6acaee59-958a-414c-ba59-d2ba1ae2e5e7 | 3 | public BufferedImage getIdleImage(EnumDirection dir) {
BufferedImage[] idleImages = TransformImage.splitAnimation(idleStrip, 3);
switch(dir) {
case EAST: return idleImages[1];
case WEST: return TransformImage.flipHorizontally(idleImages[1]);
case NORTH: return idleImages[2];
default: return idleIm... |
7ae18edb-ba9b-4ba8-8932-204cc3079d85 | 4 | String toSmallest(String in) {
char minChar = 'z' + 1;
int minIndex = in.length();
boolean refresh = true;
for (int i = 0; i < in.length(); i++) {
if (in.charAt(i) < minChar) {
minIndex = i;
refresh = false;
minChar = in.charAt... |
21641ef4-8555-4cca-82b5-3cc2aab95dcc | 0 | protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} |
c8ce19cc-84c2-4019-b181-b73683832d0f | 5 | @Test
public void testInfixToPostfix3() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast("*");
infix.addLast("5");
infix.addLast("+");
infix.addLast("3");
QueueInterface<String> p... |
e7e2e32e-a8da-4d7f-ac8c-b5be0e0dc336 | 1 | @Override
public void refresh(Camera camera) {
if(!VerifySelectedObject())
setSelectObject();
primitives.get(namePrimitives[1]).calcCoordinates(this, camera, null);
} |
debc147a-173f-41f8-b157-5556dc803046 | 4 | private static TimeSpan interval(double value, int scale)
{
if (Double.isNaN(value))
{
throw new IllegalArgumentException("Arg_CannotBeNaN");
}
double num = value * scale;
double num2 = num + ((value >= 0.0) ? 0.5 : -0.5);
if ((num2 > 922337203... |
2b3ef8e2-a559-44c5-9b96-282af7e7d416 | 1 | public String viewToken() {
String s = "";
for (Token token : this.listaToken) {
s = s + token.getLexema() + " => " + dt.getLista().get(token.getValor_token()).getMatch() + "\n";
}
return s;
} |
bc9aa546-dd85-4943-a084-663f0ccee200 | 7 | @Test
public void placeFiguresKingQueenBishop() {
HashMap<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KING.toString(), 1);
figureQuantityMap.put(QUEEN.toString(), 1);
figureQuantityMap.put(BISHOP.toString(), 1);
FiguresChain kingChain = new Ki... |
ccecb75c-7a2a-499e-847e-b36664d58380 | 3 | public static String getName(StringBuilder sourceCode) {
String name = "";
int index = sourceCode.indexOf("<title>");
int edge = sourceCode.indexOf(" filmography - Wikipedia, the free encyclopedia</title>");
if (edge == -1) {
edge = sourceCode.indexOf(" - Wikipedia, the free encyclopedia</title>");
}
for... |
1ff3b4c8-0127-4763-845d-3f16ecea5685 | 9 | public ArrayList<Float> countSentenceLengths(String post) {
ArrayList<Float> tmpCounter = new ArrayList<>(Collections.nCopies(6, 0.0f)); // Where 6 corresponds to the number of sentence lengths of interest
// Split the post into a number of sentences
List<String> sentences = splitIntoSentences(p... |
9fdc35c7-18ac-4015-9a4a-c93646e27ded | 4 | @Override
public boolean equals(Object obj) {
boolean equal = false;
if (obj instanceof Host) {
Host host = (Host) obj;
Map<String, String> otherHostProps = host.getProperties();
boolean areAllEqual = true;
if (otherHostProps.size() == hostProperties.size()) {
for (String prop : hostProperties.keyS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.