code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public JEditTextArea(TextAreaDefaults defaults){
enableEvents(AWTEvent.KEY_EVENT_MASK);
painter=new TextAreaPainter(this,defaults);
documentHandler=new DocumentHandler();
listenerList=new EventListenerList();
caretEvent=new MutableCaretEvent();
lineSegment=new Segment();
bracketLine=bracketPosition=-1;
blink=true;
setLayout(new ScrollLayout());
add(CENTER,painter);
add(RIGHT,vertical=new JScrollBar(JScrollBar.VERTICAL));
add(BOTTOM,horizontal=new JScrollBar(JScrollBar.HORIZONTAL));
vertical.addAdjustmentListener(new AdjustHandler());
horizontal.addAdjustmentListener(new AdjustHandler());
painter.addComponentListener(new ComponentHandler());
painter.addMouseListener(new MouseHandler());
painter.addMouseMotionListener(new DragHandler());
painter.addMouseWheelListener(new MouseHandler());
addFocusListener(new FocusHandler());
setInputHandler(defaults.inputHandler);
setDocument(defaults.document);
editable=defaults.editable;
caretVisible=defaults.caretVisible;
caretBlinks=defaults.caretBlinks;
electricScroll=defaults.electricScroll;
popup=defaults.popup;
focusedComponent=this;
}
|
Creates a new JEditTextArea with the specified settings.
|
public DefaultClientWebRequestBuilder accept(String... mediaTypes){
this.httpHeaders.setAccept(Arrays.stream(mediaTypes).map(null).collect(Collectors.toList()));
return this;
}
|
Set the Accept request header to the given media types
|
public void clear() throws IOException {
nioFile.truncate(HEADER_LENGTH);
}
|
Discards all stored data.
|
public static void main(String[] args) throws CloneNotSupportedException {
Integer[] list1={-44,-5,-3,3,3,1,-4,0,1,2,4,5,53};
Integer[] list2={-44,-5,-3,3,5,1,-4,0,1,2,4,5,53};
Heap<Integer> heap1=new Heap<>(list1);
Heap<Integer> heap2=(Heap)heap1.clone();
Heap<Integer> heap3=new Heap<>(list2);
System.out.println("Heap1 is " + (heap1.equals(heap2) ? "" : "not ") + "equal to heap2");
System.out.println("Heap1 is " + (heap1.equals(heap3) ? "" : "not ") + "equal to heap3");
}
|
Test clone and equals method
|
public void sendToBack(Figure figure){
if (basicRemove(figure) != -1) {
basicAdd(0,figure);
fireAreaInvalidated(figure.getDrawingArea());
}
}
|
Sends a figure to the back of the composite figure.
|
public static Product toNewTemplateProduct(final VOService voProduct,final TechnicalProduct tProd,final Organization organization) throws ValidationException {
Product product=new Product();
product.setType(ServiceType.TEMPLATE);
product.setStatus(ServiceStatus.INACTIVE);
product.setProvisioningDate(DateFactory.getInstance().getTransactionTime());
product.setVendor(organization);
product.setTechnicalProduct(tProd);
if (tProd.getAccessType() == ServiceAccessType.EXTERNAL) {
final PriceModel pm=new PriceModel();
pm.setType(PriceModelType.FREE_OF_CHARGE);
product.setPriceModel(pm);
}
copyAttributes(product,voProduct);
return product;
}
|
Copies all attributes in Product object according to the values specified in the value object. Sets the necessary attributes to create a new template product.
|
void sendMessageToHandlerWithControllerReset(List<OFMessage> messages) throws Exception {
sendMessageToHandlerNoControllerReset(messages);
}
|
reset, setup, and replay the messageEvent mock for the given messages, mock controller send message to channel handler This method will reset, start replay on controller, and then verify
|
private void connect() throws IOException {
client=AFTPClient.getInstance(conn.secure(),address,conn.getPort(),conn.getUsername(),conn.getPassword(),conn.getFingerprint(),conn.getStopOnError());
setConnectionSettings(client,conn);
if (conn.getTransferMode() == FTPConstant.TRANSFER_MODE_ASCCI) getClient().setFileType(FTP.ASCII_FILE_TYPE);
else if (conn.getTransferMode() == FTPConstant.TRANSFER_MODE_BINARY) getClient().setFileType(FTP.BINARY_FILE_TYPE);
try {
Proxy.start(conn.getProxyServer(),conn.getProxyPort(),conn.getProxyUser(),conn.getProxyPassword());
client.connect();
}
finally {
Proxy.end();
}
}
|
connects the client
|
public void start(){
isRunning=true;
start=_time();
}
|
start the watch
|
public void createTopic(String topic,int numPartitions,int replicationFactor){
RackAwareMode rackAwareMode=null;
AdminUtils.createTopic(getZkUtils(),topic,numPartitions,replicationFactor,new Properties(),rackAwareMode);
}
|
Create the specified topic.
|
public boolean isViewRunning(){
return mIsRunning;
}
|
Informs actual VIEW state
|
public final int establishedFusionMode(){
return establishedFusionMode;
}
|
Returns the established fusion mode or -1 if it was not enabled
|
public static String random(final int count,final String chars){
if (chars == null) {
return random(count,0,0,false,false,null,RANDOM);
}
return random(count,chars.toCharArray());
}
|
<p>Creates a random string whose length is the number of characters specified.</p> <p>Characters will be chosen from the set of characters specified by the string, must not be empty. If null, the set of all characters is used.</p>
|
public void push(Object obj){
stack.push(requireNonNull(obj));
}
|
Put the specified object on the stack.
|
public void buscarProcedimientoReemplazoAvanzadoExecuteLogic(ActionMapping mappings,ActionForm form,HttpServletRequest request,HttpServletResponse response){
BusquedasHelper.buscarProcedimientoComunLogic(mappings,(BusquedaElementosForm)form,request,response);
setReturnActionFordward(request,mappings.findForward("form_busqueda_generica"));
}
|
Metodo para las busquedas de procedimientos desde el formulario de busqueda reemplazo avanzado
|
public ThumbnailParameterBuilder useExifOrientation(boolean use){
this.useExifOrientation=use;
return this;
}
|
Sets whether or not the Exif metadata should be used to determine the orientation of the thumbnail.
|
private void decrementWorkerCount(){
for (; ; ) {
int c=ctl.get();
if (ctl.compareAndSet(c,ctlOf(runStateOf(c),workerCountOf(c) - 1))) break;
}
}
|
Decrements the workerCount field of ctl. This is called only on abrupt termination of a thread (see processWorkerExit). Other decrements are performed within getTask.
|
public <T>MappingIterator<T> readValues(String json) throws IOException, JsonProcessingException {
JsonParser jp=_jsonFactory.createJsonParser(json);
if (_schema != null) {
jp.setSchema(_schema);
}
DeserializationContext ctxt=_createDeserializationContext(jp,_config);
return new MappingIterator<T>(_valueType,jp,ctxt,_findRootDeserializer(_config,_valueType),true,_valueToUpdate);
}
|
Method for reading sequence of Objects from parser stream.
|
protected TypeVar pickFreshTypeVarInstance(IdentityHashMap<TypeVar.TypeInstance,TypeVar> staleToFresh){
if (staleToFresh.containsKey(this.instance)) {
return staleToFresh.get(this.instance);
}
if (this.instance.isRigid) {
this.instance.unifiedVars=new LinkedList<>();
this.instance.unifiedVars.add(new WeakReference<>(this));
return this;
}
TypeVar fresh=new TypeVar(this.instance.name,this.instance.internal,this.instance.isRigid,this.instance.constraints.clone(),null);
staleToFresh.put(this.instance,fresh);
return fresh;
}
|
This internal method should only be called from TypeScope
|
public void testRandomStrings() throws Exception {
Analyzer analyzer=new KeywordAnalyzer();
checkRandomData(random(),analyzer,1000 * RANDOM_MULTIPLIER);
analyzer.close();
}
|
blast some random strings through the analyzer
|
public ThrowableSet mightThrowImplicitly(ThrowStmt t){
return ThrowableSet.Manager.v().ALL_THROWABLES;
}
|
Returns the set of all <code>Throwable</code>s as the set of types that a <code>throw</code> statement may throw implicitly, that is, the possible types of errors which might arise in the course of executing the <code>throw</code> statement, rather than the type of the <code>throw</code>'s operand.
|
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:09.876 -0500",hash_original_method="54479FEAF5918A2D0015420E3AF1868D",hash_generated_method="70A6BE8E028F56F9FFA10E60669FE620") public ComposeShader(Shader shaderA,Shader shaderB,Xfermode mode){
mShaderA=shaderA;
mShaderB=shaderB;
native_instance=nativeCreate1(shaderA.native_instance,shaderB.native_instance,(mode != null) ? mode.native_instance : 0);
if (mode instanceof PorterDuffXfermode) {
PorterDuff.Mode pdMode=((PorterDuffXfermode)mode).mode;
native_shader=nativePostCreate2(native_instance,shaderA.native_shader,shaderB.native_shader,pdMode != null ? pdMode.nativeInt : 0);
}
else {
native_shader=nativePostCreate1(native_instance,shaderA.native_shader,shaderB.native_shader,mode != null ? mode.native_instance : 0);
}
}
|
Create a new compose shader, given shaders A, B, and a combining mode. When the mode is applied, it will be given the result from shader A as its "dst", and the result from shader B as its "src".
|
private void addTreeToCas(JCas jCas,DEPTree tree,WINDOW_TYPE window,List<TOKEN_TYPE> tokens){
ArrayList<DEPENDENCY_NODE_TYPE> nodes=new ArrayList<DEPENDENCY_NODE_TYPE>(tree.size());
DEPENDENCY_ROOT_NODE_TYPE rootNode=this.dependencyOps.createRootNode(jCas,window);
nodes.add(rootNode);
for (int i=0; i < tokens.size(); i++) {
TOKEN_TYPE token=tokens.get(i);
nodes.add(this.dependencyOps.createNode(jCas,token));
}
Multimap<DEPENDENCY_NODE_TYPE,DEPENDENCY_RELATION_TYPE> headRelations=HashMultimap.create();
Multimap<DEPENDENCY_NODE_TYPE,DEPENDENCY_RELATION_TYPE> childRelations=HashMultimap.create();
for (int i=0; i < tree.size(); i++) {
DEPNode parserNode=tree.get(i);
if (parserNode.hasHead()) {
int headIndex=parserNode.getHead().getID();
DEPENDENCY_NODE_TYPE node=nodes.get(i);
DEPENDENCY_NODE_TYPE headNode=nodes.get(headIndex);
DEPENDENCY_RELATION_TYPE rel=this.dependencyOps.createRelation(jCas,headNode,node,parserNode.getLabel());
headRelations.put(node,rel);
childRelations.put(headNode,rel);
}
}
for ( DEPENDENCY_NODE_TYPE node : nodes) {
this.dependencyOps.setHeadRelations(jCas,node,Lists.newArrayList(headRelations.get(node)));
this.dependencyOps.setChildRelations(jCas,node,Lists.newArrayList(childRelations.get(node)));
node.addToIndexes();
}
}
|
Takes parsed tree from ClearNLP and converts it into dependency type system.
|
public Ragdoll(Model model,String name,Vector3 location,Vector3 rotation,Vector3 scale,btCollisionShape shape,float mass,short belongsToFlag,short collidesWithFlag,boolean callback,boolean noDeactivate,Array<BlenderEmpty> ragdollEmpties,String armatureNodeId,SteerSettings steerSettings){
super(model,name,location,rotation,scale,shape,mass,belongsToFlag,collidesWithFlag,callback,noDeactivate,steerSettings);
createRagdoll(ragdollEmpties,armatureNodeId);
}
|
Constructs a ragdoll out of rigid bodies using physics constraints.
|
public synchronized void countUp(){
this.count_++;
}
|
[GemStone addition]
|
static int decode4ByteInt(byte[] data,int pos){
int result=data[pos + 3] & 0xFF;
result=result | ((data[pos + 2] & 0xFF) << 8);
result=result | ((data[pos + 1] & 0xFF) << 16);
result=result | ((data[pos] & 0xFF) << 24);
return result;
}
|
Reads four bytes, starting at the given position, and converts them into an int.
|
public static void createImageToStorage(String url,Label l,String cacheId,Dimension toScale){
createImageToStorage(url,l,cacheId,toScale,PRIORITY_NORMAL);
}
|
Constructs an image request that will automatically populate the given Label when the response arrives, it will cache the file locally to the Storage
|
public void stopForegroundCompat(int id){
foreground=false;
if (mStopForeground != null) {
mStopForegroundArgs[0]=Boolean.TRUE;
try {
mStopForeground.invoke(this,mStopForegroundArgs);
}
catch ( InvocationTargetException e) {
}
catch ( IllegalAccessException e) {
}
}
else {
notificationManager.cancel(id);
try {
Method setForeground=getClass().getMethod("setForeground",mSetForegroudSignaure);
setForeground.invoke(this,new Object[]{true});
}
catch ( NoSuchMethodException exception) {
}
catch ( InvocationTargetException e) {
}
catch ( IllegalAccessException e) {
}
}
}
|
This is a wrapper around the new stopForeground method, using the older APIs if it is not available.
|
public HttpSendSocket(InetAddress address,int port) throws IOException {
this(address.getHostName(),port);
}
|
Create a stream socket and connect it to the specified address on the specified port.
|
public void startServer(WebServer.MessageHandler logResult,int port){
this.logResult=logResult;
setIsRunning(true);
WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo=wifiManager.getConnectionInfo();
WebServerDefault.setWebServerIp(WebServerDefault.intToIp(wifiInfo.getIpAddress()));
if (wifiInfo.getSupplicantState() != SupplicantState.COMPLETED) {
this.logResult.OnError("Please connect to a WIFI-network.");
try {
throw new Exception("Please connect to a WIFI-network.");
}
catch ( Exception e) {
e.printStackTrace();
}
}
webServers=new Servers(engine.getApplicationContext(),logResult,port);
webServers.start();
updateNotification("running on " + WebServerDefault.WebServerIp + ":"+ port);
}
|
start server
|
SolrInputDocument processAdd(final String chain,final SolrInputDocument docIn) throws IOException {
SolrCore core=h.getCore();
UpdateRequestProcessorChain pc=core.getUpdateProcessingChain(chain);
assertNotNull("No Chain named: " + chain,pc);
SolrQueryResponse rsp=new SolrQueryResponse();
SolrQueryRequest req=new LocalSolrQueryRequest(core,new ModifiableSolrParams());
try {
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req,rsp));
AddUpdateCommand cmd=new AddUpdateCommand(req);
cmd.solrDoc=docIn;
UpdateRequestProcessor processor=pc.createProcessor(req,rsp);
processor.processAdd(cmd);
return cmd.solrDoc;
}
finally {
SolrRequestInfo.clearRequestInfo();
req.close();
}
}
|
Runs a document through the specified chain, and returns the final document used when the chain is completed (NOTE: some chains may modify the document in place
|
@Override public String next(){
currLine=nextLine;
nextLine();
if (nextLine == null && series.hasNextEpisode()) {
nextEpisode();
nextLine();
}
ChainBuilder.THIS.setLabel("Reading Episode #" + series.currentEpisodeNum + " in "+ series.toString());
return currLine;
}
|
Returns the next element in the iteration.
|
public void closePopout(Channel channel){
if (channel == null) {
return;
}
if (!dialogs.containsKey(channel)) {
return;
}
JDialog dialog=dialogs.remove(channel);
dialog.dispose();
popoutDisposed(channel);
}
|
Close the popout for the given channel (if it exists) and move the channel back to the main window.
|
protected List refreshVerticalTicks(Graphics2D g2,Rectangle2D dataArea,RectangleEdge edge){
List result=new java.util.ArrayList();
result.clear();
Font tickLabelFont=getTickLabelFont();
g2.setFont(tickLabelFont);
if (isAutoTickUnitSelection()) {
selectAutoTickUnit(g2,dataArea,edge);
}
double unit=getTickUnit().getSize();
double cycleBound=getCycleBound();
double currentTickValue=Math.ceil(cycleBound / unit) * unit;
double upperValue=getRange().getUpperBound();
boolean cycled=false;
boolean boundMapping=this.boundMappedToLastCycle;
this.boundMappedToLastCycle=true;
NumberTick lastTick=null;
float lastY=0.0f;
if (upperValue == cycleBound) {
currentTickValue=calculateLowestVisibleTickValue();
cycled=true;
this.boundMappedToLastCycle=true;
}
while (currentTickValue <= upperValue) {
boolean cyclenow=false;
if ((currentTickValue + unit > upperValue) && !cycled) {
cyclenow=true;
}
double yy=valueToJava2D(currentTickValue,dataArea,edge);
String tickLabel;
NumberFormat formatter=getNumberFormatOverride();
if (formatter != null) {
tickLabel=formatter.format(currentTickValue);
}
else {
tickLabel=getTickUnit().valueToString(currentTickValue);
}
float y=(float)yy;
TextAnchor anchor;
TextAnchor rotationAnchor;
double angle=0.0;
if (isVerticalTickLabels()) {
if (edge == RectangleEdge.LEFT) {
anchor=TextAnchor.BOTTOM_CENTER;
if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) {
anchor=isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT;
result.remove(result.size() - 1);
result.add(new CycleBoundTick(this.boundMappedToLastCycle,lastTick.getNumber(),lastTick.getText(),anchor,anchor,lastTick.getAngle()));
this.internalMarkerWhenTicksOverlap=true;
anchor=isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT;
}
rotationAnchor=anchor;
angle=-Math.PI / 2.0;
}
else {
anchor=TextAnchor.BOTTOM_CENTER;
if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) {
anchor=isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT;
result.remove(result.size() - 1);
result.add(new CycleBoundTick(this.boundMappedToLastCycle,lastTick.getNumber(),lastTick.getText(),anchor,anchor,lastTick.getAngle()));
this.internalMarkerWhenTicksOverlap=true;
anchor=isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT;
}
rotationAnchor=anchor;
angle=Math.PI / 2.0;
}
}
else {
if (edge == RectangleEdge.LEFT) {
anchor=TextAnchor.CENTER_RIGHT;
if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) {
anchor=isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.TOP_RIGHT;
result.remove(result.size() - 1);
result.add(new CycleBoundTick(this.boundMappedToLastCycle,lastTick.getNumber(),lastTick.getText(),anchor,anchor,lastTick.getAngle()));
this.internalMarkerWhenTicksOverlap=true;
anchor=isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.BOTTOM_RIGHT;
}
rotationAnchor=anchor;
}
else {
anchor=TextAnchor.CENTER_LEFT;
if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) {
anchor=isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.TOP_LEFT;
result.remove(result.size() - 1);
result.add(new CycleBoundTick(this.boundMappedToLastCycle,lastTick.getNumber(),lastTick.getText(),anchor,anchor,lastTick.getAngle()));
this.internalMarkerWhenTicksOverlap=true;
anchor=isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.BOTTOM_LEFT;
}
rotationAnchor=anchor;
}
}
CycleBoundTick tick=new CycleBoundTick(this.boundMappedToLastCycle,new Double(currentTickValue),tickLabel,anchor,rotationAnchor,angle);
if (currentTickValue == cycleBound) {
this.internalMarkerCycleBoundTick=tick;
}
result.add(tick);
lastTick=tick;
lastY=y;
if (currentTickValue == cycleBound) {
this.internalMarkerCycleBoundTick=tick;
}
currentTickValue+=unit;
if (cyclenow) {
currentTickValue=calculateLowestVisibleTickValue();
upperValue=cycleBound;
cycled=true;
this.boundMappedToLastCycle=false;
}
}
this.boundMappedToLastCycle=boundMapping;
return result;
}
|
Builds a list of ticks for the axis. This method is called when the axis is at the left or right of the chart (so the axis is "vertical").
|
public static ApplicationXml parseApplicationXml(InputStream input,EntityResolver entityResolver) throws IOException, JDOMException {
ApplicationXmlIo io=new ApplicationXmlIo();
SAXBuilder builder=io.createDocumentBuilder();
if (entityResolver != null) {
builder.setEntityResolver(entityResolver);
}
else {
builder.setEntityResolver(new ApplicationXmlEntityResolver());
}
return (ApplicationXml)builder.build(input);
}
|
Parses a deployment descriptor provided as input stream.
|
public TranscoderException(Exception ex){
this(null,ex);
}
|
Constructs a new transcoder exception with the specified detail message.
|
@Override public final void perform(IR ir){
ir.desiredSSAOptions=new SSAOptions();
ir.desiredSSAOptions.setScalarsOnly(true);
ir.desiredSSAOptions.setBackwards(false);
ir.desiredSSAOptions.setInsertUsePhis(false);
}
|
register in the IR the SSA properties we need for simple scalar renaming
|
public TestProxySelector(int server_port,int proxy_port){
this.server_port=server_port;
this.proxy_port=proxy_port;
}
|
Creates proxy selector instance. Selector will return the proxy, only if the connection is made to localhost:server_port. Otherwise it will return NO_PROXY. Address of the returned proxy will be localhost:proxy_port.
|
public MutableDateTime(long instant){
super(instant);
}
|
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using <code>ISOChronology</code> in the default time zone.
|
public static List<SelectArg> makeSelectArgsFromList(Collection<? extends Object> items){
List<SelectArg> args=new ArrayList<SelectArg>(items.size());
for ( Object item : items) {
args.add(new SelectArg(item));
}
return args;
}
|
This generates a list of SelectArgs which must be used when building queries, especially with Strings. Strings are otherwise not escaped, even when used with .in() or .eq(). This can result in an SQL injection vulnerability. See: http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_3.html#Select-Arguments
|
public void mouseClicked(MouseEvent e){
if (e.getClickCount() > 1) {
System.gc();
}
}
|
Invoked when the mouse has been clicked on a component.
|
public static TicketFlags parse(DerInputStream data,byte explicitTag,boolean optional) throws Asn1Exception, IOException {
if ((optional) && (((byte)data.peekByte() & (byte)0x1F) != explicitTag)) return null;
DerValue der=data.getDerValue();
if (explicitTag != (der.getTag() & (byte)0x1F)) {
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
else {
DerValue subDer=der.getData().getDerValue();
return new TicketFlags(subDer);
}
}
|
Parse (unmarshal) a ticket flag from a DER input stream. This form parsing might be used when expanding a value which is part of a constructed sequence and uses explicitly tagged type.
|
public SendableVenueMessage.SendableVenueMessageBuilder latitude(double latitude){
this.latitude=latitude;
return this;
}
|
*Required Sets the latitude of the venue you want to send
|
public void findAndInit(Object someObj){
if (!(someObj instanceof DrawingTool)) {
super.findAndInit(someObj);
}
if (editorTool != null) {
editorTool.findAndInit(someObj);
}
if (someObj instanceof InformationDelegator || someObj instanceof SelectMouseMode) {
getMouseMode().findAndInit(someObj);
}
}
|
Called by findAndInit(Iterator) so subclasses can find objects, too.
|
public void testSuccessWithDefaultConfig(){
CircuitBreaker breaker=new CircuitBreaker();
breaker.close();
ClosedState state=new ClosedState(breaker);
assertTrue(breaker.isClosed());
state.recordSuccess();
assertTrue(breaker.isClosed());
}
|
Asserts that the the circuit is still closed after a single success.
|
@Override public String generateLabelString(XYDataset dataset,int series,int item){
String result;
Object[] items=createItemArray((XYZDataset)dataset,series,item);
result=MessageFormat.format(getFormatString(),items);
return result;
}
|
Generates a label string for an item in the dataset.
|
public static String readFully(Reader reader) throws IOException {
try {
StringWriter writer=new StringWriter();
char[] buffer=new char[1024];
int count;
while ((count=reader.read(buffer)) != -1) {
writer.write(buffer,0,count);
}
return writer.toString();
}
finally {
reader.close();
}
}
|
Returns the remainder of 'reader' as a string, closing it when done.
|
public ExternalizableStringSet(@NonNls String... defaultValues){
this.defaultValues=defaultValues.length == 0 ? ArrayUtil.EMPTY_STRING_ARRAY : defaultValues;
for ( String defaultValue : defaultValues) {
add(defaultValue);
}
}
|
note: declare ExternalizableStringSet fields as <b>final</b>!<br> note: reference to defaultValues is retained by this set!
|
JCERSAPrivateCrtKey(PrivateKeyInfo info) throws IOException {
this(org.bouncycastle.asn1.pkcs.RSAPrivateKey.getInstance(info.parsePrivateKey()));
}
|
construct an RSA key from a private key info object.
|
public SSLConfig(boolean useSSL,boolean clientAuth,String keyStore,String keyStorePassword,String trustStore,String trustStorePassword){
this.useSsl=useSSL;
this.clientAuth=clientAuth;
this.keyStore=keyStore;
this.keyStorePassword=keyStorePassword;
this.trustStore=trustStore;
this.trustStorePassword=trustStorePassword;
}
|
NOTE: all other settings are ignored if useSSL is false; trustStore settings are ignored if clientAuth is false
|
public TwitterMoPubAdAdapter(Activity activity,Adapter originalAdapter,MoPubNativeAdPositioning.MoPubClientPositioning adPositioning){
super(activity,originalAdapter,adPositioning);
}
|
Creates a new TwitterMoPubAdAdapter object, using client positioning.
|
public void insertHistory(Weather w){
History yesterday=searchYesterdayHistory(w);
clearLocationHistory(w);
HistoryEntityDao dao=new DaoMaster(getDatabase()).newSession().getHistoryEntityDao();
if (yesterday != null) {
dao.insert(HistoryEntity.build(yesterday));
}
dao.insert(HistoryEntity.build(History.build(w)));
}
|
<br> history.
|
public TimeEvent(Object src,long systemTime,long offsetTime,long simTime,TimerStatus timerStatus){
this.source=src;
this.systemTime=systemTime;
this.offsetTime=offsetTime;
this.simTime=simTime;
this.timerStatus=timerStatus;
}
|
Create a time event.
|
public long webgraphSize(){
return this.writeWebgraph ? this.getWebgraphConnector().getSize() : 0;
}
|
get the size of the webgraph index
|
public int indexOf(ElementInfo child){
ArrayList children=this.children;
if (children != null) {
return children.indexOf(child);
}
return -1;
}
|
Returns the index of the specified child, or -1 if <code>child</code> isn't a valid child.
|
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:11.437 -0500",hash_original_method="EA37E144790F39B12A14B8A0E7D897B0",hash_generated_method="73377B88F34C63C9BB19DF8D05F68AF6") @Deprecated public NinePatchDrawable(Bitmap bitmap,byte[] chunk,Rect padding,String srcName){
this(new NinePatchState(new NinePatch(bitmap,chunk,srcName),padding),null);
}
|
Create drawable from raw nine-patch data, not dealing with density.
|
public MekaFrame(GraphicsConfiguration gc){
this("",gc);
}
|
Initializes the frame with no title.
|
public void writeIntArray(int[] array,boolean append){
try {
DataOutput dos;
if (bigEndian) {
dos=new DataOutputStream(stream);
}
else {
dos=new LEDataOutputStream(stream);
}
for (int i=0; i < array.length; i++) {
dos.writeInt(array[i]);
}
stream.close();
}
catch ( IOException e) {
throw new IllegalArgumentException("InputStream is unwritable : " + e.toString());
}
}
|
Write an int array in a binary File
|
public static double orthogonalDistance(GeoPoint point,GeoPoint lineStart,GeoPoint lineEnd){
double area=Math.abs((lineStart.getLatitude() * lineEnd.getLongitude() + lineEnd.getLatitude() * point.getLongitude() + point.getLatitude() * lineStart.getLongitude() - lineEnd.getLatitude() * lineStart.getLongitude() - point.getLatitude() * lineEnd.getLongitude() - lineStart.getLatitude() * point.getLongitude()) / 2.0);
double bottom=Math.hypot(lineStart.getLatitude() - lineEnd.getLatitude(),lineStart.getLongitude() - lineEnd.getLongitude());
return (area / bottom * 2.0);
}
|
Calculate the orthogonal distance from the line joining the lineStart and lineEnd points to point
|
public static void receiveFromInputStream(DatagramPacket p,InputStream inputStream,InetAddress inetAddress,int port) throws IOException {
int b0=inputStream.read();
int b1=inputStream.read();
if (b0 == -1 || b1 == -1) {
p.setLength(0);
throw new SocketException("read failed");
}
int frameLen=((b0 & 0xFF) << 8) | (b1 & 0xFF);
int readLen=0;
byte[] data=p.getData();
int off=0;
while (readLen < frameLen) {
int len=inputStream.read(data,off,frameLen - off);
if (len == -1) {
throw new SocketException("read failed");
}
else {
off+=len;
readLen+=len;
}
}
if (readLen == frameLen) {
p.setAddress(inetAddress);
p.setData(data,0,frameLen);
p.setPort(port);
}
else {
throw new SocketException("Failed to receive data from socket");
}
}
|
Receives an RFC4571-formatted frame from <tt>inputStream</tt> into <tt>p</tt>, and sets <tt>p</tt>'s port and address to <tt>port</tt> and <tt>inetAddress</tt>.
|
private void connectToSocket(){
SocketManager.getInstance().setListener(socketListener);
SocketManager.getInstance().connectToSocket(getActivity());
}
|
connect to socket
|
public void abort() throws IOException {
completeEdit(this,false);
}
|
Aborts this edit. This releases the edit lock so another edit may be started on the same key.
|
public Enumeration<Element> elements(){
return (registry.elements());
}
|
Get an enumeration of the elements that this element contains.
|
public static CreateVariableClause create(String variableType,String variableName){
return new CreateVariableClause(variableType,variableName,null,false);
}
|
Creates a create-variable syntax for declaring a variable.
|
public boolean isEditable(){
return editable;
}
|
Determine whether the dialog is editable or view-only.
|
public static PublicKey generatePublicKey(String encodedPublicKey){
try {
byte[] decodedKey=Base64.decode(encodedPublicKey);
KeyFactory keyFactory=KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
}
catch ( NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
catch ( InvalidKeySpecException e) {
Log.e(TAG,"Invalid key specification.");
throw new IllegalArgumentException(e);
}
catch ( Base64DecoderException e) {
Log.e(TAG,"Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
}
|
Generates a PublicKey instance from a string containing the Base64-encoded public key.
|
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
|
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
|
public static boolean isDate(String s){
pp.setIndex(0);
return df.parse(s,pp) != null;
}
|
Tests the string for a date starting at position zero.
|
static Node flush(Node node){
long x=node.bitmap - ((-6148914691236517206L & node.bitmap) >>> 1);
node.bitmap=x | ((-6148914691236517206L & x) >>> 1);
return node;
}
|
Mutates node to set all children in "shared" state (01)
|
public static final String timeStamp(Date date){
return timeStamp(date,null);
}
|
Creates a formatted timestamp string of the given date using the local host timezone.
|
public synchronized void add(DccLocoAddress locoAddress,boolean directionNormal){
if (!contains(locoAddress)) {
if (ConsistList.size() == 0) {
byte command=NceBinaryCommand.LOCO_CMD_FWD_CONSIST_LEAD;
if (!directionNormal) {
command=NceBinaryCommand.LOCO_CMD_REV_CONSIST_LEAD;
}
addLocoToConsist(locoAddress.getNumber(),locoAddress.isLongAddress(),command);
ConsistPosition.put(locoAddress,DccConsist.POSITION_LEAD);
}
else if (ConsistList.size() == 1) {
byte command=NceBinaryCommand.LOCO_CMD_FWD_CONSIST_REAR;
if (!directionNormal) {
command=NceBinaryCommand.LOCO_CMD_REV_CONSIST_REAR;
}
addLocoToConsist(locoAddress.getNumber(),locoAddress.isLongAddress(),command);
ConsistPosition.put(locoAddress,DccConsist.POSITION_TRAIL);
}
else {
byte command=NceBinaryCommand.LOCO_CMD_FWD_CONSIST_MID;
if (!directionNormal) {
command=NceBinaryCommand.LOCO_CMD_REV_CONSIST_MID;
}
addLocoToConsist(locoAddress.getNumber(),locoAddress.isLongAddress(),command);
ConsistPosition.put(locoAddress,ConsistPosition.size());
}
ConsistList.add(locoAddress);
ConsistDir.put(locoAddress,Boolean.valueOf(directionNormal));
}
else {
log.error("Loco " + locoAddress + " is already part of this consist "+ getConsistAddress());
}
}
|
Add a Locomotive to a Consist
|
public static short[] toShortArray(boolean[] array){
short[] result=new short[array.length];
for (int i=0; i < array.length; i++) {
result[i]=array[i] ? (short)1 : (short)0;
}
return result;
}
|
Coverts given booleans array to array of shorts.
|
public static void checkMainThread(){
if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && Looper.myLooper() != Looper.getMainLooper()) {
throw new IllegalStateException("Not in applications main thread");
}
}
|
Ensures that the calling thread is the application's main thread.
|
public final void waitForReplies() throws InterruptedException, ReplyException {
boolean result=waitForReplies(0);
Assert.assertTrue(result,"failed but no exception thrown");
}
|
Wait for all expected acks to be returned or an exception to come in. This method will return whether a) we have received replies from all desired members or b) the necessary conditions have been met so that we don't need to wait anymore.
|
private VPlexMigrationInfo migrateLocalVirtualVolumeExtent(String migrationName,VPlexVirtualVolumeInfo virtualVolumeInfo,Map<VolumeInfo,VPlexStorageVolumeInfo> storageVolumeInfoMap,boolean startNow,String transferSize) throws VPlexApiException {
String localDeviceName=virtualVolumeInfo.getSupportingDevice();
s_logger.info("Finding local device with name {}",localDeviceName);
VPlexApiDiscoveryManager discoveryMgr=_vplexApiClient.getDiscoveryManager();
VPlexDeviceInfo deviceInfo=discoveryMgr.findLocalDevice(localDeviceName);
if (null == deviceInfo) {
throw VPlexApiException.exceptions.cantFindLocalDevice(localDeviceName);
}
discoveryMgr.setSupportingComponentsForLocalDevice(deviceInfo);
List<VPlexExtentInfo> extentInfoList=deviceInfo.getExtentInfo();
if (null == extentInfoList || extentInfoList.isEmpty()) {
throw VPlexApiException.exceptions.cantFindExtentForLocalDevice(localDeviceName);
}
String extentName=extentInfoList.get(0).getName();
s_logger.info("Finding extent with name {}",extentName);
VPlexExtentInfo srcExtentInfo=discoveryMgr.findExtent(extentName);
s_logger.info("Found source extent");
VPlexApiVirtualVolumeManager virtualVolumeMgr=_vplexApiClient.getVirtualVolumeManager();
virtualVolumeMgr.claimStorageVolumes(storageVolumeInfoMap,false);
s_logger.info("Claimed storage volume");
try {
List<VPlexStorageVolumeInfo> storageVolumeInfoList=new ArrayList<VPlexStorageVolumeInfo>(storageVolumeInfoMap.values());
virtualVolumeMgr.createExtents(storageVolumeInfoList);
s_logger.info("Created extent on storage volume");
VPlexExtentInfo tgtExtentInfo=discoveryMgr.findExtents(storageVolumeInfoList).get(0);
s_logger.info("Found target extent");
VPlexMigrationInfo migrationInfo=migrateResource(migrationName,srcExtentInfo,tgtExtentInfo,false,startNow,transferSize);
migrationInfo.setVirtualVolumeInfo(virtualVolumeInfo);
return migrationInfo;
}
catch ( Exception e) {
s_logger.info("Exception occurred migrating local volume extent, attempting to cleanup VPLEX artifacts");
try {
List<VolumeInfo> nativeVolumeInfoList=new ArrayList<VolumeInfo>();
nativeVolumeInfoList.addAll(storageVolumeInfoMap.keySet());
virtualVolumeMgr.deleteVirtualVolume(nativeVolumeInfoList);
}
catch ( Exception ex) {
s_logger.error("Failed attempting to cleanup VPLEX after failed attempt " + "to migrate local virtual volume by extent {}",virtualVolumeInfo.getPath(),ex);
}
throw e;
}
}
|
Migrate the local device used by the passed virtual volume.
|
protected static String addMavenNamespace(String effectiveXml,boolean isPom){
SAXBuilder builder=new SAXBuilder();
try {
Document document=builder.build(new StringReader(effectiveXml));
Element rootElement=document.getRootElement();
Namespace pomNamespace=Namespace.getNamespace("","http://maven.apache.org/POM/4.0.0");
rootElement.setNamespace(pomNamespace);
Namespace xsiNamespace=Namespace.getNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
rootElement.addNamespaceDeclaration(xsiNamespace);
if (rootElement.getAttribute("schemaLocation",xsiNamespace) == null) {
rootElement.setAttribute("schemaLocation","http://maven.apache.org/POM/4.0.0 " + (isPom ? POM_XSD_URL : SETTINGS_XSD_URL),xsiNamespace);
}
ElementFilter elementFilter=new ElementFilter(Namespace.getNamespace(""));
for (Iterator<?> i=rootElement.getDescendants(elementFilter); i.hasNext(); ) {
Element e=(Element)i.next();
e.setNamespace(pomNamespace);
}
StringWriter w=new StringWriter();
Format format=Format.getPrettyFormat();
XMLOutputter out=new XMLOutputter(format);
out.output(document.getRootElement(),w);
return w.toString();
}
catch ( JDOMException e) {
return effectiveXml;
}
catch ( IOException e) {
return effectiveXml;
}
}
|
method from org.apache.maven.plugins.help.AbstractEffectiveMojo Add a Pom/Settings namespaces to the effective XML content.
|
public SentenceSplitter(String[] input){
this.input=input;
sentences=new LinkedList<>();
}
|
Sentence splits the given input.
|
public ObjectFactory(){
}
|
Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.oasis_open.docs.ws_sx.ws_trust._200512
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:37:58.925 -0500",hash_original_method="9793E04705FFD088D66045627DCAA850",hash_generated_method="2F742925FADB1FDDF79355A7C4F82E50") void _processWill(int option) throws IOException {
if (debugoptions) {
System.err.println("RECEIVED WILL: " + TelnetOption.getOption(option));
}
if (__notifhand != null) {
__notifhand.receivedNegotiation(TelnetNotificationHandler.RECEIVED_WILL,option);
}
boolean acceptNewState=false;
if (optionHandlers[option] != null) {
acceptNewState=optionHandlers[option].getAcceptRemote();
}
if (_doResponse[option] > 0) {
--_doResponse[option];
if (_doResponse[option] > 0 && _stateIsDo(option)) {
--_doResponse[option];
}
}
if (_doResponse[option] == 0 && _requestedDont(option)) {
switch (option) {
default :
break;
}
if (acceptNewState) {
_setWantDo(option);
_sendDo(option);
}
else {
++_doResponse[option];
_sendDont(option);
}
}
_setDo(option);
}
|
Processes a WILL request. <p>
|
public static ObjectAnimator ofObject(Object target,String propertyName,TypeEvaluator evaluator,Object... values){
ObjectAnimator anim=new ObjectAnimator(target,propertyName);
anim.setObjectValues(values);
anim.setEvaluator(evaluator);
return anim;
}
|
Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to. Two values imply a starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
|
public boolean levelCheck(int iter){
if (levelChecked < iter) {
levelChecked=iter;
boolean opDeclLevelCheck=opDeclNode.levelCheck(iter);
level=opDeclNode.getLevel();
if (set != null) {
levelCorrect=set.levelCheck(iter);
level=Math.max(set.getLevel(),level);
if (level == TemporalLevel) {
levelCorrect=false;
errors.addError(this.stn.getLocation(),"Level error:\n" + "Temporal formula used as set.");
}
}
;
levelCorrect=levelCorrect && opDeclLevelCheck;
if (set != null) {
levelParams=set.getLevelParams();
allParams=set.getAllParams();
levelConstraints=set.getLevelConstraints();
argLevelConstraints=set.getArgLevelConstraints();
argLevelParams=set.getArgLevelParams();
}
;
}
;
return levelCorrect;
}
|
The implementation of the LevelNode abstract methods. * The level of the node is the maximum of opDeclNode's level and the level of the `set' expression, if it's non-null. Any other level information comes from the `set' expression.
|
private Object readResolve(){
if (list instanceof RandomAccess) {
return new UnmodifiableRandomAccessList<E>(list);
}
return this;
}
|
Resolves UnmodifiableList instances to UnmodifiableRandomAccessList instances if the underlying list is a Random Access list. <p> This is necessary since UnmodifiableRandomAccessList instances are replaced with UnmodifiableList instances during serialization for compliance with JREs before 1.4. <p>
|
@Override public Object radioBut(final FormObject form){
final ToggleButton radioBut=new ToggleButton();
final JavaFXControlListener controlListener=new JavaFXControlListener(radioBut);
final StringBuilder styleBuilder=new StringBuilder(200);
radioBut.setUserData(RADIOBUTTON);
final boolean[] flags=form.getFieldFlags();
if ((flags != null) && (flags[FormObject.READONLY_ID])) {
radioBut.setDisable(true);
}
setupUniversalFeatures(radioBut,form,styleBuilder,controlListener);
setupButton(radioBut,form,controlListener);
setupToggleGroup(form,radioBut);
addFont(form,false,false,styleBuilder);
styleBuilder.append("-fx-padding:0;-fx-border:none;-fx-background-color:transparent;");
radioBut.selectedProperty().addListener(new JavaFXRadioListener(radioBut,form));
radioBut.setStyle(styleBuilder.toString());
return radioBut;
}
|
setup and return the Radio button specified in the FormObject
|
protected ShapePainter createFillStrokePainter(BridgeContext ctx,Element e,ShapeNode shapeNode){
return PaintServer.convertStrokePainter(e,shapeNode,ctx);
}
|
Creates the shape painter associated to the specified element. This implementation creates a shape painter considering the various fill and stroke properties.
|
protected List<Animator> createAnimators(){
return animatorList;
}
|
Create animators list.
|
public void hideSplashScreen(){
if (splashScreen != null) {
splashScreen.close();
splashScreen=null;
}
}
|
Close the curren splash screen and remove all resources
|
public static byte[] decode(final byte[] compressed) throws IOException {
ByteArrayInputStream byteIn=new ByteArrayInputStream(compressed);
ByteArrayOutputStream byteOut=new ByteArrayOutputStream();
GZIPInputStream gzIn=null;
try {
gzIn=new GZIPInputStream(byteIn);
int read;
byte[] buffer=new byte[BUFFER_SIZE];
do {
read=gzIn.read(buffer);
if (read > 0) {
byteOut.write(buffer,0,read);
}
}
while (read >= 0);
return byteOut.toByteArray();
}
finally {
gzIn.close();
byteOut.close();
}
}
|
Uncompress/decode the data provided using the GZIP format.
|
public GasStack(Gas gas,int quantity){
type=gas;
amount=quantity;
}
|
Creates a new GasStack with a defined Gas type and quantity.
|
public void readJasmin(Reader input,String name,boolean numberLines) throws IOException, Exception {
errors=0;
filename=name;
source_name=name;
cur_method=null;
cur_field=null;
cur_annotation=null;
class_header=false;
auto_number=numberLines;
class_env=new ClassEnv();
scanner=new Scanner(input);
parser parse_obj=new parser(this,scanner);
if (PARSER_DEBUG) {
parse_obj.debug_parse();
}
else {
parse_obj.parse();
}
}
|
Parses a Jasmin file, converting it internally into a binary representation. If something goes wrong, this throws one of an IOException, or a jasError, or one of a few other exceptions. I'll tie this down more formally in the next version.
|
private void write(int index,int value){
if (isWatched(index)) {
Clock.stop();
Trace.printf("%4d store %s: %08x -> %08x%n",Thread.currentThread().getId(),cellAddress(index),data[index],value);
Clock.start();
}
data[index]=value;
}
|
Perform the actual write of memory, possibly reporting values if watching is enabled for the given address.
|
public T caseDeclaredVersion(DeclaredVersion object){
return null;
}
|
Returns the result of interpreting the object as an instance of '<em>Declared Version</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
|
private void validateExtensionDataFile(ArchiveFile extFile) throws GeneratorException, InterruptedException, IOException {
addMessage(Level.INFO,"Validating the extension file: " + extFile.getTitle() + ". Depending on the number of records, this can take a while.");
Term id=TERM_FACTORY.findTerm(AppConfig.coreIdTerm(resource.getCoreRowType()));
Term occurrenceId=TERM_FACTORY.findTerm(Constants.DWC_OCCURRENCE_ID);
Term basisOfRecord=TERM_FACTORY.findTerm(Constants.DWC_BASIS_OF_RECORD);
int basisOfRecordIndex=-1;
if (isOccurrenceFile(extFile)) {
if (!extFile.hasTerm(basisOfRecord)) {
addMessage(Level.ERROR,"Archive validation failed, because required term basisOfRecord was not mapped in the occurrence extension data file: " + extFile.getTitle());
throw new GeneratorException("Can't validate DwC-A for resource " + resource.getShortname() + "Required term basisOfRecord was not mapped in the occurrence extension data file: "+ extFile.getTitle());
}
addMessage(Level.INFO,"? Validating the basisOfRecord in the occurrence extension data file is always present and its " + "value matches the Darwin Core Type Vocabulary.");
if (extFile.hasTerm(occurrenceId)) {
addMessage(Level.INFO,"? Validating the occurrenceId in occurrence extension data file is always present and unique. ");
}
else {
addMessage(Level.WARN,"No occurrenceId found in occurrence extension. To be indexed by GBIF, each occurrence record within a resource must have a unique record level identifier.");
}
basisOfRecordIndex=extFile.getField(basisOfRecord).getIndex();
}
if (extFile.getId() == null) {
addMessage(Level.ERROR,"Archive validation failed, because the ID field " + id.simpleName() + "was not mapped in the extension data file: "+ extFile.getTitle());
throw new GeneratorException("Can't validate DwC-A for resource " + resource.getShortname() + ". The ID field was not mapped in the extension data file: "+ extFile.getTitle());
}
addMessage(Level.INFO,"? Validating the ID field " + id.simpleName() + " is always present in extension data file. ");
int sortColumnIndex=(extFile.hasTerm(occurrenceId) && extFile.getField(occurrenceId).getIndex() != null) ? extFile.getField(occurrenceId).getIndex() : ID_COLUMN_INDEX;
File sortedFile=sortCoreDataFile(extFile,sortColumnIndex);
CSVReader reader=CSVReaderFactory.build(sortedFile,CHARACTER_ENCODING,extFile.getFieldsTerminatedBy(),extFile.getFieldsEnclosedBy(),extFile.getIgnoreHeaderLines());
int recordsWithNoId=0;
AtomicInteger recordsWithNoOccurrenceId=new AtomicInteger(0);
AtomicInteger recordsWithDuplicateOccurrenceId=new AtomicInteger(0);
AtomicInteger recordsWithNoBasisOfRecord=new AtomicInteger(0);
AtomicInteger recordsWithNonMatchingBasisOfRecord=new AtomicInteger(0);
AtomicInteger recordsWithAmbiguousBasisOfRecord=new AtomicInteger(0);
ClosableReportingIterator<String[]> iter=null;
int line=0;
String lastId=null;
try {
iter=reader.iterator();
while (iter.hasNext()) {
line++;
if (line % 1000 == 0) {
checkForInterruption(line);
reportIfNeeded();
}
String[] record=iter.next();
if (record == null || record.length == 0) {
continue;
}
if (iter.hasRowError() && iter.getException() != null) {
throw new GeneratorException("A fatal error was encountered while trying to validate sorted extension data file: " + iter.getErrorMessage(),iter.getException());
}
else {
if (Strings.isNullOrEmpty(record[ID_COLUMN_INDEX])) {
recordsWithNoId++;
}
if (isOccurrenceFile(extFile)) {
if (extFile.hasTerm(occurrenceId)) {
lastId=validateIdentifier(record[sortColumnIndex],lastId,recordsWithNoOccurrenceId,recordsWithDuplicateOccurrenceId);
}
validateBasisOfRecord(record[basisOfRecordIndex],line,recordsWithNoBasisOfRecord,recordsWithNonMatchingBasisOfRecord,recordsWithAmbiguousBasisOfRecord);
}
}
}
}
catch ( InterruptedException e) {
setState(e);
throw e;
}
catch ( Exception e) {
log.error("Exception caught while validating extension file",e);
setState(e);
throw new GeneratorException("Error while validating extension file occurred on line " + line,e);
}
finally {
if (iter != null) {
if (!iter.hasRowError() && iter.getErrorMessage() != null) {
writePublicationLogMessage("Error reading data: " + iter.getErrorMessage());
}
iter.close();
}
FileUtils.deleteQuietly(sortedFile);
}
if (recordsWithNoId > 0) {
addMessage(Level.ERROR,String.valueOf(recordsWithNoId) + " line(s) in extension missing an ID " + id.simpleName()+ ", which is required when linking the extension record and core record together");
throw new GeneratorException("Can't validate DwC-A for resource " + resource.getShortname() + ". Each line in extension must have an ID "+ id.simpleName()+ ", which is required in order to link the extension to the core ");
}
else {
addMessage(Level.INFO,"\u2713 Validated each line in extension has an ID " + id.simpleName());
writePublicationLogMessage("No lines in extension are missing an ID " + id.simpleName());
}
if (isOccurrenceFile(extFile)) {
if (extFile.hasTerm(occurrenceId)) {
summarizeIdentifierValidation(recordsWithNoOccurrenceId,recordsWithDuplicateOccurrenceId,occurrenceId.simpleName());
}
summarizeBasisOfRecordValidation(recordsWithNoBasisOfRecord,recordsWithNonMatchingBasisOfRecord,recordsWithAmbiguousBasisOfRecord);
}
}
|
Validates that each record has a non empty ID, which is used to link the extension record and core record together. </br> Validates that each occurrence record has an occurrenceID, and that each occurrenceID is unique. Performs this check only if the occurrenceID term has actually been mapped. </br> Validates that each occurrence record has a basisOfRecord, and that each basisOfRecord matches the DwC Type Vocabulary.
|
public static boolean isSupportNativeET(){
return SUPPORT_NATIVE_ET;
}
|
The native socket transport for Linux using JNI.
|
public boolean drawImage(Image img,int x,int y,Color bgcolor,ImageObserver observer){
return drawImage(img,x,y,img.getWidth(null),img.getHeight(null),bgcolor,observer);
}
|
Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (<i>x</i>, <i>y</i>) in this graphics context's coordinate space. Transparent pixels are drawn in the specified background color. <p> This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient. <p> This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device. <p> If the image has not yet been completely loaded, then <code>drawImage</code> returns <code>false</code>. As more of the image becomes available, the process that draws the image notifies the specified image observer.
|
public static boolean isGetter(Declaration decl){
return (decl instanceof Value) && !((Value)decl).isParameter() && ((Value)decl).isTransient();
}
|
Determines whether the declaration is a getter (a transient value that is not a parameter)
|
public void save(OutputStream out) throws IOException {
Writer w=new OutputStreamWriter(out,"UTF8");
save(w);
w.flush();
}
|
Writes the contents of the DOMOutput into the specified output stream.
|
public static void realft(double[] data,int isign){
com.nr.fft.FFT.realft(data,isign);
}
|
Calculates the Fourier transform of a set of n real-valued data points. Replaces these data (which are stored in array data[0..n-1]) by the positive frequency half of their complex Fourier transform. The real-valued first and last components of the complex transform are returned as elements data[0] and data[1], respectively. n must be a power of 2. This routine also calculates the inverse transform of a complex data array if it is the transform of real data. (Result in this case must be multiplied by 2/n.)
|
@Override public void dispose(){
m_breakpointTable.dispose();
}
|
Frees allocated resources.
|
public void fireGenerateEvent(int eventType,String name,String data){
}
|
Fire off processingInstruction events.
|
public boolean isAllMatches(){
return isAllMatches;
}
|
True for all-matches.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.